A potential future replacement for imdt: the archive of past shows put on by DramaTech Theatre in Atlanta, GA
The backend for this site is written primarily in rust. It uses:
- Diesel as a database abstraction layer
- Models are in
src/data/models/
. - The autogenerated schema is in
src/data/schema.rs
. - Migrations are in
migrations/
.
- Models are in
- Tera as a templating engine
- The templates are in
views/
. view::Views
is a thin wrapper around tera.
- The templates are in
- Axum as the application server
- Routes are configured in
routes::build_routes
, though I'm open to changing our abstractions around routing. - Handlers live in
src/handlers/
. - The shared state that all the handlers have access to is
application::Application
. It should be immutable after server initialization.
- Routes are configured in
The most direct way to get set up is to ensure you have docker installed and run
docker compose up
This will start containers for the database and the application server, initialialize and migrate the database, and start the application server on port 64741. It will also watch the current directory, and will rebuild and restart the application server on almost any change2 to the application.
I want to set this up without using containers
First, get postgres running and accessible from your development environment in whatever manner works best for you. Note the connection details, then
echo "DATABASE_URL=postgres://user:pass@localhost:5432/dtdb_dev" >.env
where the credentials, host, and port are appropriate for your setup. The database name dtdb_dev
is recommended, but you can name the database whatever you want. If it doesn't exist yet, it'll be created later as long as the user has permission to create a database.
Next, make sure you have rust installed, then run the following to migrate the DB:
# Install the CLI for the database abstraction library
cargo install diesel_cli --no-default-features --features postgres
# Create the database if it doesn't exist and run all the migrations
diesel setup
Finally, make sure everything's working:
cargo build
cargo test
Now, to launch the application server, you can run
cargo run -- --config config.json