CI/CD pipeline for Strapi deployments

A Strapi CI/CD pipeline builds, tests and packages the project once, then promotes the same artifact through environments with controlled database migrations. This page explains how to design it on GitHub Actions or GitLab CI.

On this page

Why a Strapi CI/CD pipeline needs its own design

A Strapi pipeline builds the application once, runs tests against that build, applies database migrations deliberately, and promotes the same tested image from one environment to the next. Teams that deploy by copying files or running commands by hand lose that sequence, and with it the ability to say which code, which schema and which admin build reached production. The risk is concentrated in two places: schema changes, which alter content types and the database together, and admin builds, which are produced at install time and can differ between machines. A single, versioned artifact is the control that removes most of that guesswork.

A pipeline becomes necessary once more than one person changes the project, or once more than one environment exists. Several developers editing content types in parallel, a staging environment that must match production, or a change control process that requires evidence of what was approved and deployed are all signals. Strapi's Community Edition is licensed under the MIT Expat license, so the project's source, build scripts and release tooling belong to your team with no license gate on how you automate them. That freedom is also the responsibility: nothing in the framework decides your promotion path, approval points or rollback rules for you.

Before designing the pipeline, confirm three things with your own team. Which Strapi version and Node.js runtime you will pin, since Strapi 5 minor releases ship frequently and the supported runtimes are a constraint on your build images. Which database engine the pipeline will migrate, since Strapi 5 supports PostgreSQL, MySQL, MariaDB and SQLite but not NoSQL databases. And who may approve a migration that touches production data. Your answers determine whether the pipeline is a short build-and-deploy workflow or a gated process with manual approvals and audit trails.

How the build, test and promotion stages connect

The pipeline starts at a commit and moves through install, admin build and tests before an image is built and pushed to a registry, which is the only artifact handed to later stages. A migration job touches the database once per target environment, first in staging and then in production after an approval gate. Check that secrets are injected at the job level rather than baked into the image, and that each environment runs the same image digest that passed staging.

Artifacts move through the registry, while secrets and database access stay at deploy time.

GitHub Actions or GitLab CI for Strapi: choosing the runner model

Both platforms offer hosted runners managed by the vendor and self-hosted runners that you register and operate yourself. The choice decides who patches the build machine, where source code and secrets pass through, and whether a Strapi build can reach databases or package mirrors inside your network. A Strapi pipeline installs dependencies, builds the admin panel, runs tests and may build a container image, so the runner needs Node.js on an Active or Maintenance LTS version and enough memory and disk for the native modules and the admin bundle.

  • Hosted runners: Fast to start, with no build hosts for your team to patch, but they reach your private resources only through public endpoints or an approved gateway.
  • Self-hosted runners: Run inside your network with access to internal databases, registries and test environments, and your team owns their patching and scaling.
  • Ephemeral runners: A fresh environment per job reduces leftover state between builds, which matters when secrets or caches could carry over.
  • Runner labels and groups: Both platforms let you route jobs by label or tag, so production deploy jobs can run only on a restricted pool.
  • Limits and quotas: Concurrency, job duration and minutes allowances differ by plan and change over time.

Confirm current runner types, supported operating systems, limits and minute allowances with each vendor before you size the pool.

Building the install, admin and test stages

