MyClaude Docs
MyClaude Docs

Getting Started

Buyers

Creators

CLI

API

Agent Integration

Developers

ContributingSelf-HostingWebhooks & IntegrationDesign System ReferenceData Model ReferenceAdmin Panel

Security

Legal

Developers

Self-Hosting

Deploy your own MyClaude marketplace instance with Firebase, Stripe Connect, Cloudflare R2, and Vercel or a standalone Node.js server.

How-To Guide

Deploy your own MyClaude marketplace instance. This guide covers every service dependency, environment variable, and verification step.

Architecture overview

Browser  -->  Next.js 16 (Vercel / Node.js)
                |         |         |
                v         v         v
          Firebase    Stripe     Cloudflare R2
          (Auth +     Connect    (product files)
          Firestore + (payments)
          Storage)
ServiceRole
Firebase AuthUser authentication (email/password, Google OAuth)
Cloud FirestorePrimary database (products, users, orders, reviews)
Firebase StorageAvatar and thumbnail uploads
Stripe Connect ExpressPayment processing, seller payouts, 8% platform fee
Cloudflare R2Product file storage (Skills, Agents, etc.) with presigned URLs
Vercel (recommended) or Node.js hostApplication server

Prerequisites

Before you begin, create accounts and projects for:

  1. Firebase -- Create a project at console.firebase.google.com
  2. Stripe -- Create an account at dashboard.stripe.com with Connect enabled
  3. Cloudflare -- Create an R2 bucket at dash.cloudflare.com
  4. Vercel (recommended) or a server running Node.js 20+

Environment variables

Your deployment requires 17 environment variables. Never commit actual values to version control.

Firebase Client (exposed to browser)

VariableDescription
NEXT_PUBLIC_FIREBASE_API_KEYFirebase Web API key from project settings
NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN{project-id}.firebaseapp.com
NEXT_PUBLIC_FIREBASE_PROJECT_IDFirebase project ID
NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET{project-id}.firebasestorage.app
NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_IDSender ID from project settings
NEXT_PUBLIC_FIREBASE_APP_IDApp ID from project settings
NEXT_PUBLIC_FIREBASE_MEASUREMENT_IDGoogle Analytics measurement ID (optional)

Firebase Admin (server-only)

VariableDescription
FIREBASE_SERVICE_ACCOUNT_KEYFull JSON string of the service account key downloaded from Firebase Console > Project Settings > Service Accounts. Must be a single-line JSON string.

Stripe

VariableDescription
STRIPE_SECRET_KEYStripe secret key. Use sk_test_* for testing, sk_live_* for production.
STRIPE_WEBHOOK_SECRETWebhook signing secret from Stripe Dashboard > Webhooks
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEYStripe publishable key (exposed to browser)

Cloudflare R2

VariableDescription
CLOUDFLARE_ACCOUNT_IDYour Cloudflare account ID (found in the dashboard URL)
R2_ACCESS_KEY_IDR2 API token access key
R2_SECRET_ACCESS_KEYR2 API token secret key
R2_BUCKET_NAMEName of the R2 bucket for product files

Platform

