⚡Quickstart
This quickstart guide helps you get FormSG running locally using Docker Compose for development and testing purposes.
Get FormSG running locally in ~30 minutes using Docker Compose.
Prerequisites
Make sure you have:
Docker and Docker Compose (Docker Compose v2 recommended)
Node.js v22.12 (specified in
.nvmrc
)Node Version Manager (nvm) - highly recommended for version management
Choose Your Repository
You have two repository options:
FormSG - Complete feature set (recommended)
git clone https://github.com/opengovsg/FormSG.git
cd FormSG
Best for:
Most teams and deployments
Always up-to-date with latest features and security patches
Complete feature reference for customization
Singapore government deployments
Setup Steps
Troubleshooting
Need to restart?
If you need to start over from scratch:
# Stop and remove all containers, networks, and orphaned containers
docker compose down --remove-orphans
# Optionally remove volumes (clears database data)
docker compose down --remove-orphans --volumes
Then restart from Step 1.
Accessing FormSG
Once everything is running, access your local FormSG instance:
Frontend: http://localhost:5173 - Main FormSG application
Backend API: http://localhost:5001 - API server
Mail Server: http://localhost:1080 - Development email interface
✅ Success Check: If you can access http://localhost:5173 and see the FormSG interface, your local setup is working correctly!
Accessing email locally
FormSG uses MailDev for email testing in development. Access the MailDev interface at http://localhost:1080 to:
View all emails sent by FormSG (OTP codes, form submissions, etc.)
Test email workflows without sending real emails
Debug email templates and formatting
Login using MockPass locally
FormSG includes MockPass for simulating government authentication:
On the login page, click "Login with Singpass"
Select any test profile from the dropdown (e.g.,
S9812379B [MyInfo]
)Complete the mock authentication flow
You'll be logged in as a test user
Adding dependencies
Run npm install
as per usual.
For backend dependencies, rebuild the containers:
docker compose up --build --renew-anon-volumes
This rebuilds the backend Docker image with fresh node_modules.
As frontend project is currently not using Docker, no other steps are required.
Environment Variable Priority
Docker-compose looks at various places for environment variables in this order of priority:
Compose file
Shell environment variables
Environment file (
.env
)Dockerfile
The .env
file you created from .env.example
will provide the default configuration for local development. For production deployments, you'll need to customize these values according to your infrastructure and security requirements.
Last updated
Was this helpful?