This sequence turns a commit into a verified build: dependencies are installed from a lockfile on a pinned Node.js version, the admin panel is compiled, and linting and tests run against a database version Strapi supports. Each stage stops the pipeline when its check fails, so later stages only run on code that has passed the earlier ones.

  1. Pin the Node.js version and check the lockfile

    The pipeline declares one Node.js version in a single place, such as the workflow file or a version file that both local developers and CI read. Strapi 5 runs only on Active or Maintenance LTS Node.js versions, so the first job checks that the pinned version is on that list and fails if a runner image or developer machine drifts to an unsupported line. The same job confirms that a package lockfile is committed and fails if it is missing, because an install without a lockfile resolves different dependency versions on each run. Done means the job prints the resolved Node.js and npm versions and the lockfile hash, and the stage passes only when both checks succeed. Confirm the current LTS status against the Node.js release schedule at the time you build the pipeline.

  2. Restore cached dependencies before install

    Before installing packages, the job restores a dependency cache keyed on the Node.js version and a hash of the lockfile. A cache hit skips the download step, while any change to the lockfile creates a new key so stale packages are never reused. Native modules that Strapi depends on, such as sharp, can compile or fetch platform binaries during install, so the cache key should also include the runner operating system and architecture. Done means the log shows either a cache hit or a fresh cache save, and the install step is the only step that writes to the cache. Treat the cache as an accelerator only: a clean install must still succeed without it.

  3. Install dependencies with a clean, frozen install

    The install step runs a frozen, lockfile-only install with the package manager your project uses, so the job fails if package.json and the lockfile disagree rather than silently rewriting the lockfile. Engineers should not run installs with flags that update dependencies inside CI. The step also runs any audit or license report your organization requires, and the output is kept as a build artifact for the security reviewer. Done means the install exits cleanly, and the job fails on the first error instead of continuing with a partial node_modules directory. If the install fails only on the runner, compare the runner image with the pinned Node.js version before changing project code.

  4. Build the admin panel

    The admin panel build compiles the Strapi admin interface and any custom admin code, such as branding or custom fields, into static assets. This stage runs in the same Node.js environment as the server so the output matches what production will serve. Admin URL and server URL settings are set at build time for the environment being tested, so the job passes these as build variables rather than relying on defaults. Done means the build completes without errors, the admin output directory exists and is non-empty, and the job stores it as an artifact for later image or deployment stages. A build that succeeds only with a warning about a missing environment variable should be treated as a failure until the variable is supplied.

  5. Run linting and type checks

    The lint and type-check stage runs the project's configured linters and, for TypeScript projects, the compiler in check mode without emitting files. These checks catch invalid content type definitions, broken imports in custom controllers or policies, and mismatched plugin code before any tests start. Failures here stop the pipeline, and the job reports file and line references so developers can fix them without rerunning the whole workflow. Done means the stage exits with zero errors and the report is attached to the run. Keep the rule set in version control so the same checks run on every branch.

  6. Start a test database that matches production

    The test stage starts a database service that matches the engine and major version used in production. Strapi 5 supports PostgreSQL 14 or later, MySQL 8.0 or later, MariaDB 10.3 or later and SQLite 3, and it does not support MongoDB or other NoSQL databases. Testing against SQLite while production runs PostgreSQL can hide SQL dialect differences, so the test database should use the same engine as production wherever possible. The job waits for the database health check to pass before running migrations. Done means the service is reachable, the Strapi test configuration points at it, and the version reported by the database matches the version your environment records.

  7. Run the test suite against a migrated database

    The test job applies Strapi's database schema setup, then runs the unit and integration tests for custom controllers, services, policies and API routes. Integration tests run against the real test database so they exercise the same query behavior that production will use. The job publishes a test report and a coverage summary that the team agreed on, and it fails the stage when any test fails or when a coverage gate you set is not met. Done means the report is attached to the run and the database is torn down or reset so the next run starts clean. Ask your team to confirm which test types they need before writing the pipeline, since the suite shapes the runtime more than any other choice.

  8. Save artifacts and pass the build forward

    The final step in this sequence uploads the built admin assets, the lockfile hash, the Node.js version and the test reports as a versioned build record tied to the commit. Later stages, such as image builds and environment promotion, consume this record rather than rebuilding from source, so the code that was tested is the code that is shipped. Done means every stage has a green status, the artifact is stored with the commit identifier, and the release job can refer to it by that identifier. If a later stage needs to rebuild, the reason should be recorded in the pipeline log.

Running database migrations and promoting releases safely

Schema changes in Strapi reach beyond the database. A change to a content type, component or dynamic zone alters the tables behind it and the API the front end depends on, so the pipeline should run migrations as a separate, logged job that finishes before the new version receives traffic. Keep that job out of the application container's startup command, so a failed migration stops the release instead of leaving a half-upgraded instance serving requests. Record the job's start and end times, the image tag it ran and the database it changed, so an incident responder can match a schema state to a release.

