Skip to content
Cap-goPublic

About

Console, Backend and CLI to manage Capgo Instant update and Native build for Capacitor apps

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

214 stars

Watchers

3 watching

Forks

Latest commit

 

History

18,735 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Capgo: build Capacitor apps with AI, ship updates instantly

Capgo - Instant updates for capacitor

Bugs Security Rating Maintainability Rating Code Smells Lines of Code Technical Debt Reliability Rating Duplicated Lines (%) Vulnerabilities CodSpeed Known Vulnerabilities GitHub license Bump version Build source code and send to Capgo semantic-release Commitizen friendly



Capgo is the AI-ready platform to build, ship, and maintain Capacitor apps: Capacitor skills and MCP servers for AI coding agents (Claude Code, Codex, Cursor, Copilot, Gemini CLI), maintained Capacitor plugins, cloud native iOS/Android builds with App Store and Google Play publishing, live updates with channels and rollback, and release monitoring.

This repository is the open-source core of Capgo: the web console, the backend API (Cloudflare Workers + Supabase, including the hosted MCP endpoint), and the @capgo/cli workspace (including the local MCP server).

Use with AI coding agents

Install the Capgo Capacitor skills in your agent (Claude Code, Codex, Cursor, Copilot, Gemini CLI):

npx skills add Cap-go/capgo-skills

Connect the Capgo MCP server so the agent can manage apps, channels, bundles, native builds, and stats:

  • Hosted MCP: https://api.capgo.app/mcp (docs)
  • MCP Events on the hosted server: subscribe with events/subscribe or capgo_subscribe_events for build.succeeded, build.failed, bundle.uploaded, and bundle.deployed (Standard Webhooks delivery).
  • Local MCP (served by the CLI in this repo): npx @capgo/cli@latest mcp (stdio only; event callbacks require the hosted MCP).

Per-agent setup instructions are at capgo.app/agents.

Hosted MCP: accurate tool hints and read-only build status

OpenAI and other remote MCP clients rely on tool annotations (readOnlyHint, destructiveHint) to decide when to ask for confirmation. The hosted server at https://api.capgo.app/mcp now documents bundle upload and credentials upload as destructive, and polls native cloud build status through a read-only path that does not sync build_requests, record build minutes, cancel timed-out jobs, or emit webhooks. HTTP /build/status and the CLI still persist on every poll.

When a hosted MCP poll sees a job still running past the app's configured timeout, the payload includes timeout_exceeded and timeout_warning so agents can call capgo_cancel_build or wait for Capgo reconciliation instead of polling indefinitely. See Capgo MCP docs. Website documentation updates for hosted build polling are tracked in Cap-go/website and may lag this repository until published.

Features

  • ☁️ Cloud / Self hosted Support: Use our Cloud to manage your app updates or yours.
  • 📦 Bundle Management: Download, assign to channel, rollback.
  • 📺 Channel Support: Use channels to manage different environments.
  • 🎯 Set Channel to specific device to do QA or debug one user.
  • 🔄 Auto Update: Automatically download and set the latest bundle for the app.
  • ✅ Official Appflow alternative: our Capacitor updater plugin is the official alternative to Ionic Appflow.
  • 🛟 Rollback: Reset the app to last working bundle if an incompatible bundle has been set.
  • 🔁 Delta Updates: Make instant updates by only downloading changed files.
  • 🔒 Security: Encrypt and sign each updates with best in class security standards.
  • ⚔️ Battle-Tested: Used in more than 3000 projects.
  • 📊 View your deployment statistics
  • 🔋 Supports Android and iOS
  • ⚡️ Capacitor 8/7/6/5 support
  • 🌐 Open Source: Source code licensed under GNU AFFERO GENERAL PUBLIC LICENSE (public forks must use their own branding; private internal self-hosting is fine, see Trademarks and forks)
  • 🌐 Open Source Backend: Self install our backend in your infra

Security updates

The Capgo console shows published Capacitor security advisories and optional email alerts for your apps. The security_updates email preference defaults to off; turn it on under Account settings, Notifications. Per app, open Observe, Security updates to review matches against native package versions already reported on bundles. Public docs: Notifications security advisories, Observe security updates, website #1413, Console security updates, and Security advisories feature.


Usage

Capgo runs on Cloudflare Workers and Supabase:

  • Cloudflare Workers serve every HTTP endpoint: the API, the plugin endpoints (/updates, /stats, /channel_self), files, triggers, queue consumers and CRON handlers. This is the same in production, self-hosted installs, local development (wrangler dev) and CI.
  • Supabase provides the database (Postgres, migrations, pgmq), auth and storage. Capgo no longer ships Supabase Edge Functions.

Upgrading from the old Supabase Edge Functions setup? Read Migrating from Supabase Edge Functions to Cloudflare Workers.

