Deployment Matrix

A guide to initializing your node

Deployment Matrix

Deploying Gins-Blog requires an active Cloudflare account and Wrangler CLI configured on your local machine.

Prerequisites

Ensure you have the following installed:

  • Node.js >= 24.0.0
  • npm or pnpm
  • Cloudflare Wrangler (npm i -g wrangler)

[!IMPORTANT] You must run wrangler login and authenticate your terminal against your Cloudflare organization before proceeding.

Step 1: Resource Provisioning

The project relies on specific Cloudflare bindings. You must create these resources prior to pushing code.

# 1. Create the serverless database
wrangler d1 create gins-db

# 2. Create the Key-Value store for session caching
wrangler kv:namespace create SESSION

# 3. Create the Vectorize index for AI search
wrangler vectorize create gins-vectors --dimensions=384 --metric=cosine

Update your wrangler.jsonc file with the IDs generated by the commands above.

Step 2: Database Migration

Before the application can read/write data, the schema must be pushed to D1.

# Push schema locally for development
npm run db:push

# Push schema to production D1
wrangler d1 execute gins-db --file=./db/migrations/0000_schema.sql --remote

Step 3: Ignition

Once the database is primed and the bindings are set, you can deploy the application globally.

Keep the two Cloudflare tokens separate:

  • CLOUDFLARE_API_TOKEN for CI or manual deploys with Workers permissions
  • CLOUDFLARE_MEDIA_API_TOKEN for runtime Images/Stream uploads inside the blog Worker

The media token is optional. Only configure it if you separately purchased Cloudflare Images and Stream for this blog.

npm run deploy

The application will be distributed across the edge network in a matter of seconds. The terminal will output your .workers.dev domain, which you can later map to a custom domain in your Cloudflare Dash.

System Record: deployment
Edit Page