Zitadel environments for development, staging and production

A practical plan for separating Zitadel development, staging and production for a SaaS product, covering projects, instances, Terraform sync and test data, with the decisions to make before the first build.

On this page

Why Zitadel environments for development, staging and production need a deliberate split

A SaaS team that changes identity settings in development and then copies them to production by hand will eventually ship a broken login. The answer is to separate environments deliberately from the start: keep development and production as separate projects inside your own Zitadel organization, and decide early whether a staging instance is worth its operating cost. Zitadel's SaaS solution scenario recommends separate projects for development and production inside the provider's own organization, so applications, roles and grants can be tested in one project before they reach the other. Read the Zitadel SaaS solution scenario before you design the split, because it sets the baseline the rest of this page builds on.

A separate staging instance is worth its cost when a change could affect how tenants reach the product, such as a new login domain, a change to instance-wide login policy, a new identity provider template, or a Zitadel upgrade you have not yet rehearsed. Projects and grants separate your application configuration, but they do not separate instance-level settings, domains, signing behavior or the users and organizations that live in an instance. Confirm with Zitadel which settings are instance-wide in the version you run, since the boundary determines what a project split can and cannot protect.

Be clear about what the split isolates. Projects separate roles, applications and grants, so a developer can change a role model without touching production clients. They do not separate the database, the masterkey, the TLS certificates or the administrators who can act across the instance. Ask who holds administrator access in each environment and whether test users can reach production data. Treating the project split as a full safety boundary is the most common mistake, and it leaves production exposed to changes that were meant only for testing.

Environment layouts and when each fits

This table compares three ways to separate development, staging and production for a SaaS product on self-hosted Zitadel: projects per environment in one provider organization, a separate staging instance beside production, and a fully separate development instance. Read each column for isolation, what the environments share, and the operating load it adds. The main takeaway is that the more isolation a layout gives, the more instances you run, configure and keep in sync.

LayoutIsolation and what is sharedOperational overheadWhen it fits a SaaS product
Projects per environment in one provider organizationDev and production projects share one instance, one organization and one set of users, so isolation is at the project and role level onlyLowest: one deployment to patch, back up and monitor, with projects and grants to keep alignedSmall teams with low-risk test data and no requirement to prove that staging matches production's identity settings
Separate staging instance beside productionStaging has its own instance, domain, issuer, users and signing keys, so customer-like tests cannot touch production identity dataModerate: a second deployment to run, upgrade and back up, plus settings synced across instancesProducts that test customer SSO, branding or login flows and need a production-like identity system before release
Fully separate development instanceDevelopment, staging and production each run as their own instance with separate data, keys and configurationHighest: three deployments to upgrade, secure and monitor, and Terraform or equivalent tooling is needed to avoid driftRegulated products or teams with several developers who need isolated sandboxes and auditable configuration promotion
Data for testsShared layouts make it easy to copy production users into test projects, which raises personal data exposureMasking or synthetic data generation adds work in every layoutConfirm with your compliance owner whether production user data may leave production in any form

How to set up dev, staging and production Zitadel in order