Build the image once and promote that same image from staging to production. Environment-specific values such as database host, credentials, APP_KEYS, ADMIN_JWT_SECRET, transfer tokens and the public url should arrive at runtime from the platform's secret store, not from build arguments, so that the artifact tested in staging is the one that reaches production. Confirm with your platform team which variables Strapi reads at build time and which at start, because the admin panel's URL and some plugin settings can be baked in during the build. Rebuilding for production is a common source of drift that staging tests will not catch.

Take a database backup immediately before any upgrade, including minor Strapi 5 releases that carry data migrations. The Strapi v4 to v5 migration documentation says to back up the database first because downgrading is not supported, so the rollback path is restoring that backup, not reverting the image. Your pipeline should block promotion until the backup job reports success and its restore has been tested in staging at least once. Agree the restore time objective, and who approves a production run, before the first release, because those answers determine whether a failed migration is a short outage or a data-recovery event.

Where Strapi pipelines usually fail

Most broken Strapi releases trace back to a handful of build and release decisions made early in the pipeline. The cards below cover the failures we see most often, each with the symptom to look for and the control that prevents it. Check them against your own pipeline before the first production release.

Admin URL baked in at build time

The Strapi admin panel is built during the pipeline, so URL and environment settings used at build time are fixed into the bundle. An image built with staging settings and promoted to production will load assets and API calls from the wrong host. Build the admin panel once per target environment or confirm which settings are read at runtime, and add a smoke test that loads the admin login page in each environment after promotion.

Strapi CLI docs

Native module builds failing on runners

Strapi depends on native modules such as sharp, which links against libvips and compiled binaries for a specific OS and CPU architecture. A build that passes on a developer laptop can fail on a CI runner image with a different libc, missing system libraries or an older architecture. Pin the runner image, install build dependencies explicitly in the job, and run the install step on the same image that builds the production container.

Migrations running on every replica

When each container runs database migrations at startup, several replicas can start at once and attempt the same schema changes. The result is lock contention, half-applied changes or a failed rollout that is hard to reverse. Run migrations as a single, separate job before the new version receives traffic, and confirm that the application process does not run schema changes on boot in production.

Secrets leaking into logs

Pipelines often echo environment files, print the full config during debugging or pass database URLs as command arguments, which then appear in job logs and artifact caches. Keys such as APP_KEYS, API_TOKEN_SALT, JWT_SECRET and database credentials should live in the CI secret store and be injected only at deploy time. Mask them in logs, avoid debug output of configuration, and rotate any value that has appeared in a log.

Rebuilding separately for each environment

If staging and production each trigger their own build from the same commit, the artifacts can differ through dependency drift, changed base images or different environment variables. A bug found in staging then may not match what reaches production. Build one immutable image from a tagged commit, store it in a registry, and promote that same digest between environments, changing only runtime configuration.

Missing rollback steps

Strapi schema changes and content migrations can make the previous image incompatible with the current database, so redeploying the old tag is not always safe. Teams that have no tested rollback plan discover this during an incident. Take a database backup before each migration, record the image digest that was running, and rehearse the restore procedure in a non-production environment. Downgrades are not supported by Strapi, so restoring from backup is the recovery path to plan for.

Pipeline design options and when each fits

This table compares the main pipeline design choices for Strapi, from repository layout to where images are built and how migrations run. Read each row as a decision: the option, what it suits, and the upkeep it adds over time. The main takeaway is that the simplest option that keeps builds reproducible and migrations auditable usually wins for a single Strapi project.

