TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/reds-skywalker/Lightpress/llms.txt
Use this file to discover all available pages before exploring further.
microservices/ directory is the core of the Lightpress backend. Each subdirectory is a self-contained Node.js service with its own package.json, Dockerfile, and environment configuration. Services communicate with each other through well-defined interfaces — either synchronous HTTP calls or asynchronous events — and are deployed independently so that a change to one service never requires a full-stack redeploy.
Service organization
Each service lives in its own directory undermicroservices/. This gives you clear ownership boundaries: one team or one pull request per service.
The names above are illustrative. Your actual service names are determined by the subdirectories you add under
microservices/. Follow the same structure for each: a src/ directory, a Dockerfile, and a .env.example.Core services
Lightpress is designed around the bounded contexts common to SaaS products. Each service owns a single domain.Auth service
Issues and validates JWTs. Handles sign-up, login, password reset, and token refresh. Every other service validates tokens against this service’s public key.
Users service
Manages user profiles, roles, and account settings. The auth service creates a user record here on sign-up; the client reads from here to populate the UI.
Billing service
Integrates with a payment provider (e.g., Stripe) to manage subscriptions, invoices, and plan changes. Emits events when a subscription status changes.
Notifications service
Sends email and in-app notifications. Subscribes to events from other services (e.g., a billing event triggers a receipt email) rather than being called directly.
Service communication patterns
Services use two communication patterns depending on whether the caller needs an immediate response.- Synchronous (HTTP/REST)
- Asynchronous (events)
Use direct HTTP calls when the caller must wait for a result — for example, the client asking the users service to return a profile.In production, inter-service calls go through an internal ALB or AWS App Mesh service discovery — not through the public-facing ALB. This keeps internal traffic off the public internet.
Keep synchronous calls for reads and immediate writes. Use events for side effects. This prevents cascading failures — if the notifications service is down, billing still works.
Independent deployability
Each service has its own Dockerfile and is built separately in the CI pipeline. You can update, scale, and roll back any single service without touching the others.Local vs production differences
Local development (Docker Compose)
Local development (Docker Compose)
In local development, Docker Compose orchestrates all services. Services find each other by their Compose service name (e.g.,
http://auth-service:3000).- No AWS credentials required for core functionality
- Use LocalStack to emulate SQS, S3, and other AWS services locally
- Hot-reload (e.g.,
nodemon) is enabled inside each service container - A single
docker compose upstarts every service and the client
Production (AWS ECS)
Production (AWS ECS)
In production, each service runs as an ECS task behind an Application Load Balancer. AWS manages container placement, health checks, and rolling deployments.
- Services discover each other through AWS Cloud Map or the internal ALB
- Secrets (database credentials, API keys) are stored in AWS Secrets Manager and injected as environment variables at runtime
- Auto-scaling rules in CloudFormation scale each service’s task count independently based on CPU/memory metrics
- CloudWatch collects logs from every container via the
awslogslog driver
Staging environment
Staging environment
Staging mirrors production but runs in a separate AWS account or VPC. The same CloudFormation templates deploy to staging with different parameter values (smaller instance sizes, separate database). Use staging to validate a service before promoting to production.
Adding a new service
Add a Dockerfile
Follow the same multi-stage Dockerfile pattern used by the existing services: a
builder stage that compiles TypeScript, and a lean runner stage that copies only the compiled output.Register in Docker Compose
Add a service block in
docker-compose.yml so the new service starts alongside the others during local development.