This sequence gives a SaaS team separate, verified Zitadel environments where each one differs only in the settings it is meant to differ in. Each step ends with a check you can run before moving on.

  1. Decide the environment boundary first

    Before any install, decide what separates development, staging and production. Options include separate self-hosted instances for each environment, or one self-hosted deployment with separate projects inside your provider organization. Zitadel's SaaS scenario uses separate projects for development and production inside the provider's own organization, which is a useful starting point, but staging needs a boundary strong enough to mirror production data safely. Ask your architects and security team to sign off on the boundary in writing. Done when the decision record names each environment, its data sources and who may administer it.

  2. Deploy self-hosted instances on supported PostgreSQL

    Deploy each self-hosted Zitadel instance that your boundary requires, using the deployment method your platform team has chosen. Zitadel documents Linux and macOS binaries, Docker Compose and Kubernetes, and recommends Kubernetes with the official Helm chart for high availability. Each instance uses PostgreSQL, and the database version must fall within the range Zitadel supports, which is versions 14 through 18. Confirm the exact version against the current database documentation before provisioning. Done when every instance starts, its health endpoint responds, and its database version is recorded in your configuration inventory.

  3. Create the provider organization and per-environment projects

    In each environment, create or confirm the provider organization that owns your product's applications, then create one project per environment inside it, following the SaaS scenario's pattern of separate development and production projects. Staging can hold its own project or be a separate instance, depending on the boundary chosen in step one. Name projects so that any engineer can tell which environment a client belongs to. Done when a project list export for each environment shows only that environment's projects and no shared production objects.

  4. Define roles and grants once, then copy them

    Define the application roles in a single source of truth, ideally a version-controlled Terraform configuration, and apply the same role model to every environment's project. Create grants only where a customer organization needs access, and keep role names identical across environments so that code and tokens behave the same way everywhere. Any environment-specific difference should appear as a named variable, not as a manual edit in the Console. Done when a plan from your Terraform configuration shows no unexpected role or grant differences between environments.

  5. Configure applications with environment-specific redirect URIs

    Register each application in each environment, setting its own redirect URIs, post-logout URIs and client type. Development clients may point at local hosts, while staging and production must use their own domains only. Keep client identifiers and secrets in each environment's secret store rather than in shared files. Done when a check lists redirect URIs per environment and confirms that the only differences are the ones you intended, with no production domain registered in development or staging.

  6. Sync settings with Terraform and review drift

    Keep organizations, projects, roles, grants and application settings in Terraform so that changes flow through review and are applied to each environment in a fixed order, usually development, then staging, then production. Run plans on a schedule to detect manual changes made in the Console. Done when a plan against each environment returns no drift, and every change to production has a reviewed commit that matches the applied state.

  7. Mirror data for tests with controls

    If staging tests need realistic accounts, copy data only under a documented process that removes or replaces personal data, and never copy production client secrets or signing keys. Keep user records separate from production by using test organizations or test domains. Confirm with your data protection owner what may be copied and how it is deleted after testing. Done when a test organization exists in staging, a copy job log shows what was transferred, and a search of staging for production credentials returns nothing.

  8. Verify role assignments and login across environments

    Run a final end-to-end check in each environment: sign in with a test user from each role, confirm tokens carry the expected roles and organization context, and confirm that a user from one environment cannot sign in to another. Record the results and attach them to the change record. Done when the test results show the expected roles in every environment and documented differences only where you chose them, and the sign-off is recorded before any customer traffic uses the new setup.

Keeping settings in sync with Terraform

Terraform is the mechanism that keeps Zitadel's project, application, role and identity provider settings identical across development, staging and production, so that a configuration tested in one environment is the same configuration promoted to the next. Without it, each environment drifts through console edits, and a staging test proves little about production. Treat the Terraform repository as the source of truth for the settings that define your product's identity surface: the projects in your provider organization, the applications and their redirect URIs, the role keys, the grants your customers receive, and the identity provider definitions. Keep the Terraform code in version control with the same review process as application code, and make manual changes in the Console the exception that gets reconciled back into code.

Environment-specific values must be parameterized, not hard-coded. Domains, client IDs, client secrets, redirect URIs, issuer URLs and any identity provider credentials differ per environment, so they belong in variables or per-environment workspace inputs, with secrets injected from your secret store at apply time rather than committed to the repository. Keep role keys and project names identical across environments, because a role that exists under one name in staging and another in production breaks authorization checks that look only at the role key. Run terraform plan against each environment in the same pipeline stage order you use for application releases, and review every plan for unexpected deletions or client ID changes before applying.

Before you commit to this approach, confirm which Zitadel resources the Terraform provider in your target version can manage. Coverage of applications, roles, grants and identity providers varies between provider releases, and some settings may still need to be set through the API or Console. Check the provider documentation for the exact Zitadel version you run, and record any gap as a documented manual step with an owner. The Terraform configurations Zitadel publishes are licensed under Apache 2.0, so you can adapt them into your own repository, but you should still pin provider and Zitadel versions and test upgrades in staging first. Ask your implementation partner to show the plan output for a change that touches a client ID before you rely on the pipeline for production.

Mirroring data for tests without copying production users

Staging needs realistic tenant structures to catch bugs, but production identities carry personal data that should not spread into lower environments. The cards below cover the choices that let your test data behave like production without exposing the people in it, and the access review that must happen before any copy is made.

Synthetic users and organizations

Create test users, customer organizations and their domains from a script rather than exporting them. Give each synthetic organization the same settings your customers use, such as a verified domain, an organization admin and a sample identity provider link, so flows like invitations and login routing get exercised. Keep names and email domains obviously fictional, and reserve domains you control for test mail. Store the generator in version control so every refresh produces the same shape of data.

