Managing Strapi secrets and keys

Strapi depends on a small set of secrets to sign sessions, protect stored values and hash tokens. This page explains how to generate, store and rotate them per environment without locking out editors or breaking API clients.

On this page

Why Strapi secrets and keys need a plan before go-live

A Strapi project that moves from a developer's .env file to shared staging and production environments needs its secrets planned before go-live. APP_KEYS, the JWT secret and the token salts must be unique in each environment, kept out of the repository, and covered by a rotation plan that states what breaks when each one changes. These values sit underneath admin sessions, end-user tokens and stored API tokens, so a development value copied into production means every environment shares the same trust anchors. Platform engineering owns where the values live, security reviews who can read them, and compliance needs evidence that they are controlled. The Community Edition handles these secrets the same way as the open-source core, so this plan applies whether or not you buy a paid plan.

Each secret protects a different part of the platform. APP_KEYS is used by the application for keys it keeps internally, the JWT secret signs the tokens Strapi issues for administrators and for end users through the Users & Permissions plugin, and the token salts are used when Strapi handles stored API tokens. Confirm the exact behavior of each value for your Strapi 5 version against the configuration documentation before you write the rotation runbook. Rotating any of them can sign users out, invalidate issued tokens or affect data the application has encrypted, so list the consequence of each rotation separately. Projects differ in which values they set, so have your team confirm the full list from the configuration files in its own repository.

Before go-live, record for each secret its owner, the environments where it exists, where it is stored, who can read it and the event that triggers rotation. Check that the staging values do not appear in production configuration, and that neither the repository nor CI logs contain copies. If administrators will sign in through corporate identity, note that Strapi SSO covers admin login only, so end-user authentication keeps its own secrets and settings and needs its own entry in the register. Assign a named person to test a rotation in a non-production environment before the first production rotation is needed.

Which Strapi secrets exist and what each one protects

APP_KEYS is the application-level key material Strapi uses for server-side signing, so that values the application issues can be checked for tampering. It is usually provided as a list, and the exact way Strapi uses each entry depends on your installed version, so confirm its behavior in the Strapi configuration docs before you write a rotation procedure.

  • What it signs: Values the server signs so that a later request can show they were not altered, such as session-related cookies.
  • What breaks on change: Replacing the list without a transition period can sign out active sessions and disrupt anything that depends on those signed values. Confirm which sessions are affected in your version.
  • Staged rotation: If your version accepts more than one key, new values can be added first, then old values removed after sessions have turned over. Verify this behavior in a staging environment before relying on it.
  • Who owns it: The platform team generates, stores and rotates it, and the security team approves the rotation window and evidence.
  • Per-environment values: Development, staging and production must each have their own values, never copies of a template or example file.

Check that no environment shares a value with another and that the value is loaded from your secrets manager, not committed to the repository.

Storage options for Strapi secrets and when each fits

This table compares four places to keep APP_KEYS, JWT secrets and token salts: host or container environment variables, a file mounted at runtime, a cloud secrets manager and a self-hosted secrets service. Read each row against your audit, rotation and access review requirements, since the choice changes who can see a value, how changes are recorded and how a rotation reaches running instances.

OptionFits whenTrade-offsWhat to confirm
Host or container environment variablesA small deployment with one team managing the platform and few instancesSimple to wire into the deploy pipeline, but values often leak into deployment logs, shell history and orchestrator dashboardsWho can read the platform's variable settings, and whether values appear in CI logs or manifests
File mounted at runtimeContainers or Kubernetes where secrets should stay out of the image and environment listingsKeeps values out of environment dumps, but the file's ownership, permissions and rotation process must be managed by youFile mode and owner inside the container, and how a rotated file reaches a running Strapi process
Cloud secrets managerStrapi runs in a cloud account that already uses the provider's identity and key servicesAccess policies and access logs are centralized, but version history and rotation depend on the provider's features and your IAM designWhether access events are logged for each secret, how versions are retained, and which identities can read each value
Self-hosted secrets service such as OpenBaoData must stay in infrastructure you control, or several platforms share one secrets serviceFull control over audit logging, policies and rotation, but your team operates the service, its storage, unseal process and backupsAudit device configuration, policy design, unseal and recovery procedure, and who holds administrative tokens
Audit trailYour assessor expects evidence of who read or changed each secretEnvironment variables rarely give a per-read record, while managed or self-hosted services usually doWhich events are recorded, where logs go and how long they are kept
RotationSecrets must change on a schedule or after a suspected exposureSome options need a redeploy or restart for every change, others can serve new versions without rebuilding the imageWhether a rotation requires restarting Strapi and how sessions and tokens react
Access reviewReviewers must confirm who can read production secrets each quarterShared deployment accounts make it hard to attribute reads, so named identities and short-lived access work betterWhether access grants can be exported as a list for review

