Self-Hosted Install

InstallEVENTS GatewayOn Your Domain

This guide shows a direct path from the public GitHub repository to a workingEVENTS Gatewaysetup on your own domain. Create the required Cloudflare resources, add their real IDs and names to Wrangler, deploy the runtime, connect a collector subdomain, and install the tracker on your site.

Preflight

What you need before you start.

The installation path is direct: start from GitHub, deploy the Workers runtime, and attach the tracker to a site you already control.

GitHub repository access

Start from the public GitHub repository so you can clone it, fork it, or deploy from your own copy.

Cloudflare account

You need a Cloudflare account with access to Workers and the domain where the collector subdomain will run. Create D1, Queues, KV namespaces, R2 buckets, and Durable Objects in your own account, keep the preset resource names, then add the generated IDs and names to Wrangler.

A target website

Your site can live on any stack.EVENTS Gatewayonly needs a tracker install and one collector endpoint.

Stripe account

If you want billing from day one, prepare your Stripe keys before filling in the private install values.

Installation Flow

From GitHub page to live domain.

These steps describe a straightforward path for a team that wants to deployEVENTS Gatewayon its own Cloudflare account.

  • The public website can stay on its own domain while the collector runs on a dedicated subdomain.
  • The tracker can be added to marketing sites, stores, landing pages, and custom applications.
  • The same Cloudflare Workers runtime can receive events from multiple sites or products.

Open the GitHub repository page

Start from GitHub, review the project, and clone or fork it into your own account so you can deploy and maintain your ownEVENTS Gatewayinstance.

Create Cloudflare resources manually

Create the D1 database, queue, KV namespaces, R2 ledger bucket, and Durable Object resources in your own Cloudflare account. Keep the preset project names and copy the generated IDs and names because the next step adds them to Wrangler.

Define resources in Wrangler and deploy

Add the Cloudflare resource IDs and names to Wrangler for the collector, API, and forwarder workers, then deploy them to Cloudflare. Smaller sites can often stay inside free-tier limits.

Attach a collector subdomain

Choose a subdomain such as events.example.com or edge.example.com and point it to the collector worker so every site event goes through one controlled entry point.

Install the tracker on the site

Add the script tag or SDK snippet to the target website and send events to your collector endpoint.

Configure routing and destinations

Use the dashboard to define routes, transformations, and destinations for Meta, GA4, Google Ads, TikTok, or custom webhooks.

Verify event flow on the real domain

Load the live site, confirm page views and custom events reach the collector, then validate routing, delivery status, and retries from the dashboard.

Activate Stripe billing

Set the Stripe publishable key, secret key, webhook secret, and billing return URL so payment methods, invoices, reminders, and suspension logic are ready.

Command Path

Run the core installation commands.

These command blocks mirror a direct path from the repository to a working Cloudflare Workers deployment and tracker install.

Clone from GitHub
git clone https://github.com/EventsGateway-com/EventsGateway.com.git
cd EventsGateway.com
Install dependencies
npm install
cd apps/api-worker && npm install
cd ../collector-worker && npm install
cd ../forwarder-worker && npm install
Create Cloudflare resources manually
npx wrangler d1 create eventsgateway-control-plane
npx wrangler queues create eventsgateway-ingest-production
npx wrangler kv namespace create EVENTSGATEWAY_CACHE
npx wrangler r2 bucket create eventsgateway-ledger-production
Define resources in Wrangler
"d1_databases": [
  {
    "binding": "DB",
    "database_name": "eventsgateway-control-plane",
    "database_id": "replace-with-your-d1-database-id",
    "remote": true
  }
],
"kv_namespaces": [
  {
    "binding": "CACHE",
    "id": "replace-with-your-kv-namespace-id"
  }
],
"r2_buckets": [
  {
    "binding": "LEDGER_BUCKET",
    "bucket_name": "eventsgateway-ledger-production"
  }
],
"durable_objects": {
  "bindings": [
    {
      "name": "VISITOR_STATE_DO",
      "class_name": "VisitorStateDurableObject"
    }
  ]
},
"migrations": [
  {
    "tag": "v1",
    "new_sqlite_classes": ["VisitorStateDurableObject"]
  }
],
"queues": {
  "producers": [
    {
      "binding": "EVENTS_QUEUE",
      "queue": "eventsgateway-ingest-production"
    }
  ]
}
Deploy the Workers runtime
cd apps/api-worker
npx wrangler deploy

cd ../collector-worker
npx wrangler deploy

cd ../forwarder-worker
npx wrangler deploy
Set Stripe billing secrets
cd apps/api-worker
npx wrangler secret put STRIPE_SECRET_KEY
npx wrangler secret put STRIPE_WEBHOOK_SECRET

cd ../dashboard
set VITE_STRIPE_PUBLISHABLE_KEY=pk_test_replace_me
Add the tracker to your site
<script
  src="https://events.example.com/e/"
  async
></script>
Domain Example

A simple production layout.

Use separate hostnames so the event entry point stays explicit and easy to manage.

Public site

www.example.com

Your public site. This can stay on any frontend stack as long as you can add the tracker snippet.

Collector

events.example.com

Your Cloudflare Workers collector endpoint. The tracker sends events here first.

API

api.example.com

Optional management API hostname for dashboard calls and operational tooling.

Install Wizard

Generate the private setup values before deployment.

This install flow helps self-hosted users create Cloudflare resources, keep the preset resource names, and paste the real IDs and names into Wrangler before deployment.

The public repository ships with deployment defaults for the hostedEVENTS Gatewayinstance. Replace them in your own copy during install.
Create D1, KV, R2, Queue, and Durable Object resources in Cloudflare first, then paste the generated IDs and names below without changing the preset runtime names used by the project.
Secret values should stay only in private local files, CI secrets, or Cloudflare secret storage.
Stripe keeps card data off your infrastructure.EVENTS Gatewaystores billing state, invoices, reminders, and suspension controls while Stripe handles sensitive payment details.
Dashboard Public Env
API Private Env
Tracked Placeholder Map
Private Deployment Values
Wrangler Resource Bindings
GitHub Start

Start from the repository, not from a blank setup.

Clone the project from GitHub, deploy the Workers runtime on Cloudflare, then connect your domain and add the tracker snippet to the target site.

https://github.com/EventsGateway-com/EventsGateway.com
Readiness Checklist
  • GitHub repository cloned or forked into your own account
  • Cloudflare D1, Queues, KV namespaces, R2 ledger bucket, and Durable Object resources created in your own account
  • Wrangler files updated with the real resource IDs and names before deploy
  • Cloudflare Workers deployed for collector, API, and forwarding runtime
  • Collector subdomain mapped on your domain
  • Stripe publishable key, secret key, and webhook secret configured
  • Tracker snippet added to the target site
  • At least one destination configured in the dashboard
  • Live events verified from the production domain