Restaurant reservation application
# Install dependencies for both frontend and backend
npm install
# Run both frontend and backend in development mode
npm run devRun the application in production mode using Docker Compose. This setup builds and deploys both the backend API and frontend web application in containers.
- Docker and Docker Compose installed
- Supabase project set up (for database and storage)
-
Create environment file:
cp .env.production.template .env.production
-
Edit
.env.productionwith your actual credentials (see Environment Variables below) -
Build and start containers:
docker-compose --env-file .env.production up --build -d
-
Access the application:
- Frontend: http://localhost
- Backend API: http://localhost/api
# Build and start containers in detached mode
docker-compose --env-file .env.production up --build -d
# View logs (all services)
docker-compose logs -f
# View logs (specific service)
docker-compose logs -f backend
docker-compose logs -f frontend
# Stop containers
docker-compose down
# Rebuild and restart
docker-compose --env-file .env.production down
docker-compose --env-file .env.production up --build -dThe Docker Compose setup includes:
-
Backend Container (Node.js/Express)
- Runs compiled TypeScript application
- Connects to Supabase database and storage
- Exposes port 8080 internally
-
Frontend Container (nginx)
- Serves static Expo web build
- Proxies
/api/*requests to backend container - Exposes port 80 externally
-
Docker Network
- Internal bridge network for container communication
- Backend accessible to frontend via hostname
backend
All environment variables are configured in .env.production file.
| Variable | Description | Example |
|---|---|---|
FRONTEND_URL |
Public URL where frontend is hosted | http://localhost |
EXPO_PUBLIC_BACKEND_URL |
Backend API URL (from frontend's perspective) | http://localhost/api |
EXPO_PUBLIC_SUPABASE_PROJ_URL |
Supabase project URL | https://xxx.supabase.co |
EXPO_PUBLIC_SUPABASE_ANON_KEY |
Supabase anonymous/public key for client-side auth | eyJhbGci... |
| Variable | Description | Example |
|---|---|---|
EMAIL_USER |
Email address for sending notifications (SMTP) | [email protected] |
EMAIL_PASS |
Email password or app-specific password | your-app-password |
SUPABASE_PROJ_URL |
Supabase project URL (same as frontend) | https://xxx.supabase.co |
SUPABASE_SERVICE_ROLE_KEY |
Supabase service role key (backend only, has admin privileges) | eyJhbGci... |
SUPABASE_DB_URL |
PostgreSQL connection string for Supabase database | postgresql://postgres... |
ACCESS_TOKEN_SECRET |
Supabase JWT secret for signing/verifying access tokens | your-super-secret-jwt-token-with-at-least-32-characters-long |
REFRESH_TOKEN_SECRET |
Secret key for signing JWT refresh tokens (generate random string) | random-secret-string |
STRIPE_SK_API |
Stripe secret key for payment processing | sk_test_... or sk_live_... |
-
Supabase Variables:
- Go to your Supabase Dashboard
- Select your project
- Go to Settings → API
- Copy
URL,anon/public key, andservice_role key - For
SUPABASE_DB_URL: Go to Settings → Database → Connection String (URI) - For
ACCESS_TOKEN_SECRET: Go to Settings → API → JWT Settings → Copy theJWT Secret
-
Email Variables:
- For Gmail: Enable 2FA and generate an App Password
- Use your email as
EMAIL_USERand app password asEMAIL_PASS
-
Refresh Token Secret:
- Generate a random string (64+ characters recommended):
openssl rand -base64 64
- Use this for
REFRESH_TOKEN_SECRETonly - Note:
ACCESS_TOKEN_SECRETcomes from Supabase (see step 1), do NOT generate it
- Generate a random string (64+ characters recommended):
-
Stripe API Key:
- Go to Stripe Dashboard
- Developers → API Keys
- Use test key for development, live key for production
- Never commit
.env.productionto version control (it's in.gitignore) - Keep
SUPABASE_SERVICE_ROLE_KEYsecret - it has admin access to your database - Use strong random strings for JWT secrets
- Use Stripe test keys for development, live keys only in production