This guide covers local development setup and production deployment for Creative Store.
docker compose up -dThis starts:
- PostgreSQL on port 5432
- Redis on port 6379
cp .env.example .envGenerate a secure auth secret:
BETTER_AUTH_SECRET="$(openssl rand -base64 32)"Add to your .env file.
To enable Google Sign-In:
- Go to Google Cloud Console
- Create OAuth 2.0 Client ID (Web application)
- Add authorized redirect URI:
http://localhost:3000/api/auth/callback/google - Add credentials to
.env:
GOOGLE_CLIENT_ID=your-client-id.apps.googleusercontent.com
GOOGLE_CLIENT_SECRET=your-client-secretbun installbun run prisma:migrateAPI Server:
bun run dev:apiRuns on http://localhost:3000
Web Frontend:
bun run dev:webRuns on http://localhost:5173
To enable Gemini-powered creative generation:
GOOGLE_GENERATIVE_AI_API_KEY="your_key_here"- Copy and configure production environment:
cp .env.prod.example .env.prod
# Edit .env.prod with your production values- Build and start all services:
docker compose -f docker-compose.prod.yml --env-file .env.prod up -d --build- Run database migrations:
docker compose -f docker-compose.prod.yml exec api bun run --cwd packages/db prisma migrate deploy| Service | Port | Description |
|---|---|---|
| web | 80 | Nginx serving React frontend |
| api | 3000 | Hono API server |
| worker | - | BullMQ background worker |
| postgres | 5432 | PostgreSQL database |
| redis | 6379 | Redis for job queue |
# Build only API
docker build --target api -t creative-store-api .
# Build only Worker
docker build --target worker -t creative-store-worker .
# Build only Web (Nginx)
docker build --target web -t creative-store-web .View logs:
docker compose -f docker-compose.prod.yml logs -fView specific service logs:
docker compose -f docker-compose.prod.yml logs -f apiStop all services:
docker compose -f docker-compose.prod.yml downStop and remove volumes (WARNING: deletes data):
docker compose -f docker-compose.prod.yml down -vRestart a specific service:
docker compose -f docker-compose.prod.yml restart apiScale workers:
docker compose -f docker-compose.prod.yml up -d --scale worker=3- Web:
http://localhost/health - API:
http://localhost:3000/api/health
Use a reverse proxy for HTTPS:
For production, use:
- Docker secrets
- AWS Secrets Manager
- HashiCorp Vault
- Environment-specific
.envfiles (not committed)
Set up automated PostgreSQL backups:
# Manual backup
docker compose -f docker-compose.prod.yml exec postgres pg_dump -U postgres creative_store > backup.sql
# Restore
docker compose -f docker-compose.prod.yml exec -T postgres psql -U postgres creative_store < backup.sqlConsider automated solutions:
- pg_dump cron jobs
- AWS RDS automated backups
- Managed database services
Recommended monitoring stack:
- Metrics: Prometheus + Grafana
- Logging: ELK Stack (Elasticsearch, Logstash, Kibana) or Loki
- APM: Sentry, Datadog, or New Relic
Horizontal scaling:
# Scale API servers
docker compose -f docker-compose.prod.yml up -d --scale api=3
# Scale workers
docker compose -f docker-compose.prod.yml up -d --scale worker=5Database scaling:
- Read replicas for PostgreSQL
- Redis Cluster for high availability
| Variable | Description | Example |
|---|---|---|
DATABASE_URL |
PostgreSQL connection | postgresql://user:pass@host:5432/db |
REDIS_URL |
Redis connection | redis://localhost:6379 |
BETTER_AUTH_SECRET |
Auth session secret | openssl rand -base64 32 |
| Variable | Description |
|---|---|
GOOGLE_CLIENT_ID |
Google OAuth client ID |
GOOGLE_CLIENT_SECRET |
Google OAuth secret |
| Variable | Description |
|---|---|
GOOGLE_GENERATIVE_AI_API_KEY |
Gemini API key for creative generation |
| Variable | Description |
|---|---|
AICC_TOKEN_ADDRESS |
AICC token contract address |
OPENWORK_TOKEN_ADDRESS |
OpenWork token contract address |
| Variable | Description |
|---|---|
S3_ENDPOINT |
S3-compatible storage endpoint |
S3_ACCESS_KEY |
S3 access key |
S3_SECRET_KEY |
S3 secret key |
S3_BUCKET |
S3 bucket name |
# Check if PostgreSQL is running
docker compose ps
# View PostgreSQL logs
docker compose logs postgres
# Test connection
docker compose exec postgres psql -U postgres -c "SELECT 1"# Check API logs
docker compose -f docker-compose.prod.yml logs api
# Verify environment variables
docker compose -f docker-compose.prod.yml exec api env | grep DATABASE# Reset database (development only)
bun run prisma:reset
# Generate Prisma client
bun run prisma:generate
# View migration status
bun run --cwd packages/db prisma migrate status# Check Redis status
docker compose exec redis redis-cli ping
# View Redis logs
docker compose logs redisIf Better Auth reports invalid origin:
- Check
trustedOriginsin auth configuration - Restart the API after updating origins
- Verify
BETTER_AUTH_URLmatches your deployment URL