Introduction
The ZeroStarter API is built with Hono, a lightweight, ultrafast web framework for the edge. It provides a modern REST API with full TypeScript support and automatic OpenAPI documentation generation.Base URL
The API is available at:Type-Safe RPC Client
ZeroStarter leverages Hono’s RPC client for end-to-end type safety between your API and frontend. The client is automatically typed based on your API routes, providing full IntelliSense and compile-time error checking.Client Setup
The API client is pre-configured in your Next.js application:web/next/src/lib/api/client.ts
Usage Example
Interactive API Documentation
ZeroStarter includes interactive API documentation powered by Scalar:API Documentation
Access the interactive API documentation at
/api/docs- All available endpoints
- Request/response schemas
- Type-safe code examples using
hono/client - Interactive request testing
OpenAPI Specification
The OpenAPI specification is available at:API Structure
The API is organized into the following sections:System
Health check and system status endpoints
Authentication
Better Auth endpoints for authentication flows
Session
Retrieve current session information
User
Get current authenticated user data
Response Format
All API responses follow a consistent format:Success Response
Error Response
CORS Configuration
The API includes CORS middleware with the following configuration:- Allowed Origins: Configured via
HONO_TRUSTED_ORIGINSenvironment variable - Allowed Headers:
content-type,authorization - Allowed Methods:
GET,OPTIONS,POST,PUT - Credentials: Enabled for cookie-based authentication
- Max Age: 600 seconds
Rate Limiting
All API endpoints are protected by rate limiting middleware to prevent abuse. Rate limits are applied per IP address.Authentication
Protected endpoints (under/api/v1/*) require authentication. ZeroStarter uses Better Auth for authentication, which handles:
- Session management
- Social OAuth (GitHub, Google)
- Email/password authentication
- Organization and team management
credentials: "include" for automatic cookie handling.
Next Steps
Health Check
Learn about the health endpoint
Authentication
Explore authentication endpoints
Session API
Get session information
User API
Access user data