Add a new deployment target to your existing Odoo PWA project.
Adds deployment configuration for Odoo PWA projects to Vercel, Netlify, Cloudflare Pages, or GitHub Pages.
/plugin marketplace add jamshu/jamshi-marketplace/plugin install odoo-pwa-generator@jamshi-marketplaceAdd a new deployment target to your existing Odoo PWA project.
Before adding deployment:
□ Project builds successfully (npm run build)
□ Odoo connection tested and working
□ Environment variables documented
□ Git repository initialized
□ Code committed to version control
npm install -g vercel
vercel.json{
"buildCommand": "npm run build",
"outputDirectory": "build",
"framework": "sveltekit",
"installCommand": "npm install",
"devCommand": "npm run dev",
"env": {
"VITE_ODOO_URL": "@vite_odoo_url",
"VITE_ODOO_DB": "@vite_odoo_db",
"VITE_MODEL_NAME": "@vite_model_name",
"VITE_MODEL_DISPLAY_NAME": "@vite_model_display_name"
},
"build": {
"env": {
"ODOO_API_KEY": "@odoo_api_key",
"ODOO_USERNAME": "@odoo_username"
}
}
}
For React/Vue:
{
"buildCommand": "npm run build",
"outputDirectory": "dist",
"framework": "vite"
}
.vercelignorenode_modules
.env
.env.local
*.log
.DS_Store
Option A: Vercel Dashboard (Recommended for first time)
VITE_ODOO_URLVITE_ODOO_DBODOO_API_KEYODOO_USERNAMEVITE_MODEL_NAMEVITE_MODEL_DISPLAY_NAMEOption B: Vercel CLI
vercel login
vercel
# Follow prompts
# Add environment variables when asked
# Or add them later in dashboard
Option C: Continuous Deployment
main auto-deploysIn Vercel Dashboard:
netlify.toml[build]
command = "npm run build"
publish = "build"
[build.environment]
NODE_VERSION = "18"
[[redirects]]
from = "/*"
to = "/index.html"
status = 200
[functions]
directory = "netlify/functions"
For React/Vue:
[build]
command = "npm run build"
publish = "dist"
Create netlify/functions/odoo.js:
// Copy your API route logic here
// Netlify functions use different format
exports.handler = async (event, context) => {
// Parse request
const body = JSON.parse(event.body);
// Your Odoo logic here
// (copy from src/routes/api/odoo/+server.js)
return {
statusCode: 200,
body: JSON.stringify(result)
};
};
// Change API endpoint
const response = await fetch('/.netlify/functions/odoo', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(data)
});
Option A: Netlify Dashboard
Option B: Netlify CLI
npm install -g netlify-cli
netlify login
netlify init
netlify deploy --prod
wrangler.toml (for edge functions)name = "odoo-pwa"
compatibility_date = "2025-01-01"
[build]
command = "npm run build"
[build.upload]
format = "service-worker"
Create functions/odoo.js:
export async function onRequest(context) {
const { request, env } = context;
// Parse request
const body = await request.json();
// Odoo logic here
// Access env vars via env.ODOO_API_KEY
return new Response(JSON.stringify(result), {
headers: { 'Content-Type': 'application/json' }
});
}
Option A: Cloudflare Dashboard
npm run buildbuild or distOption B: Wrangler CLI
npm install -g wrangler
wrangler login
wrangler pages project create odoo-pwa
wrangler pages publish build
SvelteKit (svelte.config.js):
const config = {
kit: {
adapter: adapter({
pages: 'build',
assets: 'build',
fallback: 'index.html'
}),
paths: {
base: process.env.NODE_ENV === 'production'
? '/your-repo-name'
: ''
}
}
};
React/Vue (vite.config.js):
export default {
base: '/your-repo-name/'
};
.github/workflows/deploy.ymlname: Deploy to GitHub Pages
on:
push:
branches: [main]
permissions:
contents: read
pages: write
id-token: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
- run: npm install
- run: npm run build
env:
VITE_ODOO_URL: ${{ secrets.VITE_ODOO_URL }}
VITE_ODOO_DB: ${{ secrets.VITE_ODOO_DB }}
VITE_MODEL_NAME: ${{ secrets.VITE_MODEL_NAME }}
- uses: actions/upload-pages-artifact@v3
with:
path: build
deploy:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/deploy-pages@v4
git add .
git commit -m "Add GitHub Pages deployment"
git push origin main
# Public (VITE_ prefix for client access)
VITE_ODOO_URL=https://yourcompany.odoo.com
VITE_ODOO_DB=yourcompany-main
VITE_MODEL_NAME=x_expense
VITE_MODEL_DISPLAY_NAME=Expense
# Private (server-side only)
ODOO_API_KEY=your_production_api_key
ODOO_USERNAME=your.email@company.com
Vercel:
Netlify:
netlify.tomlCloudflare:
GitHub Pages:
After deploying to new platform:
□ Build completed successfully
□ Application loads at deployment URL
□ Odoo connection works
□ Data syncs correctly
□ CRUD operations work
□ Offline mode functions
□ Service worker registered
□ PWA installs correctly
□ Environment variables set correctly
□ No console errors
□ Tested on mobile
□ Custom domain configured (if needed)
You can deploy the same app to multiple platforms for:
main branch → Vercel (primary production)
staging branch → Netlify (staging)
PRs → Vercel preview deployments
npm run build locally/add-deployment - Add new deployment target/deploy-vercel - Deploy to Vercel/deploy-github - Deploy to GitHub Pages/test-connection - Test before deploying/optimize - Optimize before productionUse Git-Based Deployment
Separate Environments
Secure Secrets
Monitor Deployments
Test Before Merging