⚡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 FormSGBest for:
Most teams and deployments
Always up-to-date with latest features and security patches
Complete feature reference for customization
Singapore government deployments
FormSG International - Singapore-specific features removed
git clone https://github.com/opengovsg/formsg-intl.git
cd formsg-intlAfter cloning, read the README of the repo to patch over the replacements folder
Best for:
International teams wanting a cleaner starting point
Deployments that don't need Singapore-specific integrations
Teams preferring to start without Singapore-specific code
The formsg-intl repository removes most Singapore-specific features and branding.
Note that the code implementing these features may still be present, so you are free to remove them, or study them to understand how you might build equivalent features in your local context.
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 --volumesThen 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-volumesThis 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?