Skip to content

finsavvyai/coderail-flow

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

37 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

CodeRail Flow – Cloudflare-first Workflow Automation Platform

πŸŽ‰ Production Ready! A fully functional browser automation platform powered by Cloudflare.

Features

Core Platform

  • βœ… Cloudflare Workers API (Hono) + D1 database + R2 storage
  • βœ… Cloudflare Pages UI (React + Vite)
  • βœ… Real browser automation via Cloudflare Browser Rendering + Puppeteer
  • βœ… Visual overlays (highlights & captions) during execution
  • βœ… Screenshot capture for every step
  • βœ… SRT subtitle generation from narrations
  • βœ… Element locator resolution with fallback chain
  • βœ… Clerk authentication with JWT verification
  • βœ… Lemon Squeezy billing integration

UI Features

  • βœ… Flow Builder - Visual drag-and-drop flow creation
  • βœ… Element Mapper - Click-to-select element picker with auto-locator generation
  • βœ… Project Manager - Organize projects, screens, and elements
  • βœ… Cookie Manager - Auth profiles for protected applications
  • βœ… Live Progress - Real-time step-by-step execution updates
  • βœ… Screenshot Gallery - View and download captured screenshots
  • βœ… Error Display - Detailed error information with retry

Step Types (14 total)

  • Basic: goto, caption, click, fill, highlight, waitFor, pause
  • Advanced: selectRow, assertText, screenshot, scroll, hover, select, setCookies

Documentation: See FEATURES.md for complete feature docs and DEPLOYMENT.md for production setup.

Repo layout

coderail-flow/
β”œβ”€ apps/
β”‚  β”œβ”€ api/                 # Cloudflare Worker (Hono) + D1 + R2
β”‚  β”‚  β”œβ”€ src/
β”‚  β”‚  β”‚  β”œβ”€ runner.ts      # πŸ†• Real execution engine
β”‚  β”‚  β”‚  └─ index.ts       # API routes
β”‚  β”‚  β”œβ”€ migrations/       # D1 SQL migrations
β”‚  β”‚  └─ wrangler.toml     # πŸ†• Browser Rendering configured
β”‚  └─ web/                 # Cloudflare Pages UI (React + Vite)
β”œβ”€ packages/
β”‚  β”œβ”€ dsl/                 # Flow DSL schema + validation (Zod)
β”‚  β”œβ”€ overlay/             # Browser overlay library (built)
β”‚  └─ runner/              # πŸ†• Execution engine (Puppeteer)
β”‚     └─ src/
β”‚        β”œβ”€ executor.ts    # Main flow executor
β”‚        β”œβ”€ locator.ts     # Element resolution
β”‚        β”œβ”€ subtitle.ts    # SRT generation
β”‚        └─ r2.ts          # R2 artifact upload
β”œβ”€ pnpm-workspace.yaml     # πŸ†• Workspace configuration
β”œβ”€ PHASE1_COMPLETE.md      # πŸ†• Implementation summary
└─ QUICKSTART.md           # πŸ†• Quick start guide

Quick Start

See QUICKSTART.md for detailed setup instructions.

Prerequisites

  • Node.js 20+
  • npm i -g pnpm wrangler
  • Cloudflare account (free tier works)

Install

pnpm install
cd packages/overlay && pnpm run build && cd ../..

Setup Cloudflare Resources

wrangler login
wrangler d1 create coderail-flow-db
# Copy database_id to apps/api/wrangler.toml

cd apps/api
pnpm run migrate  # Apply migrations
cd ../..

wrangler r2 bucket create coderail-flow-artifacts  # Optional

Run Locally

# Terminal 1: API
cd apps/api && pnpm run dev

# Terminal 2: Web UI
cd apps/web && pnpm run dev

Open http://localhost:5173 and run the demo flow!

Demo Flow

"Explain a Failed Card Transaction" (13 steps)

  • Navigates through admin dashboard
  • Searches for card ID
  • Highlights error codes
  • Shows explanatory captions
  • Generates SRT subtitles
  • Captures per-step screenshots

Migration 0004_demo_flow.sql creates the full demo with screens, elements, and flow definition.

API Endpoints

  • GET /health - Liveness endpoint with readiness summary
  • GET /health/ready - Readiness endpoint for load balancers / deploy checks
  • GET /flows - List flows
  • POST /runs - Execute flow (real browser automation!)
  • GET /runs - List runs
  • GET /runs/:id - Get run details
  • GET /artifacts/:id/download - Download artifacts
  • POST /projects - Create project
  • POST /screens - Create screen mapping
  • POST /elements - Create element locator

Testing

Unit & Integration Tests (Vitest)

# Run all unit tests
pnpm test

# Run with coverage report
pnpm test:coverage

# Watch mode
pnpm test -- --watch

What's covered (171+ tests):

  • API routes: flows, runs, resources, analytics
  • Security: pii-redaction, encryption, encryption-keys

E2E Tests (Playwright)

The web dev server is automatically started before tests run. The API server is not required β€” API health tests skip gracefully when the API is unreachable.

# Run all E2E tests (headless, starts web server automatically)
pnpm test:e2e

# Run with browser UI visible
pnpm test:e2e:headed

# Interactive Playwright UI
pnpm test:e2e:ui

# Open the HTML report from the last run
pnpm test:e2e:report

E2E test files:

File What it tests
e2e/landing.spec.ts Landing page renders, CTA links, no JS errors
e2e/app.spec.ts /app page β€” app content or Clerk sign-in gate
e2e/auth.spec.ts Protected routes accessible, unknown routes
e2e/projects.spec.ts /projects and /billing pages
e2e/api-health.spec.ts Local API health + security headers (skipped if API not running)
e2e/api-health-auth.spec.ts Production API health + performance (skipped if unreachable)

Auth-protected tests: When VITE_CLERK_PUBLISHABLE_KEY is set, all tests accept either the real app content or Clerk's sign-in gate, making them resilient to unauthenticated state. Set E2E_TEST_EMAIL + E2E_TEST_PASSWORD to run authenticated flows.

Run Everything

pnpm test:all

Production Validation

pnpm run validate:production

βœ… Phase 1 Complete

All core browser automation features are implemented:

  • βœ… Puppeteer integration with Cloudflare Browser Rendering
  • βœ… Locator resolution with fallback chain
  • βœ… Visual overlay injection (highlights + captions)
  • βœ… Per-step screenshot capture
  • βœ… SRT subtitle generation
  • βœ… R2 artifact upload pipeline
  • βœ… All 7 step types: goto, caption, pause, fill, click, waitFor, highlight

Total: ~1,180 lines of production code replacing a 32-line stub.

Next Steps (Phase 2+)

  1. Test End-to-End - Run demo flow against real applications
  2. Mapping Mode - Visual element picker UI
  3. Authentication - Cookie import/export for protected apps
  4. Workflows - Durable execution with Cloudflare Workflows
  5. Video Recording - Full video capture (CDP screencast)
  6. Advanced Steps - selectRow, assertText, screenshot
  7. Flow Builder UI - Visual flow creation interface
  8. RBAC - User management and access control

See PHASE1_COMPLETE.md for detailed implementation notes.

About

Let non-developers create and run Flows (versioned workflows) against any web app.

Resources

License

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors