@g-1/core
v2.0.0
Published
G1 Studio API Framework - A plugin-first, high-performance TypeScript API framework built on Hono for Cloudflare Workers
Maintainers
Readme
G1 Core API
The G1 API Core - A high-performance, enterprise TypeScript API boilerplate built for maximum scale and security. Powered by Hono, Cloudflare Workers, D1, and Better Auth. The foundation for your next profitable venture.
🚀 Quick Start
# 1. Install dependencies
bun install
# 2. Start development server
bun run dev # http://localhost:8787
# 3. Run tests
bun run test
# 4. Check types and linting
bun run typecheck && bun run lint⭐ Key Features
- 🚀 Cloudflare Workers + Hono - Lightning-fast edge API with optimized middleware stack
- 🔐 Better Auth - Enterprise auth with anonymous login, email/password, OTP, multi-org support
- 🗄️ Drizzle ORM + D1 - Type-safe database layer with automated migrations
- 📚 OpenAPI Documentation - Auto-generated docs with Scalar UI and Zod validation
- 🧪 Enterprise Testing - Vitest with Workers test pool, isolated environments
- 🛡️ Security First - Rate limiting, CORS, security headers, input validation
- 📦 Production Ready - Battle-tested patterns and enterprise architecture
Quickstart
bun install
bun run dev # http://localhost:8787
# in another tab
bun run test # runs vitest in workers pool
bun run typecheck # tsc --noEmit
bun run lint # eslint🏗️ Architecture Overview
┌──────────────────────────────────────────────────────────────────┐
│ 🚀 Cloudflare Workers API (Hono Framework) │
│ │
│ 🛡️ Middleware Stack: │
│ ├─ favicon → health → env → ctx → security → │
│ │ validation → CORS → rate-limit → logging → auth → session │
│ │
│ 📁 API Routes: │
│ ├─ /, /protected, /api/auth/*, /v1/* │
│ ├─ /v1/early-access-requests, /v1/auth-docs │
│ └─ Error handling & not-found │
│ │
│ 🔐 Authentication: Better Auth (Cloudflare adapter) │
│ ├─ DB: D1 via Drizzle (users, sessions, accounts, orgs) │
│ └─ KV: High-performance session management │
│ │
│ 🗄️ Data Layer: Drizzle ORM → Cloudflare D1 (SQLite) │
└──────────────────────────────────────────────────────────────────┘📚 Documentation
Core Documentation
- ARCHITECTURE.md - Detailed system architecture and design patterns
- TESTING.md - Testing helpers, patterns, and best practices
- CHANGELOG.md - Version history and release notes
Development Guides
- src/db/README.md - Database structure and migration guides
- scripts/README.md - Development scripts and automation tools
Quick Navigation
- Getting Started: You're reading it! (README.md)
- API Documentation: Visit
/docwhen running locally - Database Schema: Check
src/db/tables/for table definitions - Environment Setup: See
.env.exampleandwrangler.jsonc
Tests
- Uses Vitest with
@cloudflare/vitest-pool-workers - Cookie-aware helpers live in
test/utils.ts(see TESTING.md) - Migrations applied automatically during test setup
