Integrate Jenkins with Lovable by connecting your Lovable project to GitHub, then creating a Jenkinsfile in the repository root that runs npm install, npm run build, and a deployment step on every push. Jenkins picks up changes via a GitHub webhook, builds your Lovable-generated Vite and React project, and deploys to Vercel or Netlify automatically. No Lovable-specific configuration is needed — it is standard Node.js 22 build tooling.
Why teams use Jenkins for Lovable project CI/CD
Jenkins is the most widely deployed CI/CD server in enterprise environments. Its self-hosted model means your build infrastructure runs on your own servers with no usage limits, no per-seat pricing, and complete control over the build environment. For teams building Lovable apps in organizations that already have Jenkins infrastructure, adding a Lovable project pipeline is straightforward — the project is standard Vite and React TypeScript, which any Node.js build environment can handle.
The primary advantage of Jenkins over cloud CI/CD services like CircleCI for Lovable workflows is unlimited customization. You can install arbitrary Node.js versions, run tests in a specific Docker container, deploy to on-premise servers, send build notifications to internal systems, and chain together complex multi-stage pipelines without per-minute billing. The tradeoff is operational overhead — you manage the Jenkins server, plugins, and agent configuration yourself.
For non-technical founders who just want automated deployments for their Lovable app and do not have existing Jenkins infrastructure, CircleCI or GitHub Actions are simpler starting points. For teams already running Jenkins who want to add Lovable to their build system, this guide walks through the complete setup.
Integration method
Jenkins integrates with Lovable through the GitHub repository that Lovable syncs to. When Lovable pushes code changes to GitHub, a webhook notifies your Jenkins server which triggers a pipeline run. The Jenkinsfile in the repository root defines the build steps — install dependencies, lint, test, build with Vite, and deploy to your chosen hosting provider. Jenkins never interacts with Lovable's AI builder directly; it only processes the code output that Lovable pushes to GitHub.
Prerequisites
- A Jenkins server that is publicly accessible (required for GitHub webhooks to reach it) — at minimum a Jenkins LTS installation with the Pipeline plugin and NodeJS Plugin installed
- A Lovable project connected to GitHub (Settings → Connectors → GitHub in Lovable)
- Node.js 22 configured in Jenkins under Manage Jenkins → Tools → NodeJS Installations
- A Vercel or Netlify account with a CLI token for deployment (stored as a Jenkins credential)
- Administrator access to your Jenkins instance to create jobs and configure webhooks
Step-by-step guide
Connect Lovable to GitHub and verify the repository
Connect Lovable to GitHub and verify the repository
Before Jenkins can build your project, the source code must be in a GitHub repository. In your Lovable project, click the GitHub icon in the top-right corner. If you have not connected GitHub to your Lovable workspace yet, authorize the Lovable GitHub App via OAuth — click 'Connect GitHub', complete the authorization on GitHub's website, then return to Lovable. Click the GitHub icon again and select 'Connect project'. Choose your organization and give the repository a name. After connecting, Lovable creates the repository and establishes two-way sync — every code change Lovable makes pushes to this repository automatically. Verify the connection worked by visiting github.com/{your-org}/{your-repo} and confirming the source code is there. The repository should contain src/, supabase/, public/, package.json, vite.config.ts, and other standard project files. Note the full repository URL and the default branch name (main) — you will need these when configuring the Jenkins pipeline. Critical: never rename or delete this repository after connecting, as it breaks the Lovable sync permanently.
Pro tip: If your Jenkins server runs on a private network, ensure it can reach github.com for repository cloning. If GitHub webhooks need to reach Jenkins, the Jenkins server must have a public IP or use a service like ngrok for local testing.
Expected result: Your Lovable project code is available on GitHub at a known repository URL, and the main branch contains the full project source.
Create a Jenkinsfile in your repository
Create a Jenkinsfile in your repository
A Jenkinsfile defines the pipeline stages Jenkins will run for every build. Add a Jenkinsfile to the root of your Lovable GitHub repository. You can do this directly on GitHub (navigate to the repository, click 'Add file' → 'Create new file', name it Jenkinsfile) or by cloning the repository locally, creating the file, and pushing it. The Jenkinsfile should define stages for checkout, dependency installation, linting, building, and deployment. Lovable projects use Node.js 22 and Vite — the build command is npm run build and the output goes to the dist/ directory. If you are deploying to Vercel, install the Vercel CLI in your pipeline and use a Vercel token stored as a Jenkins credential. If you are deploying to Netlify, use the netlify-cli package. The example below shows a complete pipeline for a Vercel deployment. The tools directive uses the NodeJS 22 installation name you configured in Jenkins Tools — make sure the name in the Jenkinsfile matches exactly what you named the NodeJS installation in Jenkins.
1// Jenkinsfile (place in repository root)2pipeline {3 agent any45 tools {6 nodejs 'NodeJS-22'7 }89 environment {10 VERCEL_TOKEN = credentials('vercel-token')11 VERCEL_ORG_ID = credentials('vercel-org-id')12 VERCEL_PROJECT_ID = credentials('vercel-project-id')13 }1415 stages {16 stage('Checkout') {17 steps {18 checkout scm19 }20 }2122 stage('Install Dependencies') {23 steps {24 sh 'node --version'25 sh 'npm --version'26 sh 'npm ci'27 }28 }2930 stage('Lint') {31 steps {32 sh 'npm run lint || true'33 }34 }3536 stage('Build') {37 steps {38 sh 'npm run build'39 }40 post {41 success {42 echo 'Build succeeded — dist/ directory created'43 }44 failure {45 echo 'Build failed — check TypeScript errors above'46 }47 }48 }4950 stage('Deploy to Vercel') {51 when {52 branch 'main'53 }54 steps {55 sh 'npm install -g vercel'56 sh 'vercel deploy --prod --token $VERCEL_TOKEN'57 }58 }59 }6061 post {62 always {63 cleanWs()64 }65 failure {66 echo 'Pipeline failed — check stage logs for details'67 }68 }69}Pro tip: Use npm ci instead of npm install in Jenkins pipelines — it installs exact versions from package-lock.json and is faster and more reproducible than npm install.
Expected result: The Jenkinsfile is committed to the repository root. Jenkins can now read it during pipeline execution.
Create the Jenkins pipeline job
Create the Jenkins pipeline job
In your Jenkins dashboard, click 'New Item' in the left sidebar. Enter a name for the job (e.g., 'lovable-app-pipeline'), select 'Multibranch Pipeline', and click OK. In the job configuration page, scroll to 'Branch Sources' and click 'Add source' → 'GitHub'. Enter your GitHub repository URL and select or add GitHub credentials (a personal access token with repo scope works). Jenkins scans the repository for branches containing a Jenkinsfile and creates a pipeline for each one. Under 'Scan Multibranch Pipeline Triggers', check 'Periodically if not otherwise run' and set the interval to 1 minute as a fallback — the primary trigger will be the webhook you set up in the next step. Save the configuration and click 'Scan Multibranch Pipeline Now'. Jenkins should detect the main branch and queue a first build. Watch the build log to confirm it finds the Jenkinsfile, installs Node.js 22, runs npm ci, and completes the build stage. Add your Vercel credentials to Jenkins before the Deploy stage runs: go to Manage Jenkins → Credentials → Add Credential, select 'Secret text', and add your Vercel token with the ID 'vercel-token'.
Pro tip: Use a Multibranch Pipeline job type rather than a standard Pipeline job — it automatically creates sub-pipelines for each branch, which is useful when Lovable uses branch-per-chat if you enable the Labs branch switching feature.
Expected result: The Jenkins job runs its first build successfully, completing the Install, Lint, and Build stages. The Deploy stage may fail until Vercel credentials are configured — that is expected at this point.
Configure a GitHub webhook for automatic build triggers
Configure a GitHub webhook for automatic build triggers
Rather than waiting for Jenkins to poll GitHub every minute, configure a GitHub webhook that triggers an immediate Jenkins build when Lovable pushes new code. In your GitHub repository, go to Settings → Webhooks → Add webhook. Set the Payload URL to your Jenkins server's webhook URL: https://your-jenkins-server.com/github-webhook/. Set Content type to 'application/json'. Under 'Which events would you like to trigger this webhook?', select 'Just the push event'. Click 'Add webhook'. GitHub will send a ping event to verify the connection — if your Jenkins server is publicly accessible and has the GitHub plugin installed, you will see a green checkmark next to the webhook. Back in Jenkins, your Multibranch Pipeline job should have 'GitHub hook trigger for GITScm polling' enabled under the job's configuration scan triggers. From this point forward, every time Lovable generates code and pushes to the GitHub repository, GitHub immediately notifies Jenkins, which starts a build within seconds. You can verify this by making a change in Lovable's chat and watching Jenkins trigger a new build automatically.
Pro tip: If your Jenkins server is behind a firewall and cannot receive GitHub webhooks, use the Jenkins GitHub plugin's 'GitHub Checks' integration or configure periodic polling as a fallback — but webhooks are strongly preferred for immediate builds.
Expected result: A push to the GitHub repository triggers a Jenkins build within 5-10 seconds, visible in the Jenkins job's build history.
Add environment variables for Supabase runtime configuration
Add environment variables for Supabase runtime configuration
Your Lovable-generated Vite project may reference environment variables like VITE_SUPABASE_URL and VITE_SUPABASE_PUBLISHABLE_KEY in the build. These are not secrets (they are safe to include in the frontend bundle) but they must be available during the Vite build process for the build to succeed. In Jenkins, add these as build environment variables: go to your pipeline job → Configure → Build Environment → 'Inject environment variables' (using the EnvInject plugin) or add them directly to the Jenkinsfile's environment block. Alternatively, create a .env.production file in your repository with the Vite variable values — Vite automatically reads this file during the production build. The Supabase URL and anon key are not secrets and are safe to commit to the repository in a .env.production file. Do not confuse these with the secret keys used in Edge Functions — those live in Lovable's Cloud Secrets and are never part of the repository. If you are unsure which variables your project needs, check src/integrations/supabase/client.ts in the repository — it shows the environment variables Vite uses for the Supabase client initialization.
1// Add to Jenkinsfile environment block, or create .env.production in repo root2// These are build-time variables for Vite (not secrets — safe to commit)3VITE_SUPABASE_URL=https://your-project.supabase.co4VITE_SUPABASE_PUBLISHABLE_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...Pro tip: VITE_ prefixed variables are baked into the frontend bundle at build time — they are not secrets. Only variables used in Edge Functions (accessed via Deno.env.get()) need to be kept out of the repository.
Expected result: The Jenkins build completes the Vite build stage without 'environment variable undefined' errors, and the dist/ directory contains the built application.
Common use cases
Automated build and deploy on every Lovable push
Every time the Lovable AI generates new code and pushes it to the main branch, Jenkins automatically detects the change via GitHub webhook, runs the build pipeline, and deploys the updated app to Vercel or Netlify. This means new features built in Lovable are live in production within minutes of being generated, without any manual deployment steps.
Copy this prompt to try it in Lovable
Staged deployment pipeline with environment promotion
Configure a Jenkins pipeline with separate stages for staging and production deployment. Every push triggers a staging deploy automatically, while production deployment requires a manual approval step. This gives teams using Lovable a safe promotion workflow — review the staging build before promoting to production.
Copy this prompt to try it in Lovable
Build quality gate before deployment
Add ESLint and TypeScript type checking as required pipeline stages before the Vite build runs. If Lovable's AI generates code with type errors or linting violations, the Jenkins build fails and prevents a broken deployment. The build failure notification tells you exactly which errors need to be fixed in Lovable before the next deploy attempt.
Copy this prompt to try it in Lovable
Troubleshooting
Jenkins build fails at 'npm ci' with 'node: not found' or wrong Node version
Cause: The NodeJS installation in Jenkins is either not configured, not named correctly, or the NodeJS Plugin is not installed.
Solution: Go to Manage Jenkins → Tools → NodeJS Installations. Add a new installation named 'NodeJS-22' (must match the tools directive in your Jenkinsfile exactly), select 'Install automatically', and choose Node.js 22.x from the version dropdown. Save and rerun the build.
1tools {2 nodejs 'NodeJS-22' // Must match Jenkins Tools configuration exactly3}Vite build fails with 'Cannot find module' or TypeScript errors
Cause: The Lovable AI generated code with type errors or imported a module that does not exist in package.json.
Solution: Check the Jenkins build log for the specific TypeScript error. Open Lovable's chat and describe the error — ask Lovable to fix it. Alternatively, open the file in a local editor and fix the import or type error manually, then push the fix to GitHub to trigger a new build.
GitHub webhook shows a red X but no builds appear in Jenkins
Cause: Jenkins server is not publicly accessible, the webhook URL is incorrect, or the GitHub plugin is not installed.
Solution: Check that your Jenkins server URL is publicly reachable. The webhook URL should be https://your-jenkins-domain.com/github-webhook/ (with trailing slash). Verify the GitHub plugin is installed in Jenkins under Manage Jenkins → Plugins.
Best practices
- Use npm ci instead of npm install in your Jenkinsfile — it is faster, more reproducible, and ensures exact dependency versions from package-lock.json.
- Store Vercel or Netlify deployment tokens as Jenkins credentials with Secret text type, never hardcode them in the Jenkinsfile.
- Add a lint or type-check stage before the build stage so that Lovable AI-generated code with type errors is caught before deployment.
- Use the Multibranch Pipeline job type rather than a standard Pipeline — it handles branch creation and deletion automatically as Lovable adds feature branches.
- Configure a post { failure } block in your Jenkinsfile to send Slack or email notifications when builds fail, so you know immediately when Lovable-generated code breaks the build.
- Use cleanWs() in the post { always } block to clean the workspace after each build and prevent disk space accumulation on the Jenkins agent.
- Test your Jenkinsfile locally using a tool like act (which runs GitHub Actions locally) before committing — or use Jenkins' Pipeline Syntax generator to validate syntax.
- Keep your Jenkins plugins updated — outdated plugins are the most common source of unexpected build failures in mature Jenkins installations.
Alternatives
CircleCI is a cloud-based CI/CD service with simpler YAML configuration and no server management — better for teams without existing Jenkins infrastructure.
Travis CI uses a simpler .travis.yml configuration and has strong GitHub integration, making it easier to set up for open-source Lovable projects.
Docker provides containerized build environments that work well as Jenkins agents, ensuring consistent build environments across your Lovable CI/CD pipeline.
Frequently asked questions
Does Jenkins need any Lovable-specific configuration or plugins?
No. Lovable generates standard Vite and React TypeScript projects. Jenkins only needs the NodeJS Plugin (for Node.js 22) and the GitHub plugin (for webhooks). There are no Lovable-specific Jenkins plugins or configuration requirements — it builds like any other Node.js project.
How is Jenkins different from CircleCI for Lovable projects?
Jenkins is self-hosted and uses Groovy-based Jenkinsfile syntax — it offers unlimited customization but requires you to manage the server, plugins, and agent configuration. CircleCI is a cloud service with YAML configuration that is simpler to set up and requires no server management. For teams with existing Jenkins infrastructure, Jenkins is the natural choice. For new projects without infrastructure requirements, CircleCI or GitHub Actions are easier to start with.
Can Jenkins deploy to Lovable directly?
No. Jenkins deploys the built output (the dist/ directory) to an external hosting provider like Vercel, Netlify, or a custom server. Lovable's own deployment is separate and happens through its built-in publish flow. The Jenkins pipeline handles your CI/CD for production hosting, while Lovable's preview handles the AI development workflow.
What if Lovable pushes broken code that fails the Jenkins build?
This is one of the benefits of having a CI/CD pipeline — it catches broken builds before they reach production. When Lovable's AI generates code with a type error or build failure, Jenkins reports the failure in the build log. Take the error message back to Lovable's chat and ask the AI to fix it. Once fixed and pushed, Jenkins automatically retries the build.
How do I handle Supabase Edge Functions in the Jenkins pipeline?
Edge Functions are deployed by Lovable automatically when you generate them through the chat interface — you do not need Jenkins to deploy them. If you want Jenkins to deploy Edge Functions as well, you would need to add a Supabase CLI deployment step to your Jenkinsfile, but this requires storing Supabase access credentials in Jenkins and is generally unnecessary since Lovable handles Edge Function deployment.
Talk to an Expert
Our team has built 600+ apps. Get personalized help with your project.
Book a free consultation