Documentation Index
Fetch the complete documentation index at: https://mintlify.com/eggarcia98/auth-backend/llms.txt
Use this file to discover all available pages before exploring further.
Prerequisites:
- Docker installed (version 20+)
- A
.envfile populated from.env.example - A Supabase project with the required keys
Overview
The auth-backend ships with a production-readyDockerfile based on node:22-alpine. It uses pnpm via corepack, compiles TypeScript, and starts the compiled server on port 8080.
Dockerfile
Dockerfile
Deploy with Docker
Prepare your environment file
Copy the example environment file and fill in your values:Edit
.env with your Supabase credentials and other required values:.env
Google OAuth credentials are not required here — they are configured in your Supabase project under Authentication → Providers → Google.
Build the Docker image
Run the following command from the project root:The build copies only the files not listed in
.dockerignore, installs dependencies, and compiles TypeScript to dist/.Port mapping
The container exposes port8080. The docker run flag -p 8080:8080 maps the host port (left) to the container port (right). To serve on a different host port, change the left value:
Deploy with Docker Compose
For local development or single-host production deployments, use the includeddocker-compose.yml:
docker-compose.yml
.env file automatically. Start the stack:
Health checks
Thedocker-compose.yml configures a built-in health check that polls GET /health every 30 seconds:
| Setting | Value | Description |
|---|---|---|
interval | 30s | Time between checks |
timeout | 10s | Maximum time to wait for a response |
retries | 3 | Consecutive failures before marking unhealthy |
start_period | 40s | Grace period before health checks begin |
Production considerations
NODE_ENV=production— Set by the Dockerfile. Fastify enables production-mode logging and optimizations automatically.- Secrets management — Prefer a secrets manager (AWS Secrets Manager, GCP Secret Manager, Docker Secrets) over plain
.envfiles in production. - Restart policy — The
docker-compose.ymlsetsrestart: unless-stopped, which restarts the container after crashes or host reboots. - Resource limits — Add
deploy.resources.limitsin your Compose file to cap CPU and memory usage. - Read-only filesystem — Consider adding
read_only: trueto the service definition for additional hardening.
The Dockerfile is optimized for Google Cloud Run, which injects the
PORT environment variable and expects the process to bind to 0.0.0.0.