A demonstration deployment of FormSG (Singapore's government digital form builder) running on the Fly.io platform.
🔗 Live Demo: https://form.demos.sg
This repository contains customizations and configuration to deploy FormSG as a public demo. It uses an "overlay" approach - the base FormSG codebase is merged with demo-specific replacements during deployment.
The overlay essentially "de-governments" FormSG - transforming a Singapore government platform into a generic form builder demo while preserving core functionality.
While this repository demonstrates deploying FormSG on Fly.io, the overlay deployment pattern is generalizable to other platforms and applications:
Core Architecture:
- Base + Overlay - Clone upstream → Apply customizations → Deploy
- Platform-agnostic workflow -
just setup→ edit → test → sync → commit - CI/CD to detect drift - Conditional builds based on file changes, and a CI job to detect drift with the main codebase
Potential Applications:
- formsg-on-railway - Replace
fly.tomlwith Railway config, same Docker approach - formsg-on-render - Adapt to Render's web service deployment model
- formsg-on-aws - ECS/Fargate deployment with ALB and RDS
- etc.
What Makes This Reusable:
- Dev workflow is infrastructure-agnostic
replacements/directory works for any codebase structure- CI process applies universally
- Could be templated, maybe...?
# Set up demo (one-time)
just setup
# Start the demo
just start
# View logs
just logs
# Stop when done
just stop
# Clean up everything
just cleanRun just --list to see all available commands.
flowchart TD
%% Main development cycle
A["🚀 just setup"] --> B["📝 Edit in .formsg-base/"]
B --> C["🧪 just start"]
C --> D{Changes good?}
D -->|No| B
D -->|Yes| E["🔄 just sync"]
E --> F["💾 git commit"]
F --> G{Continue?}
G -->|More changes| B
G -->|Fresh start| A
style A fill:#e1f5fe
style E fill:#f3e5f5
style F fill:#e8f5e8
The overlay transforms FormSG in several key ways:
Visual Changes:
- Adds "SPECIMEN - For Demo Only" watermark across all pages
- Replaces Singapore government masthead with "A product demo from Open Government Products"
- Changes login placeholders from
.gov.sgto generic email providers - Swaps Singapore lion icon with simple house icon
Feature Simplifications:
- Disables custom logo upload functionality
- Removes image and address field types from form builder
- Strips out multi-language/internationalization features
- Removes enterprise features (status tracking, advanced permissions)
- Limits SingPass authentication to test ID only
Infrastructure Adaptations:
- Adds Cloudflare R2 storage support (instead of AWS S3 only)
- Updates Content Security Policy for demo environment
- Forces development mode settings for demo use
- Public demo with automated data resets every 3 hours
- MockPass integration for testing SingPass/CorpPass authentication
- Cloudflare R2 for S3-compatible storage
- Singapore region deployment on Fly.io
- Automated CI/CD with GitHub Actions
├── replacements/ # Demo-specific file overrides
│ ├── frontend/ # React/TypeScript frontend customizations
│ ├── src/app/ # Node.js/Express backend customizations
│ └── shared/ # Shared constants and utilities
├── scripts/ # Development automation scripts
├── bin/ # Database reset scripts
├── fly.toml # Fly.io deployment configuration
├── Dockerfile.demos # Multi-stage Docker build
└── justfile # Command runner configuration
- CI triggers on pushes to main or weekly schedule (Monday 1PM SGT)
- Smart filtering only deploys when relevant files change
- Merges base FormSG with demo replacements
- Builds Docker image and pushes to Fly.io registry
- Deploys to cloud (in this case, Fly.io)
This is a demonstration project. For the main FormSG project, see opengovsg/FormSG.
- Edit files in
replacements/directory - Test locally with
just setup && just start - Commit and push - CI will automatically deploy
MIT License - see LICENSE file.