Deploy a Replit app to Zenifra
You can keep building the app on Replit and publish it on Zenifra. The code goes to a GitHub repository, and Zenifra builds and publishes from it. Almost everything the Zenifra console asks for is already in the project's .replit file.
1. Push the code to GitHub
On Replit, link your GitHub account in your account's connected services. Then open the Git tool in the project and connect a repository:
- To send changes, commit and click Push in the Git pane.
- To keep the repository in step with Replit without clicks, turn on auto-sync in the Git pane. It syncs both ways.
- If sync stops, reconnect GitHub in connected services. Replit recommends a fine-grained personal access token for a more reliable connection.
Details in Replit's Git documentation.
2. Copy the settings from the .replit file
.replit sits at the repository root. A Node.js app built by Agent usually has something like this:
modules = ["nodejs-20", "web", "postgresql-16"]
[deployment]
deploymentTarget = "autoscale"
build = ["npm", "run", "build"]
run = ["npm", "run", "start"]
[[ports]]
localPort = 5000
externalPort = 80
[env]
PORT = "5000"Each part maps to a field in the Zenifra console:
In .replit | In the Zenifra console | In the example |
|---|---|---|
modules: nodejs-20, python-3.11, etc. | Runtime and Version | Node.js, version 20 |
[deployment] › build | Build Command, with the parts joined by spaces | npm run build |
[deployment] › run | Start Command | npm run start |
[[ports]] › localPort | Port | 5000 |
[env] | Environment Variables | PORT=5000 |
modules: postgresql-16 | A managed PostgreSQL, in step 4 | DATABASE_URL |
If [deployment] has no build, leave Build Command empty. If run is ["sh", "-c", "cd main && python app.py"], use cd main && python app.py as the Start Command, or set Root directory to main and use python app.py.
Zenifra offers Node.js 20, 22, 24, and 26 and Python 3.11, 3.12, 3.13, and 3.14. See Runtimes.
Replit secrets
Values from Replit's Secrets tool do not go to GitHub. Open Secrets on Replit and add each one in Environment Variables on Zenifra. The DATABASE_URL of Replit's database does not show in Secrets; on Zenifra, it comes from the new database in step 4.
3. Create the project on Zenifra
In the console, click Create project, choose HTTP Application and the plan. In Source and port, set Project Source to Git repository, Git provider to GitHub, and pick the repository and branch. If this is your first time, connect your GitHub account and install the Zenifra GitHub App on the repository.
Fill in the fields with the table from step 2. On the Node.js runtime, Zenifra installs dependencies with npm ci, which needs a package-lock.json in the repository. Replit Node.js apps usually already have it; see Node.js dependencies.
The application must listen on 0.0.0.0 and on the project port. Agent apps already read the PORT variable, so add PORT with the same value as the Port.
4. Bring the database
If .replit has a postgresql-* module, the app uses Replit's PostgreSQL through the DATABASE_URL variable.
- Create a managed PostgreSQL in the same organization.
- Copy the database connection URI and add it as
DATABASE_URLin the application project. See Connect to the database. - Copy the data from Replit's production database with
pg_dumpandpg_restore, as in Migrate the database. For the source URI, open Replit's Database tool, pick the production database, and copy the Connection string from the Settings tab.
Check the connection file, usually server/db.ts. Older Replit apps use the @neondatabase/serverless driver, which connects over WebSocket to Neon's proxy and does not work with a regular PostgreSQL. Switch to pg with Drizzle:
import pg from 'pg'
import { drizzle } from 'drizzle-orm/node-postgres'
import * as schema from '@shared/schema'
export const pool = new pg.Pool({ connectionString: process.env.DATABASE_URL })
export const db = drizzle({ client: pool, schema })Install the driver with npm install pg and commit package.json and package-lock.json.
5. Publish and test
The first build starts as soon as you create the project. Follow it in Build logs and, when it finishes, open the project URL. Test a screen that reads from the database and one that writes. From then on, every push to GitHub publishes a new version; see Auto deploy.
Replit features
Some features Replit apps use are Replit services:
- Replit Auth: sign-in uses the visitor's Replit account. Before switching the domain, check in Replit's documentation whether your app's sign-in works outside Replit, or switch to your own sign-in.
- App Storage: files live in Replit's storage. To store files on Zenifra, use the S3-compatible Armazém.
- Scheduled tasks: become Scheduled Jobs.
Custom domain
Once the app works on the Zenifra URL, point your domain to the project. See Custom domains.
Common problems
| Symptom | Likely cause | What to do |
|---|---|---|
| The build fails while installing dependencies | No package-lock.json in the repository, or the file is out of sync | Run npm install locally and commit package-lock.json |
| The application fails the health check | The Port differs from the port the app listens on | Use the .replit localPort as the Port and in PORT |
The app exits with DATABASE_URL must be set | The database variable is missing | Add DATABASE_URL with the managed PostgreSQL URI |
| WebSocket error when connecting to the database | @neondatabase/serverless driver | Switch to pg, as in step 4 |
Last updated on
Deploy a Lovable app to Zenifra
Deploy a Lovable app to Zenifra: sync it with GitHub, use the Bun runtime with NITRO_PRESET and the Supabase variables, and get every change live on its own.
Runtimes
Learn which Node.js, Python, Bun, Go, Java, and PHP runtimes are available for Zenifra Git projects and how dependency install, builds, and startup work.