Prerequisites
Before starting, ensure you have the following installed:- Python 3.13+ (required for modern async features)
- PostgreSQL via Supabase (managed database)
- Redis 5.0+ (for Celery task queue)
- Git (for version control)
Initial Setup
Create Virtual Environment
Python 3.13 is required for async features and performance optimizations.
Always activate the virtual environment before running any commands. Verify with:
Install Dependencies
- FastAPI 0.109+ (web framework)
- SQLAlchemy 2.0 (ORM)
- Celery 5.3+ (task queue)
- Playwright 1.56+ (web scraping)
- Anthropic Claude SDK
- Logfire 4.14+ (observability)
Install Playwright Browsers
Playwright requires Chromium for headless web scraping (~300MB download).
Configure Environment Variables
Copy the example environment file and configure your credentials:Edit
.env with your values:Where to Get API Keys
Where to Get API Keys
- Anthropic API: console.anthropic.com
- Exa API: exa.ai
- Supabase: Your project dashboard
- Logfire: logfire.pydantic.dev
Running Services
Quick Start (Recommended)
- API: http://localhost:8000
- API Docs: http://localhost:8000/docs
- Health Check: http://localhost:8000/health
- Flower Dashboard: http://localhost:5555 (run
make flower)
Manual Start (For Debugging)
Run services individually for better control:Celery runs with
concurrency=1 for sequential processing. This prevents API rate limits when generating multiple emails.Stopping Services
IDE Configuration
VS Code Setup
Create.vscode/settings.json:
PyCharm Setup
- Configure Interpreter: Settings → Project → Python Interpreter → Add Interpreter → Existing Environment →
venv/bin/python - Enable pytest: Settings → Tools → Python Integrated Tools → Testing → Default test runner: pytest
- Code Style: Settings → Editor → Code Style → Python → Set line length to 100
Pre-commit Hooks
While not strictly enforced, you can set up pre-commit hooks for code quality:.pre-commit-config.yaml:
Environment Variables Reference
Complete Environment Variables
Complete Environment Variables
| Variable | Required | Default | Description |
|---|---|---|---|
ENVIRONMENT | No | development | Runtime environment |
DEBUG | No | False | Enable debug mode |
DB_USER | Yes | - | Supabase database user |
DB_PASSWORD | Yes | - | Database password |
DB_HOST | Yes | - | Database host (pooler URL) |
DB_PORT | No | 6543 | Transaction pooler port |
DB_NAME | Yes | - | Database name |
SUPABASE_URL | Yes | - | Supabase project URL |
SUPABASE_SERVICE_ROLE_KEY | Yes | - | Service role key |
ANTHROPIC_API_KEY | Yes | - | Claude API key |
EXA_API_KEY | Yes | - | Exa search API key |
FIREWORKS_API_KEY | No | - | Fireworks AI key (optional) |
REDIS_HOST | No | localhost | Redis host |
REDIS_PORT | No | 6379 | Redis port |
REDIS_DB | No | 0 | Redis database number |
LOGFIRE_TOKEN | No | - | Logfire observability token |
TEMPLATE_PARSER_MODEL | No | fireworks:kimi-k2p5 | Model for template parsing |
EMAIL_COMPOSER_MODEL | No | fireworks:kimi-k2p5 | Model for email generation |
ALLOWED_ORIGINS | No | http://localhost:3000 | CORS origins (comma-separated) |
Hot-Swappable LLM Models
Scribe supports switching between different LLM providers without code changes:Cost Optimization: Use lightweight models (Haiku, Kimi) for template parsing and powerful models (Sonnet) for final email composition.
Common Issues
Redis Connection Error
Redis Connection Error
Playwright Browser Not Found
Playwright Browser Not Found
Module Import Errors
Module Import Errors
Database Connection Timeout
Database Connection Timeout
- Verify
DB_HOSTuses.pooler.supabase.com - Ensure
DB_PORT=6543for transaction pooler - Check firewall/network settings
Next Steps
Testing Guide
Learn how to write and run tests
Debugging
Debug pipeline steps and Celery tasks
Project Structure
Understand the codebase organization
API Reference
Explore the REST API endpoints