Why Cloudflare Workers + Supabase

The backend code (Hono) used to run on both Supabase Edge Functions and Cloudflare Workers. With ~50M devices, Edge Functions were cost-prohibitive (they follow AWS pricing) and every endpoint had to be kept working on two runtimes. Workers are ~10x cheaper for our traffic profile, so everything now runs there and local development uses the exact same runtime as production.

Old clients that still call <supabase url>/functions/v1/<name>/... keep working on Capgo Cloud: sb.capgo.app proxies those paths to the workers.

Project structure (self-hosting map)

If you're self-hosting, the key pieces live in a few top-level directories:

  • supabase/ - Database, auth and storage
    • supabase/functions/_backend/ - Backend implementation served by the Cloudflare Workers (the folder name is historical; nothing here is deployed as a Supabase Edge Function)
      • public/ - Public API routes used by customers and apps
      • private/ - Internal API routes for the console and ops tooling
      • plugin_runtime/ - Plugin endpoints (updates, stats, channel_self, etc.)
      • triggers/ - Database triggers, queue consumers and CRON handlers
    • supabase/migrations/ - Database schema and RLS policies
    • supabase/seed.sql - Local seed data for tests/dev
  • supabase/schemas/prod.sql - Production schema dump (reference only)
  • cloudflare_workers/ - Required Cloudflare Workers: api/, plugin/, files/ (entry points and wrangler.jsonc deploy config)
  • src/ - Frontend Vue 3 web console (Vite + Tailwind + DaisyUI)
    • src/pages/ - File-based routes
    • src/components/ - Reusable UI components
    • src/services/ - API clients and integrations
    • src/stores/ - Pinia stores
  • sql/ - Raw SQL helpers and maintenance scripts
  • scripts/ - Dev/build scripts used by CI and local tooling
  • tests/ - Backend Vitest tests (run in parallel)
  • playwright/ - Frontend E2E tests
  • docs/ - Extra documentation and guides
  • android/, ios/ - Capacitor native projects (mobile builds)

Self-hosting and forking are welcome, but the license covers the code only. Public forks and services presented to others must use their own name and branding; see Trademarks and forks.

Quick self-hosting path:

  1. supabase/ provides the database, auth and storage.
  2. cloudflare_workers/ (API, plugin, files) serves every endpoint. Locally, bun backend runs them with wrangler.
  3. src/ is the web console you point to your API worker (API_DOMAIN).

Queue wakeups go to public.http_dispatch_outbox ('*' in public.http_dispatch_targets), which the API worker's QueueDispatcher drains every second, so the API worker must run for queues to make progress.

Backend endpoints (what lives where)

The backend is split by responsibility to keep routes clear and access scoped:

  • supabase/functions/_backend/public/ - Public API exposed to customers. This is the documented API on the website for customers that want to interact with Capgo programmatically (apps, channels, bundles, devices, etc.).
  • supabase/functions/_backend/private/ - Private API used internally. The console (web UI) uses this heavily for admin/ops workflows. It is not publicly accessible. Some UI flows still use the public API where appropriate.
  • supabase/functions/_backend/plugin_runtime/ - Plugin API used by the @capgo/capacitor-updater plugin running inside apps:
    • plugins/updates - device update checks and bundle download flow
    • plugins/stats - upload usage stats from devices
    • plugins/channel_self - allow a device to opt into a channel (QA/debug)
  • supabase/functions/_backend/triggers/ - Triggers & CRON for automated backend jobs (queue consumers, scheduled tasks, DB-triggered flows).

When self-hosting, you generally expose public + plugin_runtime (via the plugin worker / Deno updates · stats · channel_self entries). private should stay internal and locked down. triggers runs automatically.

Production schema (prod.sql)

supabase/schemas/prod.sql is a schema dump of the production database. It is generated via bun run schemas (or bun run schemas:local) and is meant for reference/diffing, not as a source of truth. All actual schema changes live in supabase/migrations/.

Documentation

https://github.com/Cap-go/capacitor-updater/wiki/Capgo-Sandbox-App

Plugins

