Skip to content

Quickstart

  • Node.js 20+
  • Wrangler CLI (npx wrangler — no global install needed)
  • PostgreSQL database (local or remote)
  • Cloudflare account with Workers, R2, KV, and Queues enabled
Terminal window
# Clone the repo
git clone https://github.com/cozyartz/cutx.git
cd cutx
# Install dependencies
npm install
# Create environment file
cp .dev.vars.example .dev.vars

Edit .dev.vars with your secrets:

# Required
JWT_SECRET=your-256-bit-secret-key
STRIPE_SECRET_KEY=sk_test_...
STRIPE_WEBHOOK_SECRET=whsec_...
REPLICATE_API_TOKEN=r8_...

Push the schema to your PostgreSQL instance:

Terminal window
npm run db:push

The following bindings are configured in wrangler.toml:

BindingTypePurpose
HYPERDRIVEHyperdrivePostgreSQL connection pooling
MEDIAR2 BucketGenerated media storage
CACHEKV NamespaceRate limiting & session cache
JOB_QUEUEQueueAsync job processing
AIWorkers AICopy generation (Llama 3.1 70B)
Terminal window
# Start development server (Cloudflare bindings available locally)
npm run dev

Open http://localhost:4321.

ScriptDescription
npm run devStart Astro dev server with Cloudflare bindings
npm run buildBuild for production
npm run previewPreview production build locally
npm run deployBuild + deploy main app to Cloudflare Pages
npm run deploy:pipelineDeploy pipeline worker
npm run deploy:webhookDeploy webhook worker
npm run deploy:allDeploy all 3 services
npm run db:pushPush schema to production PostgreSQL
npm run typecheckRun TypeScript type checking
npm testRun Vitest test suite
cutx/
├── src/
│ ├── pages/
│ │ ├── index.astro # Landing page
│ │ ├── dashboard/ # Dashboard UI
│ │ ├── studio/ # Creative studio
│ │ └── api/ # All API routes
│ ├── lib/
│ │ ├── db.ts # PostgreSQL via Hyperdrive
│ │ ├── auth.ts # JWT + password hashing
│ │ ├── jobs.ts # Job orchestrator + state machine
│ │ ├── ai/ # Prompt templates + AI clients
│ │ ├── payments/ # Credits + Stripe billing
│ │ └── campaigns/ # Ad platform adapters
│ ├── layouts/ # Astro layouts
│ ├── components/ # React islands
│ ├── styles/ # Tailwind + global CSS
│ └── types/ # TypeScript interfaces
├── workers/
│ ├── pipeline/ # Queue consumer (job processing)
│ └── webhook/ # Replicate + Stripe callbacks
├── database/
│ └── schema.sql # Full PostgreSQL schema
├── extension/ # Chrome Extension
├── wrangler.toml # Main app config
└── docs/ # This documentation site
  1. Register at /register to create your account (25 free credits)
  2. Create a project from the dashboard
  3. Import a product by pasting a URL — CutX scrapes name, description, price, and images
  4. Generate — try copy (1 credit), a static ad (3 credits), or a UGC video (40 credits)