Deploy

Run MRRocket on Cloudflare Workers with a Neon Postgres, with Clerk for login. The first deploy starts with an empty workspace: no demo data, you add your products with the wizard.

The long version, with every provider webhook and the list of public addresses, is docs/deploy.md in the repository. This page is the short path.

What you create#

WhereWhat
Neonone project, branch main for production (optionally staging), the pooled connection string
Clerkone application, its publishable and secret key
Cloudflarean R2 bucket mrrocket-uploads, two Workers (mrrocket and mrrocket-docs), a custom domain for each

Deploy the cockpit#

  1. Create the database tables#

    In Neon open Connect, tick Connection pooling and copy the connection string (the host contains -pooler). Then in prototype/web:

    export DATABASE_URL='postgres://...-pooler.../neondb?sslmode=require'
    npm run db:migrate

    This creates the tables and an empty workspace. Run it again after every schema change (npm run db:migrations writes the new migration first).

  2. Set up login#

    Create a Clerk application and copy its keys. Choose who is the owner with one var: MRROCKET_OWNER_EMAILS (comma list) or MRROCKET_CLERK_ORG_ID. Without the keys, every protected address answers 503 "Authentication is not configured".

  3. Create the bucket and the secrets#

    npx wrangler login
    npx wrangler r2 bucket create mrrocket-uploads
    npx wrangler secret put DATABASE_URL
    npx wrangler secret put MRROCKET_SECRET    # openssl rand -base64 48, never change it later
    npx wrangler secret put CLERK_SECRET_KEY
    npx wrangler secret put CRON_SECRET        # openssl rand -hex 32

    Provider keys (ZERNIO_API_KEY, COMPOSIO_API_KEY, DATAFORSEO_LOGIN, RESEND_API_KEY and so on) go in the same way; see Platform providers. .env.example lists every variable.

  4. Deploy#

    Put NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY (and NEXT_PUBLIC_DOCS_URL, NEXT_PUBLIC_APP_URL) into .env.production.local, then:

    npm run deploy

    Open the printed workers.dev address: you land on the sign-in page.

  5. Add the domains and set the addresses#

    In the Cloudflare dashboard add a custom domain to the Worker. Then set the vars APP_URL, MRROCKET_PUBLIC_URL, MRROCKET_OWNER_EMAILS and NEXT_PUBLIC_DOCS_URL in wrangler.jsonc, finish Clerk's domain setup, and deploy again.

  6. Register the webhooks#

    Each provider calls https://<your app>/api/webhooks/<provider>: zernio, composio, close, dataforseo, resend, instantly, billing (MRRocket's own Stripe billing; npm run billing:stripe-setup registers it, see docs/billing.md), and per product stripe/<productId>, revenuecat/<productId> and the other revenue sources. Every one verifies its own secret; unsigned calls are refused.

  7. Check the cron triggers#

    Workers > mrrocket > Settings > Triggers shows three schedules (every 10 minutes, hourly, daily). The logs show a [cron] line per job.

  8. Go through the onboarding#

    Sign in. Until a product is set up, every page of the cockpit opens the first-run setup at /welcome: your name, what you run, how far along it is and what the team should take on, then your website, which an agent reads into the product's name, one-liner, audience and category for you to confirm, then the connections, more products, a few optional questions about you, the plan (where billing is on) and your team. Settings stays reachable the whole time. To count your own onboarding in MRRocket's analytics, set MRROCKET_SELF_KEY to the MRRocket product's public key (and MRROCKET_SELF_HOST when that product lives in another MRRocket; then also the secret MRROCKET_SELF_SERVER_KEY, the product's server key from its Sign-in settings, since server events need it).

Deploy the docs#

In prototype/docs run npm run deploy, then npx wrangler secret put OPENROUTER_API_KEY (or ANTHROPIC_API_KEY) for the "Ask the docs" box. Staging for both apps is npm run deploy:staging.

Never run npm run db:regen once a database exists. It rewrites the first migration. It is only for the moment before the very first deploy.