Seeded role assignments

Define the project roles and grants your application expects, then seed the same role assignments for test users in each organization. Test both a customer admin who can delegate access and a plain member who cannot. Seeding roles from the same Terraform or API definitions used in production makes permission drift visible early. Ask your team which grants depend on organization IDs, since those values will differ between environments and need mapping.

Anonymized or minimized production copies

Where a production-shaped dataset is genuinely needed, copy only the fields a test requires and strip or hash direct identifiers such as names, emails and phone numbers. Treat pseudonymized data as still personal data unless the re-identification risk has been assessed. Check whether Zitadel event and audit records are included in the copy, because they often hold user identifiers that a simple field scrub misses.

Access review before any copy

Before production user data reaches a lower environment, record who approves the copy, the legal basis or internal policy that allows it, the systems it will touch, and who can read it. Limit staging access to the same people who need it for testing, and remove production administrators who do not. Confirm the approval with your privacy and security owners in writing, and confirm the retention period for the copy with them.

Refreshing staging on a schedule

Decide how often staging is rebuilt from scratch, and whether it is refreshed from synthetic data, from a minimized copy, or both. A full rebuild from configuration keeps settings in sync, while a data-only refresh is faster but can carry old test state forward. Record each refresh in a change log, and confirm with your team how long a stale copy may remain in use before it is replaced.

Separating instance-level test data

Keep test data inside the staging instance so it cannot leak into production through shared database credentials, shared signing keys or shared mail templates. Confirm with Zitadel's self-hosting documentation how each instance stores its database and keys, and verify that a restore from staging backups cannot target the production database. Label staging clearly in the login page and emails so testers and users can tell the environments apart.

Self-hosting overview

Promoting a change from staging to production safely

A Zitadel change should reach production only after it has passed through the same path every time: written in Terraform, applied to staging, exercised against a mirrored data set, reviewed, and then applied to production with a rollback plan already written down. The rollback plan is part of the change request, not an afterthought, because identity settings affect every login and token issued while the change is live. Start by making the Terraform change in a branch of the repository that holds your Zitadel configuration, and let the plan output show exactly which projects, roles, applications and organization settings will be created, modified or destroyed before anyone approves it.

Identity changes need checks that ordinary application changes do not. Confirm the token issuer that staging and production will emit, because a change to the instance domain or custom domain alters the iss claim, and every relying party that validates tokens against a fixed issuer will reject tokens from the new value. Check the client scopes and the role keys that your APIs read from token claims, since renaming a role in a project changes what downstream services see. Also confirm redirect URIs, post-logout URIs and the signing configuration of each application. Run a sign-in and token exchange for each application type in staging, decode the tokens, and compare them with the production baseline. Ask your Zitadel administrators to confirm which of these values Terraform manages and which are set through the Console, because drift in unmanaged settings can make the staging result misleading.

Before production apply, rehearse the rollback. For configuration that Terraform created, the rollback is usually a revert commit and a second apply, but deletions of users, organizations or grants are not reversible from configuration alone, so the plan should name a database backup point and the restore procedure for your PostgreSQL deployment. Record the previous state file version, keep the old role names available in your services during a transition window, and agree who can halt the rollout. Ask your platform team to confirm how backups and restores are tested for the database behind Zitadel, since a backup that has never been restored is not evidence of recovery. Finally, the Zitadel SaaS solution scenario describes the separate development and production projects that these checks rely on, so confirm your own project layout against it before the first promotion.

Questions teams ask before separating Zitadel environments

How much effort does a multi-environment Zitadel setup take?

Effort depends mostly on how many environments you run, how many projects, roles and applications each one holds, and how much of the configuration you want written as code from the start. A single self-hosted environment is the baseline. Each added environment repeats the infrastructure work (domains, TLS, PostgreSQL, backups, upgrades) and adds a configuration sync problem. The largest variable is how cleanly your role model and application clients are defined before the first environment is built. Ask any partner to split their estimate into one-time build work and recurring operations, and to show how each environment is kept in sync.

Do we need a separate staging instance, or is a staging project enough?

A separate staging project inside your own organization is enough for many SaaS teams, because Zitadel's SaaS scenario uses separate projects for development and production inside the provider's own organization. A separate instance becomes worth the cost when staging must match production's domain, issuer, branding or instance-level settings, or when you need to test changes to those settings without risk. Instances are fully isolated virtual tenants, so they bring their own administration and operational overhead. Decide this by listing which settings must differ between environments and which must match.

