Back to Blog
Tutorial9 min read2026-06-28

How to Deploy Formbricks Survey Platform

Formbricks is an open-source, privacy-first survey and experience management platform. This guide deploys the Next.js app with managed PostgreSQL and configures in-app and link surveys.

Ajay Kumar
Ajay Kumar
Founder & DevOps, PandaStack

Formbricks is an open-source survey and experience-management platform — a privacy-friendly alternative to tools like Typeform and Qualtrics. Self-hosting means survey responses stay in your own database, which is a big deal for teams with data-residency or compliance requirements. It's a Next.js app backed by PostgreSQL, so the deployment is refreshingly straightforward compared to multi-process apps.

This guide deploys Formbricks with a managed PostgreSQL database.

What Formbricks needs

ComponentRole
Next.js appWeb UI, survey rendering, API
PostgreSQLSurveys, responses, users
SMTP (optional)Email invites, verification, notifications
Object storage (optional)File-upload survey responses

It's essentially one web app plus a database — the simplest topology in this series.

Step 1: Provision managed PostgreSQL

On [PandaStack](https://dashboard.pandastack.io), create a managed PostgreSQL (14.x or 16.x). When linked to the app, DATABASE_URL is injected automatically, which Formbricks (via Prisma) reads directly.

Step 2: Generate required secrets

Formbricks needs several secrets for auth, encryption, and cron protection:

openssl rand -hex 32   # NEXTAUTH_SECRET
openssl rand -hex 32   # ENCRYPTION_KEY
openssl rand -hex 32   # CRON_SECRET

ENCRYPTION_KEY protects sensitive stored data — keep it stable across deploys.

Step 3: Assemble the environment

WEBAPP_URL=https://surveys.example.com
NEXTAUTH_URL=https://surveys.example.com
NEXTAUTH_SECRET=<generated>
ENCRYPTION_KEY=<generated>
CRON_SECRET=<generated>

DATABASE_URL=${DATABASE_URL}        # injected by linking managed PostgreSQL

# Email (optional but recommended)
MAIL_FROM=surveys@example.com
SMTP_HOST=<smtp-host>
SMTP_PORT=587
SMTP_USER=<user>
SMTP_PASSWORD=<password>

# Optional: disable open signup after creating your account
SIGNUP_DISABLED=0

WEBAPP_URL and NEXTAUTH_URL must match your real HTTPS domain.

Step 4: Run database migrations

Formbricks uses Prisma. Apply migrations before first boot as a pre-deploy step with the Formbricks image:

npx prisma migrate deploy

Run this on every deploy that includes schema changes.

Step 5: Deploy the container

FROM ghcr.io/formbricks/formbricks:latest
# Serves on port 3000

Pin a version in production.

  1. 1Push the repo (or reference the image) to GitHub.
  2. 2Create a container app on PandaStack.
  3. 3Link the managed PostgreSQL so DATABASE_URL is injected.
  4. 4Set the env vars (secrets as secrets).
  5. 5Set npx prisma migrate deploy as the pre-deploy hook.
  6. 6Expose port 3000.
  7. 7Add a custom domain matching your URL vars; SSL is automatic.

Step 6: First-run setup

Visit your domain and create the first account (which becomes the admin/owner). Then optionally set SIGNUP_DISABLED=1 and redeploy so only invited users can join.

Formbricks offers two survey modes:

  • Link surveys — standalone shareable URLs (like a classic Typeform link). No website integration needed.
  • In-app / website surveys — triggered inside your product based on user actions, using the Formbricks JS SDK.

Step 7: Embed in-app surveys (optional)

For product-embedded surveys, add the Formbricks SDK to your app and point it at your self-hosted instance:

import formbricks from "@formbricks/js";

formbricks.setup({
  environmentId: "<your-environment-id>",
  appUrl: "https://surveys.example.com",
});

Then trigger surveys based on actions or attributes you define in the Formbricks dashboard. Because the instance is yours, responses never leave your infrastructure.

Why self-host a survey tool?

ReasonDetail
Data ownershipResponses stay in your PostgreSQL
ComplianceEasier GDPR / data-residency story
CostNo per-response or per-seat pricing
CustomizationOpen source — theme and extend it

Hosted tools like Typeform are genuinely slick and zero-ops; self-hosting is the right call when response data is sensitive or you want to avoid usage-based pricing. Formbricks gives you that without sacrificing a modern survey UX.

Operating tips

  • Back up PostgreSQL — it holds all survey definitions and responses. Scheduled backups cover it.
  • Keep ENCRYPTION_KEY stable — rotating it can render encrypted data unreadable.
  • Configure SMTP if you want email invites and team onboarding.
  • Pin image versions and run prisma migrate deploy on upgrades.

References

  • [Formbricks documentation](https://formbricks.com/docs)
  • [Formbricks self-hosting guide](https://formbricks.com/docs/self-hosting/overview)
  • [Formbricks environment variables](https://formbricks.com/docs/self-hosting/configuration)
  • [Formbricks GitHub](https://github.com/formbricks/formbricks)

---

Formbricks is one of the easiest self-hosted apps in this series — a single Next.js container plus a database — and PandaStack makes it painless with managed PostgreSQL, an injected DATABASE_URL, pre-deploy migrations, and automatic SSL. Run privacy-first surveys you fully own at [dashboard.pandastack.io](https://dashboard.pandastack.io).

Ready to deploy?

Start free on PandaStack.

Start free on PandaStack

More in Tutorial

Browse all Tutorial articles →

See also