How to generate and load Strapi secrets per environment

This sequence gives each Strapi environment its own set of secrets, stored in a managed secrets store and injected only at runtime. The result is a deployment where the app starts, admin login works, and no secret value sits in code, images or build output.

  1. Inventory secrets for each environment

    The platform engineer lists every secret the Strapi project reads from environment variables, including APP_KEYS, API_TOKEN_SALT, ADMIN_JWT_SECRET, JWT_SECRET, TRANSFER_TOKEN_SALT and any database or storage credentials. For each one, record the environment that uses it, the service that reads it and the owner who can approve a change. Check that the list matches what the project's config files actually read, so nothing is missed or added by guesswork. The output is a short register per environment that the team can review before any values are generated.

  2. Generate unique values with a secure generator

    An engineer generates each value with a cryptographically secure random generator provided by the operating system or a vetted tool, and never by hand or from a sample file. Development, staging and production each receive their own values, so a leak in one environment does not expose another. Record the generation date and the owner in the register, not the value itself. The check is that no two environments share a value and that every value has the length the Strapi documentation expects for that variable.

  3. Store values in the secrets manager

    The platform team writes each environment's values into the chosen secrets manager, under a path or namespace that names the environment and the Strapi service. Confirm that the manager supports the access controls and audit records your security policy requires before you rely on it. Keep the original values out of ticket systems, chat and shared documents. The check is that the entries exist in the correct environment namespace and that the register matches what the manager holds.

  4. Limit access to the service identity

    The security engineer creates a service identity for the Strapi workload and grants it read access only to its own environment's secrets. Human accounts receive no standing read permission, and any break-glass access is granted by a named approver and logged. Review whether build pipelines need the values at all, since most setups only need them at runtime. The check is a test read from the Strapi identity that succeeds for its own environment and fails for the other environments and for a personal account.

  5. Inject secrets at container or process start

    The deployment team configures the container runtime or process manager to fetch the secrets when the container or process starts and expose them as environment variables in memory. Do not bake values into the image, a Dockerfile argument, a committed .env file or a static configuration file. Plan how the runtime refreshes secrets after a rotation, because a running process usually keeps the values it loaded at start. The check is that a freshly started container shows the expected variables present and that the image contains none of them.

  6. Confirm startup and admin login

    The QA or platform engineer starts the Strapi application in the target environment and confirms that it boots without missing-variable errors. Then an administrator signs in to the admin panel with a test account, and the team checks that issued tokens work against an endpoint that requires them. Run the same checks after any secret change. The check is a clean startup log, a successful admin login and a successful authenticated API call, all recorded in the release notes for that environment.

  7. Scan builds, images and Git history

    The security engineer scans build logs, container image layers and the Git repository, including its history, for the secret values or obvious patterns that match them. Use a secret scanning tool your team already trusts, and confirm its rules cover the Strapi variable names. If a value appears anywhere, treat it as exposed, generate a replacement, update the secrets manager and remove the copy from the affected artifacts. The check is a clean scan of each artifact type with the results stored in the release record.

How secrets flow from the manager into the running Strapi instance

The flow starts in the secrets manager, which holds APP_KEYS, JWT secrets and token salts for each environment. The CI/CD pipeline builds the image with no secret values inside it, then the container runtime requests the secrets at deploy time and passes them to the Strapi process as environment variables. Check that the pipeline never writes these values to build logs or artifacts, and that the database credentials follow the same path and stay separate from the Strapi keys.

Secrets are injected at runtime, never baked into the image.

