Contributing

Get started

We are so happy that you are interested in contributing to Formbricks 🤗 There are many ways to contribute to Formbricks like writing issues, fixing bugs, building new features or updating the docs.

  • Issues: Spotted a bug? Has deployment gone wrong? Do you have user feedback? Raise an issue for the fastest response.
  • Feature requests: Raise an issue for these and tag it as an Enhancement. We love every idea. Please open a feature request clearly describing the problem you want to solve.
  • How we Code at Formbricks: View this Notion document and understand the coding practises we follow so that you can adhere to them for uniformity.
  • Creating a PR: Please fork the repository, make your changes and create a new pull request if you want to make an update.
  • E2E Tests: Understand how we write E2E tests and make sure to consider writing a test whenever you ship a feature.
  • New Question Types:Follow this guide to keep everything in mind when you want to add a new question type.
  • How to create a service: Read this document to understand how we use services. This is particulalry important when you need to write a new one.

Talk to us first

We highly recommend connecting with us on Discord server before you ship a contribution. This will increase the likelihood of your PR being merged. And it will decrease the likelihood of you wasting your time :)

Contributor License Agreement (CLA)

To be able to keep working on Formbricks over the coming years, we need to collect a CLA from all relevant contributors.

Once you open a PR, you will get a message from the CLA bot to fill out the form. Please note that we can only get your contribution merged when we have a CLA signed by you.

Setup Dev Environment

We currently officially support the below methods to set up your development environment for Formbricks:

Both Gitpod and GitHub Codespaces have a generous free tier to explore and develop. For junior developers we suggest using either of these, because you can dive into coding within minutes, not hours.

Local Machine Setup

To get the project running locally on your machine you need to have the following development tools installed:

  • Node.JS (we recommend v20)
  • pnpm
  • Docker (to run PostgreSQL / MailHog)
  1. Clone the project & move into the directory:

Git clone Formbricks monorepo

git clone https://github.com/formbricks/formbricks && cd formbricks
  1. Install Node.JS packages via pnpm. Don't have pnpm? Get it here

Install dependencies via pnpm

pnpm install
  1. Create a .env file based on .env.example. It's already preset to work with the local development setup but you can also change values if needed.

Define environment variables

cp .env.example .env
  1. Generate & set some secret values mandatory for the ENCRYPTION_KEY, NEXTAUTH_SECRET and CRON_SECRET in the .env file. You can use the following command to generate the random string of required length:
  • For Linux

For Linux

sed -i '/^ENCRYPTION_KEY=/c\ENCRYPTION_KEY='$(openssl rand -hex 32) .env
sed -i '/^NEXTAUTH_SECRET=/c\NEXTAUTH_SECRET='$(openssl rand -hex 32) .env
sed -i '/^CRON_SECRET=/c\CRON_SECRET='$(openssl rand -hex 32) .env
  • For Mac

For Mac

sed -i '' '/^ENCRYPTION_KEY=/s|.*|ENCRYPTION_KEY='$(openssl rand -hex 32)'|' .env
sed -i '' '/^NEXTAUTH_SECRET=/s|.*|NEXTAUTH_SECRET='$(openssl rand -hex 32)'|' .env
sed -i '' '/^CRON_SECRET=/s|.*|CRON_SECRET='$(openssl rand -hex 32)'|' .env
  1. Make sure you have Docker & docker-compose installed and running on your machine. Then run the following command to start the Formbricks dev setup:

Start Formbricks Dev Setup

pnpm go

This starts the Formbricks main app (plus all its dependencies) as well as the following services using Docker:

  • A postgres container for hosting your database,
  • A mailhog container that acts as a mock SMTP server and shows received mails in a web UI (forwarded to your host's localhost:8025)
  • Demo App at http://localhost:3002
  • Landing Page at http://localhost:3001

You can now access the Formbricks app on http://localhost:3000. You will be automatically redirected to the login. To use your local installation of formbricks, create a new account.

For viewing the emails sent by the system, you can access mailhog at http://localhost:8025

Build

To build all apps and packages and check for build errors, run the following command:

Build Formbricks stack

pnpm build

Was this page helpful?