Prerequisites
- Docker Desktop (includes Docker Compose)
- A
.envfile in the project root (copy.env.exampleto get started)
The first build takes a few minutes while Docker pulls the base images and installs npm packages inside the container. Subsequent starts are much faster.
First-time setup
Copy the environment file
Create your local Open
.env from the example template:.env and set DATABASE_URL, JWT_SECRET, and any other required values. See Environment variables for the full reference.Start the containers
Build the images and start PostgreSQL and the API in the foreground:This runs
docker compose up --build. You will see log output from both the db and api services. When you see SERVER RUNNING SUCCESSFULLY, the API is ready.To start in detached mode (background) instead:Run migrations and seed data
Apply the Drizzle ORM migrations and load the initial seed data into the running container:Or run reset, migrate, and seed all at once:
Docker commands reference
Database commands inside Docker
| Command | What it does |
|---|---|
npm run docker:migrate | Run pending Drizzle migrations inside the api container |
npm run docker:seed | Load initial seed data inside the api container |
npm run docker:fresh | Reset the database, run migrations, and seed — all in one step |
Logs and shell access
Destroy all data
Deploying to Railway
The repository includes arailway.json that configures the build and deploy pipeline for Railway.
- Connect your GitHub repository in the Railway dashboard.
- Add a PostgreSQL plugin and copy the
DATABASE_URLit provides into your service’s environment variables. - Set
JWT_SECRETand any other required variables in the Railway environment settings. - Railway detects
railway.jsonautomatically and runsnpm run buildfollowed bynode dist/main.
Set
PORT in Railway’s environment variables if you need a specific port. The API reads process.env.PORT and defaults to 3000.