All the following official plugins are already installed and pre-configured:

  • Action Sheet - Provides access to native Action Sheets.
  • App - Handles high level App state and events.
  • App Launcher - Allows to check if an app can be opened and open it.
  • Browser - Provides the ability to open an in-app browser and subscribe to browser events.
  • Camera - Provides the ability to take a photo with the camera or choose an existing one from the photo album.
  • Clipboard - Enables copy and pasting to/from the system clipboard.
  • Device - Exposes internal information about the device, such as the model and operating system version, along with user information such as unique ids.
  • Dialog - Provides methods for triggering native dialog windows for alerts, confirmations, and input prompts.
  • Filesystem - Provides a NodeJS-like API for working with files on the device.
  • Geolocation - Provides simple methods for getting and tracking the current position of the device using GPS, along with altitude, heading, and speed information if available.
  • Haptics - Provides physical feedback to the user through touch or vibration.
  • Keyboard - Provides keyboard display and visibility control, along with event tracking when the keyboard shows and hides.
  • Local Notifications - Provides a way to schedule device notifications locally (i.e. without a server sending push notifications).
  • Motion - Tracks accelerometer and device orientation (compass heading, etc.).
  • Network - Provides network and connectivity information.
  • Push Notifications - Provides access to native push notifications.
  • Screen Reader - Provides access to TalkBack/VoiceOver/etc. and Provides simple text-to-speech capabilities for visual accessibility.
  • Share - Provides methods for sharing content in any sharing-enabled apps the user may have installed.
  • Splash Screen - Provides methods for showing or hiding a Splash image.
  • Status Bar - Provides methods for configuring the style of the Status Bar, along with showing or hiding it.
  • Storage - Provides a simple key/value persistent store for lightweight data.
  • Text Zoom - Provides the ability to change Web View text size for visual accessibility.
  • Toast - Provides a notification pop up for displaying important information to a user. Just like real toast!

Tests

Tests are split by backend (API/plugin), CLI, database SQL, and frontend:

  • tests/ - Backend Vitest tests (API + plugin + CLI)
  • playwright/e2e/ - Frontend Playwright tests
  • supabase/tests/ - SQL tests for functions, RLS, and DB logic

Backend test groups (Vitest):

  • API tests: public/private endpoints and general backend behavior
  • Plugin tests: tests/updates*.test.ts, tests/stats*.test.ts, tests/channel_self*.test.ts
  • CLI tests: tests/cli*.test.ts (CLI auth, upload, metadata, etc.)

Run tests:

Integration tests need Supabase (bun run supabase:start) and the local Cloudflare Workers (bun run backend:workers) running.

bun test:all
bun test:backend
bun test:cli
bun test:front

# CLI workspace
bun run cli:build
bun run cli:test
bun run cli:check

# Legacy aliases kept for compatibility
bun test:local
bun test:all:local
bun test:cli:local

# Database SQL tests (Supabase CLI)
supabase test db

# The CI worker configs
bun test:cloudflare:all
bun test:cloudflare:backend
bun test:cloudflare:updates

# Local Cloudflare Workers (required for every integration test)
bun run backend:workers

Notes:

  • Tests run in parallel across files. If a test mutates shared data, add dedicated seed data in supabase/seed.sql.
  • The repository is a Bun workspace monorepo. The Capgo app lives at the root and the CLI lives in cli/.
  • Capgo's Vitest CLI coverage now resolves the local cli/ workspace by default, so monorepo changes are exercised together.
  • SQL tests in supabase/tests/ are run by the Supabase CLI test runner.
  • Run bun run supabase:start first so the local DB is available (worktree-isolated).

Dev contribution

Clone

Use a blobless clone. It downloads the full commit history but fetches old file contents only when you need them, so it is much smaller than a full clone:

git clone --filter=blob:none https://github.com/Cap-go/capgo.app.git

Use --depth 1 instead when you only need the current code (for example in a throwaway CI job).

Coding Style

Dev tools

Deploy on Cloudflare Pages

Use the CLI to deploy to preprod

bun run dev-build
# then deploy
bun run deploy:cloudflare:console:preprod

or Prod

bun run build
# then deploy
bun run deploy:cloudflare:console:prod

Development

You will need to start each local server in separate terminals.

Before continuing, ensure you have the following installed:

You can install the supabase CLI globally with bun install supabase -g and you'll be able to invoke supabase from anywhere.

Alternatively, you can install the supabase CLI locally with bun install supabase --save-dev but, to invoke it, you have to use: ./node_modules/supabase/bin/supabase.

In the following guideline, we will assume that you have installed the supabase CLI globally.

Start Supabase DB Locally

Start the Supabase DB:

bun run supabase:start

Ports may differ per git worktree. To see the exact URLs/keys for the current worktree run:

bun run supabase:status

Seed Supabase DB locally

[!WARNING] ⚠️ Ensure Docker is running.

bun run supabase:db:reset

Start the backend (Cloudflare Workers) locally

bun run backend:workers