DecisionOptionFits whenMaintenance cost
Repository layoutOne pipeline per repositoryOne Strapi project with its own release cadence and teamLow: one workflow file to review and update when Node.js or Strapi changes
Repository layoutShared pipeline templatesSeveral Strapi projects follow the same build, test and image rulesModerate: template changes ripple into every consuming project and need versioning
Image build locationBuild the image in CI, deploy the same artifactYou want the tested image promoted unchanged between staging and productionModerate: registry access, tagging rules and image scanning must be maintained
Image build locationBuild on the deploy hostA small single-server setup where a registry is not yet in placeLow to start, higher later: builds differ by host and drift is hard to trace
Promotion to stagingAutomatic on merge to the main branchContent and schema changes are small and frequent, and staging tests run quicklyLow: fewer approvals, but failed promotions need clear rollback steps
Promotion to productionManual approval gateEditorial changes and schema migrations need a named approver before releaseModerate: approvers, environment protection rules and approval records must be kept current
Database migrationsSeparate migration job before rolloutSchema changes need logging, a single run and a clear failure stateModerate: the job needs its own image, credentials and timeout handling
Database migrationsMigration on Strapi startupA single instance and low-risk schema changes that the team tests oftenLow to set up, risky with several replicas: concurrent startups can race on schema changes

Securing secrets, registries and approvals in the pipeline

Where should Strapi secrets live in a CI/CD pipeline?

Keep secrets in the CI platform's encrypted secret store or in a dedicated vault, and inject them only into the jobs that need them. Strapi secrets such as APP_KEYS, API_TOKEN_SALT, ADMIN_JWT_SECRET, JWT_SECRET and database credentials should never be written into the repository, the Dockerfile or the image layers. Scope each secret to a named environment so a staging job cannot read production values. Rotate secrets on a schedule and after any staff change, and confirm with your platform team which rotation process applies to your vault. Check the exact variable names against your Strapi version and the security configuration docs before you wire them in.

What deploy credentials should a Strapi pipeline use?

Give each pipeline job the narrowest credential that lets it do its single task. A build job needs read access to source and write access to the artifact registry, while a deploy job needs permission to update one service in one environment. Avoid long-lived personal access tokens and shared cloud keys. Prefer short-lived tokens issued through OIDC federation from GitHub Actions or GitLab CI where your cloud provider supports it. Separate the credentials used for database migrations from those used to roll out application pods, because migrations change data and deserve tighter control. Ask your cloud and platform teams to confirm which federation options they already support.

How do you keep unsigned or vulnerable Strapi images out of production?

Add an image scanning step after the build and before promotion, and sign images so the deploy job can verify who built them. Scanning checks the base image, the Node.js runtime and the installed packages, including native modules such as sharp and its libvips dependency. Fail the pipeline on findings above a threshold your security team agrees, and record exceptions with an owner and an expiry date. Signing can use tools your registry supports. Deploy by image digest rather than by a mutable tag such as latest, so the running image is exactly the one that passed the checks. Confirm the scanner and signing tool your registry and platform support before you commit to one.

Which branch protections matter for a Strapi delivery pipeline?

Protect the main branch and release branches so that changes reach production only through reviewed merges that passed the pipeline. Require at least one reviewer who did not write the change, require status checks for install, tests, image build and schema validation, and block force pushes. Treat changes under src/api, src/extensions, config and any schema JSON files as high-risk paths that need a named code owner. Schema and permission changes can expose content or alter production data, so a reviewer should see them even when the diff looks small. Confirm how your Git host expresses these rules, since the feature names differ between GitHub and GitLab.

How should environment approvals work for Strapi releases?

Require a named approver for each protected environment, and place the approval gate before the production deploy and before any database migration. Approvers should check the release notes, the migration output from staging, and the list of content type or permission changes. Keep a record of who approved what and when, because that record is part of your change evidence. Do not let the job that approves also be the only job that deploys. Keep the number of approvers small enough that releases do not stall, and document an emergency path with its own logging. Ask your platform team which approval features your CI platform offers on your plan.

Can the pipeline overwrite Strapi admin URL and SSO settings?

The pipeline should not overwrite admin URL, SSO or admin security settings on each release. Values such as the admin panel URL, server URL, CORS origins, cookie settings and SSO provider configuration are set per environment and change rarely, so a template that resets them can lock administrators out or open the panel to unrelated domains. Review changes to these files as security-relevant, and keep them out of automated rewrites. Check the Strapi security configuration guidance for CORS, admin access and secrets, and the Strapi SSO documentation for the rule that SSO applies to admin login only and the optional local login lock-out. Confirm your intended settings with the Strapi documentation for your installed version before you lock them into the pipeline.