VariableDescription
NEXT_PUBLIC_PLATFORM_FEE_PERCENTPlatform fee percentage (default: 8)
NEXT_PUBLIC_APP_URLYour deployment URL (e.g., https://marketplace.example.com). Used for CSRF origin validation and Stripe redirect URLs.

Firebase setup

1. Enable authentication

In Firebase Console > Authentication > Sign-in method, enable:

  • Email/Password
  • Google (recommended)

2. Create Firestore database

Create a Cloud Firestore database in production mode. Deploy the security rules:

$ npx firebase deploy --only firestore:rules

The rules file (firestore.rules) ships with the repository. It enforces:

  • Authenticated reads for most collections
  • Server-only writes for orders (webhook creates these)
  • Owner-only writes for user profiles

3. Deploy storage rules

$ npx firebase deploy --only storage

The storage rules (storage.rules) enforce:

  • allow read: if false for product files (signed URLs bypass rules)
  • Authenticated uploads for avatars and thumbnails with size limits

4. Create Firestore indexes

Composite indexes are required for queries. Deploy them:

$ npx firebase deploy --only firestore:indexes

Stripe Connect setup

1. Enable Connect

In Stripe Dashboard > Connect > Settings:

  • Account type: Express
  • Platform profile: Marketplace

2. Configure webhook

Create a webhook endpoint pointing to your deployment:

https://your-domain.com/api/stripe/webhooks

Subscribe to these events:

  • checkout.session.completed -- creates orders after payment
  • charge.refunded -- processes refunds, updates stats
  • account.updated -- tracks seller onboarding status

Copy the webhook signing secret to STRIPE_WEBHOOK_SECRET.

3. Platform fee

The platform fee is hardcoded at 8% on the server side (in the webhook handler). The NEXT_PUBLIC_PLATFORM_FEE_PERCENT variable controls the display value shown to users. To change the actual fee, modify the PLATFORM_FEE_PERCENT constant in src/app/api/stripe/webhooks/route.ts.

R2 storage setup

1. Create a bucket

In Cloudflare Dashboard > R2 > Create bucket. Name it (e.g., myclaude-marketplace).

2. Create API token

In R2 > Manage R2 API Tokens > Create API token:

  • Permissions: Object Read & Write
  • Scope: Apply to the specific bucket

Copy the Access Key ID and Secret Access Key.

3. Configure CORS (if needed)

If your deployment domain differs from the R2 endpoint, add a CORS policy to the bucket:

[
  {
    "AllowedOrigins": ["https://your-domain.com"],
    "AllowedMethods": ["GET", "PUT"],
    "AllowedHeaders": ["*"],
    "MaxAgeSeconds": 3600
  }
]

Deploying

Option A: Vercel (recommended)

$ npm install -g vercel
$ vercel --prod

Add all 17 environment variables in Vercel Dashboard > Settings > Environment Variables. The next.config.ts and build scripts are pre-configured for Vercel.

Key Vercel settings:

  • Framework Preset: Next.js
  • Node.js Version: 20.x
  • Build Command: npm run build (runs prebuild script automatically)
  • Output Directory: .next

Option B: Self-hosted Node.js

$ npm install
$ npm run build
$ npm start

The server starts on port 3000 by default. Use a reverse proxy (nginx, Caddy) for TLS termination. Ensure all 17 environment variables are set in the process environment.

Minimum server requirements:

  • Node.js 20+
  • 1 GB RAM
  • Outbound HTTPS access to Firebase, Stripe, and Cloudflare APIs

Post-deploy verification

Run through this checklist after your first deployment.

StepHow to verifyExpected result
Health checkGET /api/health{ "status": "ok" }
AuthRegister a new accountUser appears in Firebase Console > Authentication
Product creationPublish a free productProduct visible on /explore
File uploadUpload a .zip to R2 via the publish flowFile stored in your R2 bucket
Stripe ConnectClick "Connect Stripe" in seller settingsRedirected to Stripe onboarding
CheckoutPurchase a paid product (test mode)Order created in Firestore orders collection
DownloadDownload a purchased productSigned URL generated, file downloads
WebhookCheck Stripe Dashboard > Webhooks > Recent eventsEvents show 200 responses
CSRFcurl -X POST /api/products/like -H "Origin: https://evil.com"403 Forbidden

Related pages

  • Contributing -- Local development setup
  • Security Model -- Security architecture details
  • Webhooks & Integration -- Webhook events and rate limits
  • API Overview -- Endpoint groups and authentication

Contributing

Set up a local MyClaude development environment, understand the codebase conventions, and submit your first pull request.

Webhooks & Integration

Reference for Stripe webhook events, payload handling, idempotency, rate limits across all 26 API routes, and integration points for CLI and MCP.

On this page

Architecture overviewPrerequisitesEnvironment variablesFirebase Client (exposed to browser)Firebase Admin (server-only)StripeCloudflare R2PlatformFirebase setup1. Enable authentication2. Create Firestore database3. Deploy storage rules4. Create Firestore indexesStripe Connect setup1. Enable Connect2. Configure webhook3. Platform feeR2 storage setup1. Create a bucket2. Create API token3. Configure CORS (if needed)DeployingOption A: Vercel (recommended)Option B: Self-hosted Node.jsPost-deploy verificationRelated pages