Deployment
Cloudflare Workers and D1 database deployment configuration
Workers
Not Deployed
Ready for configuration
D1 Database
Not Configured
Awaiting setup
Frontend
Local Development
Next.js ready
Deployment Steps
Step-by-step guide for Cloudflare deployment
1
Cloudflare Workers Setup
pending
Configure wrangler.toml and worker scripts
Install Wrangler CLI
Configure wrangler.toml
Set up worker scripts
2
D1 Database Migration
pending
Set up D1 database with Drizzle ORM
Create D1 database
Run migrations
Configure connection
3
Environment Configuration
pending
Set up environment variables and secrets
Add API keys
Configure database URL
Set up CORS
4
Deploy Application
pending
Deploy to Cloudflare Workers and Pages
Deploy workers
Deploy frontend
Test endpoints
wrangler.toml
Cloudflare Workers configuration
name = "power-flow-workers"
main = "src/index.ts"
compatibility_date = "2024-01-01"
[env.production]
name = "power-flow-production"
[[env.production.d1_databases]]
binding = "DB"
database_name = "power-flow-db"
database_id = "your-d1-database-id"
[vars]
ENVIRONMENT = "production"
# Add your secrets with: wrangler secret put ABACUSAI_API_KEYDrizzle Schema
D1 database schema definition
import { sqliteTable, text, integer } from 'drizzle-orm/sqlite-core';
export const workflows = sqliteTable('workflows', {
id: text('id').primaryKey(),
name: text('name').notNull(),
description: text('description'),
config: text('config', { mode: 'json' }),
createdAt: integer('created_at', { mode: 'timestamp' }),
updatedAt: integer('updated_at', { mode: 'timestamp' }),
});
export const workflowComponents = sqliteTable('workflow_components', {
id: text('id').primaryKey(),
workflowId: text('workflow_id').references(() => workflows.id),
nodeId: text('node_id').notNull(),
type: text('type').notNull(),
position: text('position', { mode: 'json' }),
data: text('data', { mode: 'json' }),
createdAt: integer('created_at', { mode: 'timestamp' }),
updatedAt: integer('updated_at', { mode: 'timestamp' }),
});Quick Actions
Common deployment commands and operations
Install Wrangler CLI
npm install -g wranglerCreate D1 Database
wrangler d1 create power-flow-dbDeploy Worker
wrangler deploy