What should a pipeline check before promoting a Strapi build?

Before promotion, the pipeline should confirm that the build used locked dependencies, that tests passed, that the image was scanned and signed, and that the migration ran cleanly against a copy of production data in staging. Add a check that fails when secret values appear in logs or build output. Verify that the admin URL and SSO configuration in the target environment match the reviewed values. Record the image digest, the commit, and the approver in the release record so a rollback can target a known state. The exact list depends on your hosting model, so agree it with your security and operations leads before the first production release.

Limits to confirm in your environment

A Strapi pipeline depends on limits set outside the repository: the Node.js versions Strapi supports, the runner capacity your plan provides, and the registry and hosting rules that govern each image and migration job. Confirm these before you design stages, because they decide what the pipeline can run and how fast it can ship.

Node.js LTS support for your version

Strapi 5 runs only on Active or Maintenance LTS Node.js versions, so the Node major in your build image and in the runtime image must match a version Strapi currently supports. Check the installation requirements for the exact Strapi version you pin, then confirm the Node.js release schedule before you choose a base image tag. A pipeline that builds on an unsupported Node version fails in ways that look like application bugs. Pin the Node major in one place and reuse it in every job.

Installation requirements

Runner minutes and concurrency

Hosted runners bill or cap build time by plan, and a Strapi pipeline that installs dependencies, builds the admin panel, runs tests and builds images can consume that time quickly. Ask your platform vendor for the included minutes, the concurrent job limit, and the per-minute rate for overage on your plan. Then measure a real build on your repository before you set branch rules, because parallel builds on several feature branches can queue behind each other.

Self-hosted runner availability

Some organizations cannot send source code, build secrets or database credentials to shared runners. A self-hosted runner inside your network can reach private registries, internal databases and staging hosts, but you then own its patching, scaling and isolation. Confirm that your security policy allows self-hosted runners, that the network path to the Strapi database and registry is open, and who maintains the runner host. Treat runners that build untrusted pull requests as high risk and keep them off the production network.

Container registry retention rules

Every merge can publish an image, and registries often keep untagged or old images according to rules you may not have set. Confirm the default retention period, whether untagged manifests expire, and whether your policy requires specific images to be kept for rollback or audit. Make sure the tag scheme (commit SHA, release version or both) matches how you roll back a failed release, since a rollback needs the previous image to still exist.

Migration job support on your host

Strapi schema changes and data migrations should run as a one-time job before the new application version receives traffic. Not every hosting target supports that pattern cleanly. Confirm that your platform can run a short-lived container or command with the same image, secrets and database access as the application, can block a rollout until the job exits successfully, and can prevent two migrations from running at once. Without these guarantees, a failed migration can leave the schema and the running code out of step.

Questions teams ask before building a Strapi pipeline

What drives the cost of a Strapi CI/CD pipeline?

The main driver is how many environments, deployment targets and approval gates the pipeline has to cover, because each one adds configuration, testing and review work. Cost also rises with the number of pipeline stages the team wants to standardize, such as install, admin build, automated tests, container image builds, database migrations and promotion between environments. Ask any provider to price the work from a written scope that lists each environment, each target platform (a VM, containers or Kubernetes) and each approval step. One-time costs cover design and the first working pipeline. Recurring costs cover maintenance as Strapi releases change and as your hosting platform evolves.

How long does a first Strapi pipeline take to design and test?

The duration depends on the scope agreed before work starts, not on a fixed template. A single environment deploying to one target is a much smaller job than a pipeline that promotes releases from development through staging to production with database migrations and rollback steps. Testing time depends on how much of your project has automated tests today, since a pipeline is only as useful as the checks it runs. Ask for a written plan with stages, environments and acceptance criteria, and ask how the provider will test migrations against a copy of production-like data before the first real release.

What does our team need to provide before a pipeline can be built?

