How kriasoft/react-starter-kit works
React Starter Kit is a full-stack SaaS starter: a user enters the React app through the edge-routed web worker, uses authentication and organization/billing capabilities, and reaches API-backed results. The API worker constructs request context and mounts Hono/tRPC plus Better Auth; Drizzle schemas define persistent domain state. The README documents independently deployed web, app, and API Workers with service bindings. Authentication, billing, email, marketing, UI primitives, and the standalone WebSocket protocol are preserved as meaningful branches. Some app-to-API and database runtime wiring is not shown in the excerpts, so those links are left unverified.
Main entry points: app.ts Hono and tRPC routes · worker.ts API Worker · auth-form.tsx Auth form · auth.ts Authentication and orgs
Components 22
Edge entrypoints
- Marketing edge router
apps/web/worker.ts
React application
- React SPA
apps/app/index.tsx - App routes
apps/app/routes/(app)/route.tsx - Auth form
apps/app/components/auth/auth-form.tsx - OTP verification UI
apps/app/components/auth/otp-verification.tsx - Typed API queries
apps/app/lib/queries/config.ts
API services
- API Worker
apps/api/worker.ts - Hono and tRPC routes
apps/api/lib/app.ts - Request context
apps/api/lib/context.ts - Authentication and orgs
apps/api/lib/auth.ts - Billing procedures
apps/api/routers/billing.ts - Config procedures
apps/api/routers/config.ts - Email delivery
apps/api/lib/email.ts
Persistence and messaging
- Database clients
apps/api/lib/db.ts - Domain schema
db/schema/organization.ts - PostgreSQL
Shared capabilities
- Email templates
apps/email/templates/otp-email.tsx - WebSocket routing
packages/ws-protocol/router.ts - Typed messages
packages/ws-protocol/messages.ts - UI primitives
packages/ui/components/dialog.tsx
Other components
- User
- Stripe
Connections 25
- User → Marketing edge router: requests site
- Marketing edge router → React SPA: routes app traffic
- Marketing edge router → API Worker: proxies API traffic
- User → React SPA: uses application
- React SPA → App routes: renders routes
- App routes → Auth form: offers sign-in
- Auth form → OTP verification UI: renders OTP step
apps/app/components/auth/auth-form.tsx - Auth form → UI primitives: uses controls
apps/app/components/auth/auth-form.tsx - Auth form → Typed API queries: loads providers
apps/app/components/auth/auth-form.tsx - Typed API queries → Hono and tRPC routes: queries API
- API Worker → Database clients: creates clients
apps/api/worker.ts - API Worker → Authentication and orgs: creates auth
apps/api/worker.ts - API Worker → Hono and tRPC routes: mounts app
apps/api/worker.ts - API Worker → Request context: sets request state
apps/api/worker.ts - Hono and tRPC routes → Request context: builds tRPC context
apps/api/lib/app.ts - Hono and tRPC routes → Billing procedures: registers router
apps/api/lib/app.ts - Hono and tRPC routes → Config procedures: registers router
apps/api/lib/app.ts - Hono and tRPC routes → Authentication and orgs: handles auth requests
apps/api/lib/app.ts - Authentication and orgs → Email delivery: sends OTP and mail
apps/api/lib/auth.ts - Email delivery → Email templates: renders templates
apps/api/lib/email.ts - Authentication and orgs → Stripe: configures subscriptions
apps/api/lib/auth.ts - Billing procedures → Stripe: uses billing provider
- Database clients → Domain schema: uses schema
- Domain schema → PostgreSQL: persists domain data
- WebSocket routing → Typed messages: registers handlers
packages/ws-protocol/router.ts