What rotating each Strapi secret changes for users and integrations

Each Strapi secret protects a different thing, so rotating one affects a different group of people and systems. The cards below cover APP_KEYS, the JWT secret, the API token salt and admin credentials, with the planning and staging tests each one needs before production changes.

APP_KEYS and encrypted data

The APP_KEYS value is used by Strapi to encrypt and sign data it stores, so changing it without a plan can leave existing encrypted values unreadable. Confirm with the Strapi docs for your exact version how each encrypted field and signed value is handled on rotation. Plan a maintenance window, keep the old value available for re-encryption if the version requires it, and back up the database before any change. In staging, restore a production-sized copy, rotate the key, and check that content, stored credentials and uploads still load.

Strapi SSO docs

JWT secret and active sessions

The JWT secret signs the tokens that end users and some administrators hold after login. Rotating it normally invalidates every token signed with the old value, so logged-in users are signed out and any front end or service holding a token must sign in again. Tell editors and application owners before the change, and confirm whether your login flow refreshes tokens cleanly. In staging, test login, token refresh and a logged-out front-end request to confirm the expected failure and recovery.

API token salt and stored tokens

The API token salt is used to hash API tokens stored in the database, so changing it affects every existing Content API and Admin API token. Integrations that use a stored token will fail until the token is recreated and the new value is deployed to the consuming system. Inventory every token and its owner first, schedule reissue with each integration team, and keep Content API and Admin tokens separate. In staging, create a token before rotation and confirm which calls break and which new tokens work.

Admin credentials and admin access

Admin credentials control access to the admin panel, where content, roles and settings are changed. Rotating a password or revoking an administrator affects editors who are mid-session and any automation that logs in with those credentials. If administrators sign in through SSO, changes to the identity provider take effect in Strapi as well, so confirm how local login lock-out is set. Coordinate with editors, record the change, and test in staging that remaining administrators can sign in and that revoked accounts cannot.

How to rotate Strapi secrets without an outage

A secret rotation without an outage is a staged change with a tested way back, and the first precondition is a verified backup. Strapi's v4 to v5 migration docs tell operators to back up the database first and note that downgrading is not supported, and the same caution applies to any change that alters how Strapi reads its secrets. Before touching APP_KEYS, JWT_SECRET, API_TOKEN_SALT, ADMIN_JWT_SECRET or TRANSFER_TOKEN_SALT, restore a current database backup into a staging copy, confirm that the application starts, and confirm that an admin login and an end-user login still work. Record the exact backup time so that the rehearsal and the production change are tied to the same data.

Schedule the change for a window you have announced, and write the sequence down before the window opens. The sequence should cover four things: which secret values are being replaced, which tokens and sessions will stop working, who will reissue the affected Content API and Admin API tokens, and where the previous values are held. Tell editors and integration owners in advance that existing API tokens may need to be regenerated and that active admin sessions may end. Keep the previous values in your secrets manager under a versioned path so they can be restored quickly. Rehearse the rollback in staging as well as the forward change, because a rollback that has never been run is an untested control.

Test the new values in a staged rollout, then verify the result with a short checklist: admin login through the panel, a Content API read with a reissued token, an end-user login if the Users & Permissions plugin is in use, and a check of the application logs for authentication errors. If a check fails, restore the previous values from the secrets manager, restart the instances, and confirm the checks pass again. Confirm with your Strapi partner or the vendor documentation exactly which secrets invalidate existing sessions or tokens in your Strapi version, since that behavior determines how many integrations need notice.

Security controls around Strapi secrets and key access

Strapi's secrets are only as protected as the systems that hold and deliver them. The cards below cover the access, identity, logging and review controls that surround APP_KEYS, JWT secrets and token salts, so that a secret read or change can be traced and limited to the people and services that need it.

Least-privilege access to the secrets manager

Grant read access to Strapi's secret paths only to the workloads that run the application and to the few people who maintain it. Keep write and rotation rights in a separate group. Check whether your secrets manager can scope permissions by path, key or environment, and whether editors, content teams and integration accounts can see any Strapi secret through the UI or an inherited role.

Separate service identities per environment

