How goktugcy/hono-boilerplate works
Main Components
a) Client Layer:
• External clients/applications that consume the API
• HTTP/HTTPS requests coming in
b) Cloudflare Workers Layer:
• Main application container
• Hono framework as the core HTTP handling framework
• Following internal components:
• Routes Handler (from routes.ts)
• Authentication Middleware
• Controllers (Auth and Country)
c) Supabase Layer:
• Two distinct Supabase clients:
• Supabase Anon Client (public operations)
• Supabase Service Client (privileged operations)
• Supabase Auth Service
• Supabase Database
Component Relationships
• Client → Cloudflare Workers (HTTP requests)
• Routes → Controllers
• Controllers → Supabase Clients
• Auth Middleware → Supabase Auth Service
• Supabase Clients → Supabase Services
Authentication Flow
• Token extraction from cookies
• Token verification process
• Token refresh flow
• Cookie setting mechanism
Specific Implementation Details
a) Controllers:
• AuthController
• CountryController
b) Middleware:
• authMiddleware
c) Database Clients:
• supabaseAnon
• supabaseService
Environment Configuration
A small section showing the configuration dependencies:
• SUPABASE_URL
• SUPABASE_SERVICE_KEY
• SUPABASE_ANON_KEY
• STAGE (dev/prod)
Response handling
• Keep components well-spaced and aligned
• Use consistent sizing for similar components
• Brief descriptions for key processes
• Version/environment indicators