ProjectsParts Services
Environment Configuration
Quick Start for New Developers
Environment Configuration
Quick Start for New Developers
- Copy example files:
for service in payment catalog user search cart health-analytics analytics media; do
cp services/$service/.env.example services/$service/.env
done-
Get secrets from team lead (MongoDB URI, API tokens, etc.)
-
Start services:
bun run devFile Structure
Each service has exactly 2 env files:
| File | Purpose | Git |
|---|---|---|
.env.example | Template with placeholders | ✅ Committed |
.env | Actual secrets for local dev | ❌ Ignored |
Shared Secrets
All services share these credentials:
| Variable | Source | Used By |
|---|---|---|
MONGODB_URI | MongoDB Atlas | All services |
SENTRY_DSN | Sentry.io | All services |
ADMIN_API_TOKEN | Generate locally | search, catalog, analytics |
Service Ports
| Service | Port |
|---|---|
| cart | 3000 |
| search | 3001 |
| payment | 3004 |
| user | 3005 |
| health-analytics | 3005 |
| catalog | 3010 |
| analytics | 3020 |
Environment-Specific Config
| Environment | MongoDB Database | API Gateway |
|---|---|---|
| Development | crop_dev | http://localhost:* |
| Stage | crop_stage | https://api.crop-dev.app |
| Production | crop_prod | https://api.crop.app |
Generating Secrets
# Admin API token
openssl rand -hex 32
# Webhook secret (Stripe/Clerk format)
openssl rand -base64 32 | tr -d '\n' | sed 's/^/whsec_/'Troubleshooting
Service won't start:
- Check
.envfile exists (not just.env.example) - Verify MongoDB URI is accessible
- Check port isn't already in use
Authentication errors:
- Verify
CLERK_*variables match Clerk dashboard - Check
ADMIN_API_TOKENmatches between services