Give each environment its own identity, such as a staging workload role and a production workload role, so a compromised staging host cannot read production APP_KEYS or JWT secrets. Confirm that the identity used by CI/CD for deployment is distinct from the runtime identity, and that no shared static credential is copied between environments.

Audit logging of secret reads and changes

Enable audit logging in the secrets manager for every read, write, deletion and rotation of Strapi secrets, and forward those events to your central log platform. Note that audit logs inside the Strapi admin panel are an Enterprise plan feature in Strapi's self-hosted pricing, so confirm your plan before relying on Strapi's own trail. Infrastructure-level logs in the secrets manager are configured on your side.

Strapi self-hosted pricing

Keeping secrets out of logs and errors

Confirm that the application does not print environment variables, configuration objects or request bodies that contain APP_KEYS, JWT secrets or token salts. Check container inspection output, CI logs, crash dumps and any error page or debug mode that might expose configuration. Set log filters for these key names and test them with a deliberately failing deployment in a non-production environment.

Access reviews when roles change

Review secret access when someone changes team, leaves the project or moves from a deployment role to a support role. Remove personal tokens, shared passwords and local copies of .env files from laptops and chat exports. Record each review with the owner, the date and the result so the evidence is available for your compliance team.

Questions teams ask before managing Strapi secrets and keys

Can our team manage Strapi secrets and keys without a partner?

Yes, a capable platform or application team can manage Strapi secrets in-house, provided it has a clear owner for each secret and a documented process for generating, storing and rotating them. Strapi reads values such as APP_KEYS, API_TOKEN_SALT, ADMIN_JWT_SECRET and JWT_SECRET from environment configuration, so the work is mostly about where those values live and who can read them. Teams that run several environments, or that must show a reviewer how each secret is handled, often find the documentation and evidence take longer than the setup itself. Confirm the exact variable names against the Strapi version you run before you write any runbook.

What skills and work does a secrets setup need?

The work needs someone who understands Strapi's configuration model, someone who runs your secrets manager, and someone who owns the deployment pipeline. The main tasks are:

  • Generating strong, unique values for each environment and keeping them out of source control
  • Loading them from your secrets manager at container or process start
  • Testing that a rotation keeps existing sessions, API tokens and encrypted data working as intended

Your team also needs a rotation plan that names which values invalidate sessions or tokens and when users must sign in again.

How long does a typical Strapi secrets setup take?

No duration figure is supplied for this work, so treat any number you hear with caution. The time depends on how many environments exist, whether a secrets manager is already in place, how deployments are automated, and whether rotation must be tested against a live copy of the data. A single environment with an existing vault is a small task, while several environments with new tooling and audit evidence is a larger one. Ask for a timeline that lists each environment and each dependency in writing.

What should a quote for managing Strapi secrets include?

A useful quote lists the environments in scope, the secrets manager and deployment tooling assumed, and the Strapi version and hosting model. It should also state what is one-time work, such as the initial generation, loading and testing, and what recurs, such as scheduled rotation and periodic review. Ask whether the quote covers rotation rehearsal, runbook writing and evidence for a compliance review, and what is excluded. DeployOpen does not publish a price list, and most engagements are fixed-scope with scope, deliverables and timelines agreed in writing before work starts.

Does SSO for the Strapi admin panel replace the JWT secret?

No. Strapi SSO applies only to administrator login to the admin panel through an identity provider such as Microsoft Azure Active Directory, and it can include auto-registration, a default role and an optional local login lock-out. End-user authentication is handled separately by the Users and Permissions plugin, and the signing secrets Strapi uses for tokens and sessions still need to be generated, stored and rotated. SSO reduces how often administrators use local passwords, but it does not remove the need to manage ADMIN_JWT_SECRET and related values. Check the Strapi SSO documentation for the settings that apply to your version.

What changes when moving from Strapi 4 to Strapi 5 for secrets?

The secret values themselves are not replaced by the upgrade, but the configuration and the timing of changes need care. Strapi 4 reached end of life on April 30, 2026, and its final release, 4.26.2 of June 9, 2026, will receive no further updates, so teams still on v4 face a security gap as well as a migration task. The upgrade tool and data migration scripts run on first start of Strapi 5, and the docs say to back up the database first because downgrading is not supported. Plan the secrets cutover as part of that backup and rehearsal, and confirm each variable name in the v5 configuration before production.

