Deco
Full-Code Guides

Deployment

Deploy your full-stack AI app to Cloudflare Workers

Deploy Command

When you’re ready to share your app with the world (or your team), you’ll deploy it to Cloudflare Workers via the deco CLI.

 npm run deploy 

That’s it! Your app goes live on Cloudflare’s global edge network.

What Happens

1. Build frontend

  • Vite bundles React app ( /view ) into optimized static files
  • Output goes to /view/dist

2. Build worker

  • TypeScript compiles server/main.ts
  • Dependencies bundled
  • Static assets attached using Workers asset binding

3. Upload to Cloudflare

  • Uses wrangler.toml for project configuration
  • Worker code deployed globally
  • Assets served from edge
  • Database (D1) provisioned automatically

4. Live URL

  • Your app goes live at https://<app-name>.deco.page
  • MCP endpoint available at https://<app-name>.deco.page/mcp

One repo, one deploy, one URL. Frontend, backend, and database deploy together with shared context and zero integration code.

Authentication

First deploy requires authentication:

 deco login
# or
npx deco-cli login 

Opens browser to authenticate. Your credentials persist locally.

CI/CD Deployment

For automated deployments, use an API token:

 deco deploy -t <your-api-token> 

Get tokens from your workspace settings with HOSTING_APP_DEPLOY permission.

GitHub Actions example:

 name: Deploy
on:
  push:
    branches: [main]
    
jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-node@v3
        with:
          node-version: '22'
      - run: npm install
      - run: npm run deploy
        env:
          DECO_TOKEN: ${{ secrets.DECO_TOKEN }} 

Edge Runtime Benefits

Global deployment: Code runs in 300+ cities worldwide. Users connect to the nearest edge location.

Auto-scaling: Cloudflare handles traffic spikes automatically. No capacity planning needed.

Zero cold starts: Workers stay warm. First request is as fast as the hundredth.

Efficient I/O: Worker suspends during await calls (fetch, database queries). External API waits don’t count against CPU time, keeping costs low even with heavy external dependencies.

Post-Deploy Testing

Test production immediately after deploy:

  1. Open https://<app-name>.deco.page
  2. Verify frontend loads correctly
  3. Test tool calls through UI
  4. Check integrations work (production may use different credentials than dev)
  5. Test as an end user would interact with the app
  6. Review Cloudflare Worker logs if issues occur

Updates and Rollbacks

Deploy updates:

 # Make changes
npm run deploy 

Fast deployments mean you can iterate quickly.

Rollback:

 git checkout <previous-commit>
npm run deploy 

No built-in version management yet. Use Git to track changes and redeploy previous versions if needed.

Environment variables: Set production secrets in wrangler.toml or Cloudflare dashboard. Never commit secrets to Git.

Custom Domains

Custom domain support coming soon. For now, apps deploy to *.deco.page subdomains.


Remember: Every deploy is a fresh start. Database persists, but Worker code updates instantly across all edge locations.

Found an error or want to improve this page?

Edit this page