/rust-web-starter

A starter for developing web services with Rust

Primary LanguageRust

Local Development

Setup

First, you must generate the private and public PEM keys which are used by the server to authenticate API requests using a bearer token. To generate these keys simply run:

./scripts/dev-setup

This will generate 3 files:

  • conf/public.pem - the public key for validating JWT tokens
  • conf/private.pem - the private key for creating JWT tokens
  • jwt.txt - a JWT token with a 1 hour expiration for local testing

If you need a new JWT token at any time you can simply run:

./scripts/jwt new user@example.com conf/private.pem

Starting the Server

Once setup is complete, you can run:

docker compose up -d

This will start the database and application server as docker containers. The docker compose stack uses a development container for the app server which is not optimized for production but will perform automatic rebuilds whenever you modify any of the source files.