This runs the API (http://127.0.0.1:8787), plugin (:8788) and files (:8789) workers with wrangler, plus the local queue dispatcher. bun backend starts Supabase and the workers in one command.

Start Frontend locally

bun install
bun serve:local

Login

Visit http://localhost:5173

There are two login credentials you can use:

Account Username Password
Demo User test@capgo.app testtest
Admin User admin@capgo.app adminadmin

The demo user account has some demo data in it. If the data is not fresh, just reset the db with supabase db reset. The seed has been made in a way that ensures the data is always fresh.

The admin user account has administration rights so the user can impersonate other users. You can find the interface for that in the "Account" section.

Supabase DB Reset

[!WARNING] ⚠️ Ensure Docker is running.

This will seed the DB with demo data.

supabase db reset

Deploy Supabase self hosted

To deploy the supabase instance in self-hosted, use the Supabase official guide. Supabase only hosts the database, auth and storage: apply the migrations with supabase db push and deploy the Cloudflare Workers below.

Deploy Supabase cloud

To deploy the Supabase instance on cloud, you need a paid account, which costs $25/month.

Link the project to the cloud with the following command:

supabase link

https://supabase.com/docs/reference/cli/supabase-link

Then you need to push the migrations to the cloud with the following command:

supabase db push --linked

https://supabase.com/docs/reference/cli/supabase-migration-up

And seed the DB with demo data:

supabase seed buckets

https://supabase.com/docs/reference/cli/supabase-seed-buckets

Deploy the Cloudflare Workers (API, plugin, files)

Every endpoint runs on three workers configured in cloudflare_workers/{api,plugin,files}/wrangler.jsonc. Add your own environment to each one, upload its secrets with wrangler secret bulk (the same values the old supabase/functions/.env held, plus CLOUDFLARE_FUNCTION_URL and FILES_PUBLIC_URL), and deploy with bunx wrangler deploy -c cloudflare_workers/<worker>/wrangler.jsonc --env <env>. Organization invitation emails depend on Bento (BENTO_PUBLISHABLE_KEY, BENTO_SECRET_KEY, BENTO_SITE_UUID in the API worker secrets).

Step by step, including how to move an install that still runs Supabase Edge Functions: docs/migrate-from-supabase-edge-functions.md.

Environment Variables for Self-Hosted Deployments

By default, the configuration uses Capgo production values from configs.json. For self-hosted deployments, you must override all configuration values using environment variables.

Required Environment Variables

All configuration keys from configs.json can be overridden by setting their uppercase equivalent as environment variables:

Environment Variable Description Default (Prod) Required for Self-Hosted
BASE_DOMAIN Console domain console.capgo.app ✅ Yes
API_DOMAIN API domain (the console only talks to this API) api.capgo.app ✅ Yes
CAPTCHA_KEY Turnstile captcha key Capgo production key ⚠️ Optional

Example Self-Hosted Configuration

# .env file for self-hosted deployment
BASE_DOMAIN=console.yourdomain.com
API_DOMAIN=api.yourdomain.com
CAPTCHA_KEY=your-turnstile-key

Bento Email Variables

If you want organization invitation emails to work, you also need to configure these Bento environment variables:

BENTO_PUBLISHABLE_KEY=your-bento-publishable-key
BENTO_SECRET_KEY=your-bento-secret-key
BENTO_SITE_UUID=your-bento-site-uuid

How It Works

The configuration system (scripts/utils.mjs) checks for environment variables first:

  1. If an uppercase environment variable exists (e.g., API_DOMAIN), it uses that value
  2. Otherwise, it falls back to the appropriate value from configs.json based on the branch (prod, preprod, development, or local)

Important: Without setting these environment variables, your self-hosted instance will attempt to connect to Capgo's production infrastructure, which will fail.

Build

To build the web app in mobile, in order to push to mobile stores, run:

bun install
bun mobile

And you will see the generated files in the dist directory, ready to be served on stores.

License

All code in this repository, including the cli/ workspace, is licensed under the GNU Affero General Public License v3.0 (AGPL-3.0). The LICENSE file is the authoritative license text.

Trademarks and forks

The AGPL-3.0 license covers only the code (source and works built from it). It does not grant any rights to Digital Shift OU's trademarks, branding, or trade dress, including the Capgo name, wordmark, logos, and application icons. This has always been the case; this section only makes it explicit.

If you fork, redistribute, host, or build on Capgo's source code:

  • Use your own name and branding. Replace the Capgo name, wordmark, logos, and application icons in any public fork, redistributed build, hosted service, or self-hosted service presented to others, website, package, or app store listing. Truthful, plain-text attribution is allowed as described in TRADEMARK.md. Private internal self-hosting is fine.
  • Make it clear that your project is not Capgo. State clearly that your project is unofficial and not affiliated with or endorsed by Capgo or Digital Shift OU.

See TRADEMARK.md for the full trademark and branding policy.

About

Console, Backend and CLI to manage Capgo Instant update and Native build for Capacitor apps

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

214 stars

Watchers

3 watching

Forks

Releases

Sponsor this project

Used by

Contributors

Languages