Multi-provider email delivery service with intelligent routing and automatic failover
CourierX is a production-ready email delivery platform that intelligently routes emails across multiple providers with automatic failover, comprehensive webhook handling, and enterprise-grade features.
- π Multi-Provider Support - SendGrid, Mailgun, AWS SES, SMTP, Postmark, Resend
- π Intelligent Routing - Automatic failover with priority-based selection
- π Real-time Tracking - Webhook processing with delivery status updates
- π Enterprise Security - API key auth, JWT tokens, encrypted credentials
- π’ Multi-Tenant - Complete tenant isolation with product-level config
- β‘ High Performance - Go-powered email engine with connection pooling
- π³ Docker Ready - One-command deployment with Docker Compose
ββββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
β Next.js UI β β Rails API β β Go Core β
β Dashboard βββββΆβ Control Plane βββββΆβ Email Engine β
β (TypeScript) β β (API-only) β β (High perf) β
ββββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
β β β
β β βΌ
β β βββββββββββββββββββ
β β β Providers β
βΌ βΌ β SendGrid β
ββββββββββββββββββββ ββββββββββββββββββββ β Mailgun β
β Your App β β PostgreSQL β β AWS SES β
β (API Client) β β + Redis β β SMTP β
ββββββββββββββββββββ ββββββββββββββββββββ β Postmark β
β Resend β
βββββββββββββββββββ
Tech Stack:
- Frontend: Next.js 14 + TypeScript (Dashboard UI, real-time analytics)
- API: Rails 7.1+ API-only (Authentication, multi-tenancy, business logic)
- Engine: Go 1.21+ (High-performance email sending, provider management)
- Database: PostgreSQL 15+ (with encryption for sensitive data)
- Cache/Queue: Redis 7+ (background jobs, rate limiting)
- Infrastructure: Docker, Kubernetes
Why This Stack?
- β Easy to hire for: Massive talent pools for React, Rails, and Go
- β Industry standard: Modern, well-documented technologies
- β Separation of concerns: UI, API, and email engine are decoupled
- β Best tool for each job: Next.js for rich UI, Rails for API, Go for performance
# Clone repository
git clone https://github.com/courierX-dev/courierx.git
cd courierx
# Start all services with Docker Compose
cd infra && docker compose up -d
# Check that all containers are running
docker compose ps
# Services will be available at:
# - Rails Control Plane: http://localhost:4000
# - Go Core Engine: http://localhost:8080
# - Sidekiq: (background job processing)
# - PostgreSQL: localhost:5432
# - Redis: localhost:6379If you prefer to run Rails and Go natively (faster for development):
# Start only databases in Docker
./infra/scripts/setup-dev-light.sh
# Then run Rails in one terminal:
cd control-plane && bundle install && rails db:create db:migrate && rails server -p 4000
# And Go in another terminal:
cd apps/core-go && go run .# Register a new account
curl -X POST http://localhost:4000/api/v1/auth/register \
-H "Content-Type: application/json" \
-d '{
"tenant": {"name": "My Company"},
"user": {
"email": "admin@mycompany.com",
"password": "secure_password",
"first_name": "John",
"last_name": "Doe"
}
}'
# Create a product and get API key
curl -X POST http://localhost:4000/api/v1/products \
-H "Authorization: Bearer YOUR_JWT_TOKEN" \
-H "Content-Type: application/json" \
-d '{"name": "My App", "rate_limit": 1000}'
# Send an email
curl -X POST http://localhost:4000/api/v1/messages/send \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"to": "user@example.com",
"from": "sender@yourdomain.com",
"subject": "Hello from CourierX",
"html": "<p>Your email content here</p>"
}'| Provider | Status | Features |
|---|---|---|
| SendGrid | β | API, Webhooks, Templates |
| Mailgun | β | API, Webhooks, Domains |
| AWS SES | β | API, SNS Webhooks |
| SMTP | β | Generic SMTP with connection pooling |
| Postmark | β | Modern email API |
| Resend | β | Developer-friendly API |
- Development Milestones - Project roadmap with story points
- Implementation Guide - Step-by-step development guide
- Story Details - Detailed acceptance criteria
- Setup Guide - Complete setup instructions
- PR Automation - Automated PR management
- Ruby 3.4+ (Rails 8.1 requires Ruby 3.4)
- Go 1.22+
- Docker & Docker Compose (for containerized development)
- PostgreSQL 15+ (included in Docker)
- Redis 7+ (included in Docker)
courierx/
βββ apps/
β βββ core-go/ # Go email sending engine
β βββ dashboard/ # Next.js dashboard (coming in Milestone 4)
βββ control-plane/ # Rails API (API-only, no views)
βββ infra/ # Infrastructure & deployment
β βββ docker/ # Dockerfiles
β βββ kubernetes/ # K8s manifests
β βββ scripts/ # Deployment scripts
βββ docs/ # Documentation
Key Architectural Decisions:
- Rails: API-only mode (no views, no asset pipeline)
- Next.js: Separate app for dashboard, connects via REST API
- Go: Standalone service, communicates with Rails via HTTP
- All services: Can be deployed independently
# Start all services (from project root)
cd infra && docker compose up -d
# View logs
docker compose logs -f
# View logs for specific service
docker compose logs -f control-plane
# Stop all services
docker compose down
# Restart a specific service
docker compose restart control-plane
# Run Rails console
docker compose exec control-plane bundle exec rails console
# Run Go tests
cd apps/core-go && go test ./...
# Run Rails tests
cd control-plane && bundle exec rspec# Create migration
cd control-plane
bundle exec rails generate migration AddFieldToModel field:type
# Run migrations
bundle exec rails db:migrate
# Seed database
bundle exec rails db:seed# Set up environment variables
cp .env.example .env.production
# Edit .env.production with your production values
# Deploy with script
./infra/scripts/deploy.shRequired for production:
DATABASE_URL- PostgreSQL connection stringREDIS_URL- Redis connection stringJWT_SECRET- Secret for JWT token signingENCRYPTION_KEY- Key for encrypting provider credentialsSECRET_KEY_BASE- Rails secret key baseGO_CORE_SECRET- Shared secret for Rails-Go communication
Provider credentials:
SENDGRID_API_KEYMAILGUN_API_KEY&MAILGUN_DOMAINAWS_ACCESS_KEY_ID,AWS_SECRET_ACCESS_KEY,AWS_REGION
- Docker Compose - Included configuration for multi-container deployment
- Kubernetes - K8s manifests in
infra/kubernetes/ - Cloud Platforms - Deploy to AWS, GCP, Azure, DigitalOcean
- Heroku/Railway/Render - Platform-specific configurations available
Current Phase: Foundation & Core Infrastructure (Milestone 1)
- Project structure established
- Docker configurations complete
- Deployment scripts ready
- Comprehensive documentation (milestones, implementation guide)
- Rails core models (Milestone 1.1)
- Authentication & authorization (Milestone 1.2)
- Go provider system (Milestone 1.3)
- Next.js dashboard (Milestone 4)
See MILESTONES.md for full roadmap (380 story points / 10 sprints).
We welcome contributions! Please follow these steps:
- Read MILESTONES.md to understand the project roadmap
- Check IMPLEMENTATION_GUIDE.md for development guidelines
- Pick a story from the milestones or create an issue
- Fork, create a branch, and submit a PR
- Create feature branch:
git checkout -b feature/CP-001-description - Make changes following the implementation guide
- Write tests (>80% coverage required)
- Run linters:
bundle exec rubocop(Rails),golangci-lint run(Go) - Submit PR with story reference
# Rails tests
cd control-plane
bundle exec rspec
# Go tests
cd apps/core-go
go test ./... -v
# Integration tests
# (Start all services first)
cd control-plane
bundle exec rspec spec/integration/MIT License - see LICENSE for details.
- π Issues - Bug reports
- π¬ Discussions - Questions & support
- π Documentation - Detailed guides
Built with β€οΈ for developers who need reliable email delivery