Most of the work depends on access and decisions that only your organization can provide. The usual list includes:

  • Read and write access to the Strapi repository and its branch protection settings
  • Access to CI/CD runners or agents, with an agreed place to run them
  • Cloud or data center accounts for each environment, with deployment permissions scoped to that environment
  • A named set of approvers for production releases
  • Secrets management for database credentials, API tokens and signing keys
  • Staging database access and a sanitized data copy for migration tests

Confirm each item early, because waiting on accounts or approvals is a common cause of delay.

Can an internal team build a Strapi pipeline without outside help?

Yes, if the team already runs CI/CD for Node.js applications and has someone who understands Strapi's build steps and database migrations. Strapi needs a Node.js version that is on an Active or Maintenance LTS line, and it supports PostgreSQL 14 or later, MySQL 8.0 or later, MariaDB 10.3 or later and SQLite 3, so the pipeline has to target the database your environments actually use. The harder parts are usually the admin panel build, which must know the public admin URL, and safe schema changes that run against a live database. A partner is most useful when the team lacks this experience or needs the pipeline built quickly and handed over with documentation.

How do Strapi minor releases change pipeline maintenance?

Strapi 5 minor releases ship frequently. Recent examples include v5.56.0 on September 30, 2026, v5.57.0 on October 7, 2026 and v5.58.0 on October 14, 2026, according to the Strapi GitHub releases. Each release can change dependencies or build behavior, so the pipeline needs a repeatable way to pin versions, run tests and promote an update through staging before production. Plan for a recurring maintenance task, either handled by your team or covered by a retainer, that reviews release notes, updates the lock file and reruns the full pipeline. Ask any provider how they will handle minor upgrades and whether that work is included in the scope.

Does a pipeline need to change when we upgrade from Strapi 4?

Yes. Strapi v4 reached end of life on April 30, 2026, and the final release was 4.26.2 on June 9, 2026, so v4 projects no longer receive updates. The official upgrade tool includes codemods and data migration scripts that run on the first start of Strapi 5, and the docs say to back up the database first because downgrading is not supported. Your pipeline should therefore include a backup step before any migration, a clear rollback plan and a staging run that proves the upgrade works. Read the Strapi v4 to v5 migration guide before designing those stages.

What does a Strapi pipeline cost to run after it goes live?

Running costs come from the infrastructure the pipeline deploys to, the CI/CD runners that build and test the project, and the people who maintain it. Self-hosted Strapi Community Edition is free to use under the MIT Expat license, but a pipeline that uses Enterprise Edition features or Growth plan features such as SSO follows separate license terms. The Growth plan is listed at 45 US dollars per month including 3 users, and the Strapi self-hosted pricing page lists the plan terms. Ask for a quote that separates one-time build work from recurring maintenance and states who pays for runners, hosting and licenses.

How DeployOpen scopes and delivers a Strapi pipeline

DeployOpen plans, implements, hardens, documents and supports self-hosted open-source platforms inside the client's own infrastructure. For a CI/CD pipeline for Strapi deployments, that means agreeing the stages, environments and release rules in writing first, then building the pipeline in your repositories and your runners or cloud accounts.

How we scope

  • Written scope lists the repositories, CI platform, runners and target environments the pipeline will cover.
  • Scope defines which Strapi version, database and hosting target the build and release stages must support.
  • Deliverables, acceptance tests and timelines are agreed in writing before any pipeline work starts.

How we build

  • Pipeline stages cover install, admin build, tests, image builds and migration runs in a defined order.
  • Secrets, database credentials and registry access are wired through your existing secret store, not committed to repositories.
  • Promotion between staging and production uses the same built artifact, with approval gates set by your release owners.

How we hand over

  • Handover includes pipeline definitions, runbooks for failed migrations and a rollback procedure your team can follow.
  • Documentation records environment variables, required runner capabilities and the owners of each release gate.
  • Your engineers run a supervised release through the pipeline before the engagement closes.

How we support

  • Ongoing support is available as a retainer for pipeline updates, Strapi minor releases and runner maintenance.
  • Retainers can cover review of pipeline changes when Strapi upgrade or Node.js support policies change.
  • Ask for the support scope, response expectations and change process to be written into the retainer before signing.

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.