A production-ready Test Case Management System built with Hono, Cloudflare Workers, and D1.
- Dashboard: Overview with charts and statistics
- Test Plan: Organize test cases in folders, CRUD operations
- Test Run: Create test suites and execute tests
- Reports: Analytics and insights
- Authentication: JWT-based auth with secure password hashing
- Guest Mode: View-only access without login
Why we chose it:
- Global Edge Deployment: Code runs in 300+ data centers worldwide, ensuring ultra-low latency (<50ms) for users regardless of location
- Zero Cold Starts: Unlike traditional serverless (AWS Lambda), Workers have near-instant startup times (~0ms cold start)
- Cost Effective: Pay only for compute time with generous free tier (100,000 requests/day free)
- Built-in Security: Automatic DDoS protection, SSL/TLS, and isolated V8 execution environment
- Simplified DevOps: No server management, auto-scaling, or infrastructure maintenance required
- Edge Caching: Built-in Cache API for caching responses at the edge, reducing Worker invocations
Why we chose it:
- Ultralight & Fast: Only 14KB in size, designed specifically for edge runtimes with exceptional performance
- Edge-First Design: Built from the ground up for Cloudflare Workers, Deno, and Bun
- Familiar API: Express-like routing syntax makes migration and onboarding seamless
- Built-in JSX Support: Server-side rendering with JSX without needing React, reducing bundle size
- TypeScript Native: First-class TypeScript support with excellent type inference
- Middleware Ecosystem: Rich set of built-in middleware for auth, CORS, compression, and more
Why we chose it:
- Edge-Native SQL: SQLite database that runs at the edge, co-located with Workers for minimal latency
- Zero Configuration: No connection strings, connection pooling, or database server management
- Familiar SQL: Full SQLite compatibility means standard SQL queries and easy migration
- Cost Efficient: Generous free tier with pay-as-you-go pricing for production workloads
- Automatic Backups: Built-in point-in-time recovery and disaster protection
- Global Replication: Data automatically replicated for high availability
Why we chose it:
- Type-Safe Queries: Full TypeScript inference from schema to query results prevents runtime errors
- SQL-Like Syntax: Queries read like SQL, making debugging and optimization intuitive
- Lightweight: No heavy runtime dependencies, perfect for edge environments with size constraints
- D1 Integration: First-class Cloudflare D1 support with optimized drivers
- Schema Migrations: Built-in migration system with SQL file generation for version control
- Zero Overhead: Generates optimal SQL without N+1 query problems
Why we chose it:
- Utility-First: Rapid UI development without context-switching to separate CSS files
- Production Optimized: PurgeCSS removes unused styles, resulting in tiny CSS bundles (~10KB)
- Consistent Design System: Built-in spacing, color, and typography scales ensure visual consistency
- Responsive by Default: Mobile-first breakpoints (
sm:,md:,lg:) built into every utility - No CSS Conflicts: Scoped utilities eliminate specificity wars and cascade issues
- IDE Support: Excellent IntelliSense with autocomplete for all utilities
Why we chose it:
- No Build Step Required: Both libraries work via CDN with zero compilation needed
- HTML-Centric: Enhances HTML with attributes rather than replacing it with JavaScript frameworks
- Minimal JavaScript: Achieve SPA-like experiences with 90% less client-side JavaScript
- HTMX for AJAX: Declarative HTTP requests (
hx-get,hx-post) for dynamic content loading - Alpine.js for State: Lightweight reactivity (
x-data,x-show,x-on) for UI interactions - Progressive Enhancement: Works without JavaScript, enhanced experience when available
- Tiny Footprint: Combined ~25KB vs React (~45KB) + React-DOM (~120KB)
Why we chose it:
- Canvas-Based Rendering: Smooth animations and high performance with HTML5 Canvas
- Responsive by Default: Charts automatically resize to container dimensions
- 8 Chart Types: Bar, line, pie, doughnut, radar, polar, bubble, and scatter charts included
- Highly Customizable: Extensive configuration options for colors, fonts, tooltips, and legends
- Active Community: Well-maintained with extensive documentation and plugins ecosystem
- Accessibility: Built-in ARIA support for screen readers and keyboard navigation
- Node.js 18+
- Wrangler CLI (
npm install -g wrangler) - Cloudflare account
npm install# Create the database
wrangler d1 create testcase-pro-db
# Update wrangler.toml with the database_id from the output# Local development
wrangler d1 execute testcase-pro-db --local --file=./drizzle/0000_init.sql
# Production
wrangler d1 execute testcase-pro-db --file=./drizzle/0000_init.sqlnpm run css:buildnpm run devThe app will be available at http://localhost:8787
# Build CSS first
npm run css:build
# Deploy
npm run deploySet these in your Cloudflare dashboard or wrangler.toml:
JWT_SECRET: Secret key for JWT tokens (change in production!)
edge/
├── src/
│ ├── index.ts # Main Hono app
│ ├── types.ts # TypeScript types
│ ├── db/
│ │ ├── schema.ts # Drizzle schema
│ │ └── index.ts # D1 connection
│ ├── lib/
│ │ ├── auth.ts # JWT & password utilities
│ │ └── utils.ts # Helper functions
│ ├── middleware/
│ │ └── auth.ts # Auth middleware
│ ├── routes/
│ │ ├── api/ # API routes
│ │ │ ├── auth.ts
│ │ │ ├── folders.ts
│ │ │ ├── test-cases.ts
│ │ │ ├── tags.ts
│ │ │ ├── test-suites.ts
│ │ │ ├── test-runs.ts
│ │ │ └── dashboard.ts
│ │ └── pages/ # Page routes (SSR)
│ │ ├── index.ts
│ │ ├── dashboard.tsx
│ │ ├── test-plan.tsx
│ │ ├── test-run.tsx
│ │ ├── reports.tsx
│ │ └── auth.tsx
│ ├── components/ # Hono JSX components
│ │ ├── Layout.tsx
│ │ ├── Card.tsx
│ │ ├── Button.tsx
│ │ └── ...
│ ├── styles/
│ │ └── input.css # Tailwind input
│ └── static/
│ └── styles.css # Built CSS (generated)
├── drizzle/
│ └── 0000_init.sql # Database migrations
├── wrangler.toml # Cloudflare config
├── tailwind.config.ts
├── tsconfig.json
└── package.json
This application implements aggressive edge caching to minimize Cloudflare Workers requests and reduce costs.
| Resource Type | TTL | Strategy |
|---|---|---|
| Static Assets (CSS) | 1 year | Immutable, fingerprinted |
| CDN Libraries (JS) | 1 year | Immutable, versioned |
| Dashboard Stats API | 5 min | Stale-while-revalidate |
| List APIs (folders, test cases) | 2 min | Stale-while-revalidate |
| Individual Item APIs | 1 min | Stale-while-revalidate |
-
Static Assets: CSS and other static files are served with
Cache-Control: public, max-age=31536000, immutableheaders. The browser and edge cache them indefinitely. -
API Responses: GET requests to API endpoints include
Cache-Controlheaders with appropriate TTLs. The Cloudflare edge caches these responses and serves them without invoking the Worker. -
Stale-While-Revalidate: API responses use
stale-while-revalidateto serve cached content immediately while refreshing in the background. -
ETag Support: ETags are generated for responses, enabling conditional requests (304 Not Modified) that save bandwidth.
-
Cache Invalidation: POST/PUT/DELETE requests bypass the cache, and related cache entries are purged on mutations.
- 70-90% reduction in Worker requests for typical usage patterns
- Faster response times (0ms from edge cache vs 50-200ms from Worker)
- Lower costs (fewer Worker invocations = lower billing)
- Better reliability (cached responses available even during Worker issues)
Note: The Cloudflare Cache API works differently in local development (wrangler dev). To fully test caching behavior, deploy to Cloudflare Workers staging environment.
POST /api/auth/signup- Create accountPOST /api/auth/signin- Sign inPOST /api/auth/signout- Sign outGET /api/auth/session- Get current session
GET /api/folders- List all foldersPOST /api/folders- Create folderPUT /api/folders/:id- Update folderDELETE /api/folders/:id- Delete folder
GET /api/test-cases- List test casesGET /api/test-cases/:id- Get test casePOST /api/test-cases- Create test casePUT /api/test-cases/:id- Update test caseDELETE /api/test-cases/:id- Delete test caseGET /api/test-cases/export- Export as CSVPOST /api/test-cases/import- Import from CSVDELETE /api/test-cases/bulk-delete- Bulk delete
GET /api/test-suites- List test suitesGET /api/test-suites/:id- Get test suite with entriesPOST /api/test-suites- Create test suiteDELETE /api/test-suites/:id- Delete test suite
GET /api/test-runs/:id- Get test run entryPUT /api/test-runs/:id- Update test run entry
GET /api/dashboard/stats- Get dashboard statistics
MIT