Do secrets change when moving from Community to Growth or Enterprise?

The secrets process stays the same across self-hosted plans, but some features that depend on it differ by plan. Strapi's self-hosted pricing lists Community as free with unlimited users, Growth at 45 US dollars per month including 3 users, and Enterprise on custom pricing, with SSO as an add-on for Growth and included in Enterprise. Audit logs and review workflows are Enterprise features, and content history and releases start at Growth. Licensing also differs: Community code is under the MIT Expat license, while code under the ee directories falls under a separate Strapi license, so confirm which terms apply before you change plans.

Limits to confirm in your environment before rotating secrets

Rotating APP_KEYS, JWT secrets or token salts touches every running instance, so the change depends on facts about your own Strapi version, runtime and secrets tooling. The cards below list the items to confirm with your team and your vendors before you schedule a rotation window.

Exact variable names and formats

Confirm the secret variable names and accepted value formats for the Strapi version you run, using the configuration reference for that exact release. Check whether APP_KEYS expects a list, how JWT and API token salts are read, and whether any key is required at build time as well as at runtime. Do not rely on names from an older tutorial or from a different major version. Record the answers in your runbook so each rotation uses the same names.

Installation requirements

Supported Node.js and database versions

Check the installation requirements for your release before you change any secret, because a runtime upgrade in the same window makes failures hard to trace. Strapi 5 runs only on Active or Maintenance LTS Node.js versions and supports PostgreSQL 14 or later, MySQL 8.0 or later, MariaDB 10.3 or later and SQLite 3. Confirm that your current runtime and database sit inside those ranges. Keep the rotation separate from any version change.

Runtime secret injection support

Confirm whether your hosting platform can inject secrets at runtime from a secrets manager, without writing them into images, build logs or committed environment files. Container platforms, platform-as-a-service products and VM-based deployments differ in how they refresh environment variables. Ask whether a changed value reaches a running process without a full redeploy, and whether all replicas pick it up together. Record the restart procedure each platform needs.

Secrets manager behavior during outage

Ask your secrets manager team how the service behaves when it is unreachable, and whether your Strapi instances cache secrets at startup. A restart during an outage can fail if the secret cannot be fetched and no fallback exists. Confirm lease or cache durations, access policy scope, audit logging on reads, and who can revoke access. Test a restart with the secrets manager blocked before you depend on it in production.

Support status of your Strapi version

Confirm that your Strapi version still receives updates before you plan a rotation that you may need to repeat later. Strapi v4 reached end of life on April 30, 2026, and its final release, 4.26.2, will receive no further updates. If you run v4, a secret rotation does not fix an unsupported base, so plan the move to Strapi 5 as a separate project. Check the release list for the current Strapi 5 line and your patch level.

Strapi releases

How DeployOpen plans and delivers Strapi secrets and key management

DeployOpen approaches Strapi secrets and keys as part of a self-hosted platform inside your own infrastructure. We scope which keys each environment needs, build the generation and storage path, and document how each secret is rotated and what changes when it is. Engagements are fixed-scope, with deliverables agreed in writing before work starts.

How we scope

  • Inventory every environment and the APP_KEYS, JWT and salt values each one uses today
  • Map where each secret is generated, stored, injected and read by which services
  • Agree in writing which rotation procedures, runbooks and handover items are in scope

How we build

  • Set up per-environment generation so development, staging and production never share key material
  • Load secrets from your chosen secrets manager at startup instead of committed environment files
  • Test that the application starts, sessions and tokens work, and rotation behaves as documented

How we hand over

  • Deliver a written record of each secret, its owner, storage location and rotation impact
  • Provide runbooks for rotating each key, including the user and token effects to communicate
  • Walk your platform and security teams through the setup and the evidence of how it was tested

How we support

  • Offer ongoing support, upgrades and continuous testing as a retainer after handover
  • Review key handling again when Strapi versions, hosting or secrets tooling change
  • Confirm with your team the support boundaries, response expectations and retainer terms before work begins

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.