Velvet
(original repo: https://github.com/raffaeleragni/velvet)
A repackage and republish of a combination of crates to create a specific web stack in a consistent and single point of view. This is not meant to be a library with any specific purpose, only a short handing of boilerplate for the common setup and structure of this web stack.
Stack used
The templates and static files will be compiled in the binary and those directories and won't be required at runtime.
Items of the stack:
- WEB: Axum
- DB: sqlx(postgres)
- Templating: Askama (folder templates/)
- Telemetry: sentry supported
Base route setup
use *;
async
Add a database
use *;
async
Support for static files
Example:
use *;
async
Where to find...
- Status (no-op): http GET /status/liveness
- Metrics: http GET /metrics/prometheus
ENV vars
- SERVER_BIND: ip for which to listen on
- SERVER_PORT: [number] port for which to listen on
- SENTRY_URL: full url for sending data to sentry, if present
- DATABASE_URL: postgres://user:pass@host:port/database (if database used)
- DATABASE_MAX_CONNECTIONS: [number] (default 1)
- STRUCTURED_LOGGING: true|false (default false)
- SENTRY_URL: url inclusive of key for sending telemtry to sentry
To setup TLS use env vars:
- TLS=true (or any string)
- TLS_PEM_CERT=cert.pem
- TLS_PEM_KEY=key.pem