Run & Deploy
Bring the whole stack up with one commandusing Docker Compose, then push it live. You’re at the finish line.
Run It All with Compose
A single docker-compose.yml at the repo root describes the database, the API, and the web app together.
services:
db:
image: postgres:16
environment:
POSTGRES_PASSWORD: secret
POSTGRES_DB: inventory
ports: ["5432:5432"]
volumes: ["dbdata:/var/lib/postgresql/data"]
api:
build: ./server
env_file: ./server/.env
ports: ["4000:4000"]
depends_on: [db]
web:
build: ./web
ports: ["3000:3000"]
depends_on: [api]
volumes:
dbdata:$ docker compose up -d --build # build + start everything
$ docker compose logs -f # watch all services
$ docker compose down # stop (data stays in the volume)For Postgres, containers talk to each other by service name, not localhost. Point the API’s DATABASE_URL at db (e.g. postgresql://postgres:secret@db:5432/inventory) when it runs in Compose. For MongoDB Atlas, your connection string remains unchanged as it points to the cloud database.
Each app needs a small Dockerfile(node base image, copy, install, build, start). The Next.js and NestJS docs both publish official examples — search “Dockerfile” on nextjs.org and docs.nestjs.com.
Before You Go Live
A short checklist to flip the app from "works on my machine" to "safe in production".
- ✓Migrations, not auto-sync — set TypeORM
synchronize: falseand generate migrations so you never drop data. - ✓Strong secrets — a long random
JWT_SECRET; never reuse the dev value. - ✓Secure cookies — set
secure: trueand (for cross-site frontends)sameSite: "none"on the login cookie. - ✓Lock CORS — set the API’s CORS
originto your real frontend URL withcredentials: true. - ✓Real email — swap Mailtrap for a production SMTP (Gmail App Password, SendGrid, or Resend).
- ✓Update
CLIENT_URL— verification links and redirects must point at the live domain.
Step-by-Step Cloud Guide
The professional path: deploy your frontend to Vercel, API server to AWS EC2, and database to AWS (RDS or Docker).
Vercel is the premier platform for static sites and serverless functions, perfect for hosting your web/ directory.
- Push your code to a GitHub repository (ensure
.envis excluded by.gitignore). - Log in to Vercel and click Add New Project.
- Import your GitHub repository.
- In the configuration, set the Root Directory to
web. - Add any required environment variables (e.g.,
NEXT_PUBLIC_API_URLpointing to your EC2 backend:http://your-ec2-public-ip:4000). - Click Deploy. Vercel will build and host your frontend on a
*.vercel.appdomain with SSL enabled.
Alternative Deploy Options
If you prefer quick cloud platforms with built-in databases and simpler interfaces over AWS.
Every host above deploys from a Git repo. git init, commit, create a repo on GitHub, and push — then connect it in each platform’s dashboard.
You Built It
A full inventory system with verified accounts, product CRUD, and automatic low-stock alerts — on the stack of your choice.
- ✓Users register and must verify their email to log in
- ✓Logged-in users add, edit, delete, and view products
- ✓Low stock triggers an automatic email
- ✓The whole stack runs from one
docker compose up - ✓It's deployed and reachable on the internet