Configuration
StyleGrab is configured via environment variables. Copy .env.example to .env and customize.
Required Variables
| Variable | Description |
|---|---|
DATABASE_URL | PostgreSQL connection string |
JWT_SECRET | Secret key for JWT token signing (min 32 chars) |
STRIPE_SECRET_KEY | Stripe API secret key for payments |
STRIPE_WEBHOOK_SECRET | Stripe webhook signing secret |
Optional Variables
| Variable | Default | Description |
|---|---|---|
HOST | 0.0.0.0 | Server bind address |
PORT | 3000 | Server port |
BROWSER_WS_URL | ws://127.0.0.1:9222 | CDP WebSocket URL for headless browser |
REDIS_URL | redis://127.0.0.1:6379 | Redis connection URL |
LOG_LEVEL | info | Logging level (trace, debug, info, warn, error) |
Example Configuration
# Database
DATABASE_URL=postgres://stylegrab:password@localhost:5432/stylegrab
# Authentication
JWT_SECRET=your-super-secret-jwt-key-min-32-characters
# Stripe (for payments)
STRIPE_SECRET_KEY=sk_test_...
STRIPE_WEBHOOK_SECRET=whsec_...
# Browser
BROWSER_WS_URL=ws://chrome:9222
# Server
HOST=0.0.0.0
PORT=3000
# Redis (optional, for caching)
REDIS_URL=redis://localhost:6379
# Logging
LOG_LEVEL=info
Database Migrations
Migrations run automatically on startup. To run them manually:
# Using sqlx-cli
cargo install sqlx-cli
sqlx migrate run
# Or via Docker
docker compose exec app sqlx migrate run
Production Considerations
Security
- Use strong, unique values for
JWT_SECRET - Enable HTTPS via a reverse proxy (nginx, Caddy, etc.)
- Restrict database access to the application server only
- Use environment-specific Stripe keys (live vs test)
Performance
- Enable Redis caching for frequently accessed data
- Use connection pooling for PostgreSQL
- Run multiple app instances behind a load balancer
Monitoring
Set LOG_LEVEL=debug for troubleshooting. In production, use info or warn.
Next Steps
- Quick Start — Make your first extraction
- Authentication — API authentication details