Overview
Sendook is open source and can be self-hosted for full control over your email infrastructure. The stack includes:- API - Node.js backend with Bun runtime
- App - Nuxt 3 dashboard application
- Landing - Nuxt 3 marketing website
- Database - MongoDB for data persistence
- Cache - Redis for session management (optional)
Quick Start with Docker
The fastest way to get Sendook running is with Docker.Prerequisites
- Docker and Docker Compose installed
- MongoDB instance (local or hosted)
- AWS account with SES configured
- Stripe account (for billing)
Build and Run API
1. Build the Docker imageDockerfile Explanation
The API uses Bun’s official Docker image:The Dockerfile exposes port 3000 internally, but the API listens on port 8006 by default. Map the ports accordingly.
Environment Variables
Required Variables
MongoDB
Email Domain
AWS Credentials
- SES (Simple Email Service) - Send and receive emails
- SES domain verification
- SES configuration sets
Stripe Configuration
- STRIPE_SECRET_KEY - Your Stripe API secret key
- STRIPE_WEBHOOK_SECRET - Webhook signing secret for verifying events
- STRIPE_PRICE_ID - Usage-based price ID from your Stripe product
- STRIPE_PRODUCT_ID - Product ID from Stripe
- STRIPE_METER_EVENT - Name of the billing meter event
Optional Variables
Redis
Rupt Integration
Port Configuration
Environment
Running Locally
API Server
Sendook uses Bun instead of Node.js for better performance. Development Modehttp://localhost:8006 with hot reload enabled.
Production Mode
Bun automatically loads
.env files, so you don’t need dotenv.Dashboard App
The dashboard is built with Nuxt 3. Development ModeLanding Site
The marketing site is also built with Nuxt 3.AWS SES Setup
Sendook uses AWS SES for email sending and receiving.Prerequisites
- AWS Account - Sign up at aws.amazon.com
- SES Access - Enable SES in your AWS region
- Move out of sandbox - Request production access to send to any email
Configuration Steps
1. Verify Domain In AWS SES Console:- Go to “Verified identities”
- Click “Create identity”
- Select “Domain”
- Enter your domain
- Follow DNS verification steps
- Create an S3 bucket (optional, for email storage)
- Set up SES receipt rules
- Configure SNS topics or Lambda functions for processing
MongoDB Setup
Local MongoDB
Using DockerHosted MongoDB
Use a managed MongoDB service:- MongoDB Atlas (recommended)
- AWS DocumentDB
- DigitalOcean Managed MongoDB
MONGO_URI.
Database Migrations
Sendook runs migrations automatically on startup:api/migrations/.
Production Deployment
Using Docker Compose
Create adocker-compose.yml:
Deployment Platforms
Railway
Deploy with one click using Railway’s Docker support. Connect your GitHub repo and set environment variables.
Fly.io
Use Fly.io for global edge deployment. Create a
fly.toml and deploy with fly deploy.AWS ECS
Run on AWS ECS with Fargate for serverless containers. Use ECR for Docker images.
DigitalOcean
Deploy to DigitalOcean App Platform or Droplets with Docker.
Repository Structure
Understanding the monorepo layout:Security Considerations
Production Checklist
- Use strong, unique passwords for MongoDB
- Enable MongoDB authentication
- Use Stripe live mode keys (not test keys)
- Configure HTTPS/TLS for all endpoints
- Set up firewall rules (only allow necessary ports)
- Enable AWS SES production access (out of sandbox)
- Rotate AWS and Stripe keys regularly
- Set up monitoring and logging
- Configure backup strategy for MongoDB
- Use Redis for session management
- Set up rate limiting
- Enable CORS only for trusted origins
Monitoring and Logs
Health Check Endpoint
The API provides a health check:Logging
Sendook logs to stdout/stderr. Capture logs with: Docker- CloudWatch Logs (AWS)
- Datadog
- Loggly
- Papertrail
Troubleshooting
Connection to MongoDB failed
Connection to MongoDB failed
- Verify MONGO_URI is correct
- Check MongoDB is running:
docker psorsystemctl status mongod - Ensure network connectivity between API and MongoDB
- Check MongoDB authentication credentials
Emails not sending
Emails not sending
- Verify AWS credentials are correct
- Check SES is enabled in your AWS region
- Ensure you’re out of SES sandbox mode
- Verify domain is verified in SES
- Check CloudWatch logs for SES errors
Stripe errors
Stripe errors
- Verify all Stripe environment variables are set
- Check you’re using the correct key type (test vs live)
- Ensure webhook secret matches your Stripe webhook
- Verify the price ID exists in your Stripe account
Port already in use
Port already in use
- Change PORT environment variable to an available port
- Check for other processes:
lsof -i :8006 - Stop conflicting services
Docker build fails
Docker build fails
- Ensure Docker has enough memory allocated
- Check package.json and bun.lock are present
- Verify Docker has internet access for dependencies
- Try
docker system pruneto clear cache
Performance Optimization
Use Redis
Configure Redis for session caching and improved performance.
Database Indexing
MongoDB indexes are created by migrations. Monitor slow queries.
Connection Pooling
Mongoose handles connection pooling automatically.
Load Balancing
Deploy multiple API instances behind a load balancer for high availability.
Next Steps
Authentication
Set up API keys and access tokens
Dashboard
Learn how to use the dashboard
API Reference
Explore the API endpoints
Billing Setup
Configure Stripe billing