What must our team provide before the work starts?

Plan to provide the following before build work begins:

  • Cloud accounts or data center capacity where each environment will run
  • DNS domains and TLS certificates for each environment's login and API endpoints
  • A PostgreSQL service in a supported version, with backup and access arrangements
  • A Git repository and CI pipeline where Terraform configuration will live
  • Named owners who can approve role, client and identity provider changes

The Terraform skills needed depend on whether your team will maintain the code after handover. Confirm with the vendor which Zitadel features are covered by the Terraform provider you plan to use.

Can our in-house platform team build this without outside help?

Yes, if your team already runs self-hosted identity or Kubernetes services and has Terraform experience. The work is well defined: deploy Zitadel in each environment, model projects and grants, write configuration as code, and set up a data refresh process for tests. The risks are usually schedule and attention rather than technical difficulty, because the same people also run production. A partner is most useful for a fixed-scope build with written deliverables, or for a review of an existing setup. Compare the cost of your team's time against a written scope before deciding.

How long does the work take, and what makes the duration vary?

Duration varies with the number of environments, how much of the existing configuration is already documented, how many customer-facing settings must be reproduced, and how quickly approvals and access are granted. Teams with an unclear role model usually spend more time on design than on deployment. Ask for a timeline that lists each environment, the Terraform modules and the test data process as separate milestones, and ask which dependencies sit with your team, such as DNS changes or cloud account access. No duration is stated here because no supplied figure applies to this topic.

What ongoing work recurs once the environments are live?

Recurring work includes applying Zitadel upgrades to each environment in order, usually staging first, reviewing Terraform drift, rotating credentials and certificates, refreshing mirrored test data, and checking that role and client changes are promoted through the same path. Self-hosted environments also need PostgreSQL maintenance and backup verification. Confirm with the vendor the supported PostgreSQL versions for the Zitadel release you target, since these change over time. Ask any partner whether this work is included in a retainer or billed separately.

How do we copy production data into test environments without exposing customer data?

Mirror only what tests need: project and role definitions, application clients, and a sanitized set of test users, not live customer identities. Generate test users in staging rather than copying production records, and keep any mirror job under the same access controls as production. Document which data classes are excluded and who approves a refresh. This matters most when customers' own identity providers or branding are involved, because those settings can reveal customer details. Confirm your data handling obligations with your privacy and compliance teams before designing the refresh.

How the environments and promotion path connect

The path starts in the Terraform repository, which holds Zitadel settings as code and applies the same definitions to each environment. Development and staging each get their own projects inside your provider organization, while staging also receives mirrored test data that is copied and masked before tests run. Production only receives changes that have passed a promotion gate, such as review and a successful staging run. Check that the gate is enforced in the pipeline, not by convention, and that no production secrets or personal data flow back into lower environments.

Terraform keeps settings in sync, with a gated path from staging to production.

How DeployOpen scopes and delivers Zitadel environment work

DeployOpen plans Zitadel environments for development, staging and production as a written scope, then builds the separation, sync and test data approach in infrastructure you control. Each stage ends with documented settings and a clear owner, so your team can run and change the environments after handover.

How we scope

  • Map which environments your SaaS product needs and where each one runs, inside your own cloud accounts or data centers.
  • Decide the project layout per environment in your own organization, and which settings may differ between development, staging and production.
  • Agree in writing how test data is copied, masked or generated, and who approves any production data used outside production.

How we build

  • Set up the development and production projects and the staging instance, following the separation your scope defines.
  • Express instance and project settings as Terraform so environments are created and changed from version-controlled code.
  • Run promotion tests that confirm a configuration change moves from development to staging to production without manual edits.

How we hand over

  • Deliver the Terraform modules, variable files and a runbook describing how each environment is created, changed and retired.
  • Document the promotion path, approval steps and drift checks your engineers run before a release reaches production.
  • Walk your platform and identity teams through the environments and record open decisions for their ownership.

How we support

  • Engagements are fixed-scope, with scope, deliverables and timelines agreed in writing before work starts.
  • Ongoing support, Zitadel upgrades and continuous testing are available as a retainer if your team wants them kept current.
  • Confirm with DeployOpen during scoping which Zitadel versions and PostgreSQL versions your environments will run.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.