Quickstart
Prerequisites
Section titled “Prerequisites”- 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
# Clone the repogit clone https://github.com/cozyartz/cutx.gitcd cutx
# Install dependenciesnpm install
# Create environment filecp .dev.vars.example .dev.varsEdit .dev.vars with your secrets:
# RequiredJWT_SECRET=your-256-bit-secret-keySTRIPE_SECRET_KEY=sk_test_...STRIPE_WEBHOOK_SECRET=whsec_...REPLICATE_API_TOKEN=r8_...Database
Section titled “Database”Push the schema to your PostgreSQL instance:
npm run db:pushCloudflare Bindings
Section titled “Cloudflare Bindings”The following bindings are configured in wrangler.toml:
| Binding | Type | Purpose |
|---|---|---|
HYPERDRIVE | Hyperdrive | PostgreSQL connection pooling |
MEDIA | R2 Bucket | Generated media storage |
CACHE | KV Namespace | Rate limiting & session cache |
JOB_QUEUE | Queue | Async job processing |
AI | Workers AI | Copy generation (Llama 3.1 70B) |
# Start development server (Cloudflare bindings available locally)npm run devOpen http://localhost:4321.
Available Scripts
Section titled “Available Scripts”| Script | Description |
|---|---|
npm run dev | Start Astro dev server with Cloudflare bindings |
npm run build | Build for production |
npm run preview | Preview production build locally |
npm run deploy | Build + deploy main app to Cloudflare Pages |
npm run deploy:pipeline | Deploy pipeline worker |
npm run deploy:webhook | Deploy webhook worker |
npm run deploy:all | Deploy all 3 services |
npm run db:push | Push schema to production PostgreSQL |
npm run typecheck | Run TypeScript type checking |
npm test | Run Vitest test suite |
Project Structure
Section titled “Project Structure”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 siteFirst Steps After Setup
Section titled “First Steps After Setup”- Register at
/registerto create your account (25 free credits) - Create a project from the dashboard
- Import a product by pasting a URL — CutX scrapes name, description, price, and images
- Generate — try copy (1 credit), a static ad (3 credits), or a UGC video (40 credits)