This guide will help you set up Formbricks for local development on your machine.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/formbricks/formbricks/llms.txt
Use this file to discover all available pages before exploring further.
Prerequisites
Before you begin, ensure you have the following installed:Node.js (>=20.0.0)
Node.js (>=20.0.0)
pnpm (10.28.2)
pnpm (10.28.2)
Formbricks uses pnpm as the package manager.
Docker & Docker Compose
Docker & Docker Compose
Required to run PostgreSQL, MailHog, Valkey (Redis), and MinIO.Download from docker.comVerify installation:
Installation Steps
Install Dependencies
Install all workspace dependencies:This will install dependencies for all packages and apps in the monorepo.
Start Docker Services
Start PostgreSQL, MailHog, Valkey, and MinIO:This command starts:
- PostgreSQL (port 5432) - Main database with pgvector extension
- MailHog (ports 1025, 8025) - Email testing
- Valkey (port 6379) - Redis-compatible cache
- MinIO (ports 9000, 9001) - S3-compatible object storage
Setup Database
Apply Prisma migrations and generate the Prisma client:This will:
- Run all Prisma migrations
- Generate the Prisma client
- Create the SAML database (if configured)
Start Development Server
Start all development servers:Or use the quick start command:This starts the database and all dev servers in parallel.The web application will be available at:
- Web App: http://localhost:3000
Development Scripts
Here are the most commonly used development commands:Database Commands
Build Commands
Development Commands
Code Quality Commands
Cleanup Commands
Working with Survey Packages
The surveys package is pre-compiled to UMD and ESM formats, and the bundle is copied toapps/web/public/js/. Changes to survey packages require a rebuild:
Environment Variables
Create a.env file in the root directory. Here are the essential variables for local development:
Troubleshooting
Port already in use
Port already in use
If ports 3000, 5432, 6379, or other default ports are in use:
- Stop conflicting services
- Or modify the ports in
docker-compose.dev.yml - Update your
.envfile accordingly
Prisma client errors
Prisma client errors
If you see Prisma client errors:This regenerates the Prisma client.
Survey changes not reflecting
Survey changes not reflecting
After changing survey packages:
- Rebuild the surveys package with
--force - Hard refresh your browser
- Restart the Next.js dev server
Turbo cache issues
Turbo cache issues
If builds seem stale:
Docker services not starting
Docker services not starting
Check Docker is running:View logs:Restart services:
Next Steps
Architecture
Understand the system architecture
Code Style
Learn our coding standards
Testing
Write tests for your code
Contributing
Read contribution guidelines