Clone the Template
Clone the template without git history using degit:This creates a fresh copy of the starter template without the original repository’s commit history.
Install Dependencies
Install the required packages using pnpm:
This template uses pnpm, but you can also use npm or yarn. The project includes all necessary dependencies including Hono, Drizzle ORM, Zod, and OpenAPI tooling.
Configure Environment
Create your environment configuration file:The default
.env file contains:.env
Environment Variables Explained
Environment Variables Explained
NODE_ENV- Runtime environment (development, production, test)PORT- Server port number (default: 9999)LOG_LEVEL- Logging verbosity (fatal, error, warn, info, debug, trace, silent)DATABASE_URL- SQLite database file path or Turso URLDATABASE_AUTH_TOKEN- Required for production when using Turso (optional in development)
Initialize the Database
Create the SQLite database and push the schema:This creates a
dev.db file in your project root with the tasks table schema:src/db/schema.ts
Start the Development Server
Run the development server with hot reload:You should see output indicating the server is running:The dev server uses
tsx watch for automatic reloading when you make changes to your code.Explore the API Documentation
Open your browser and navigate to the interactive API documentation:This displays a beautiful Scalar API reference powered by your OpenAPI specification. You can:
- Browse all available endpoints
- View request/response schemas
- Test API calls directly from the browser
- See example requests in multiple languages
The OpenAPI spec is also available in JSON format at
http://localhost:9999/docMake Your First API Call
Test the API by creating a task. Choose your preferred method:Expected response:
- cURL
- JavaScript (Fetch)
- Hono Client (Type-safe)
Available Endpoints
| Method | Path | Description |
|---|---|---|
| GET | / | API index |
| GET | /doc | OpenAPI specification (JSON) |
| GET | /reference | Interactive API documentation |
| GET | /tasks | List all tasks |
| POST | /tasks | Create a new task |
| GET | /tasks/{id} | Get a task by ID |
| PATCH | /tasks/{id} | Update a task |
| DELETE | /tasks/{id} | Delete a task |
Next Steps
Project Architecture
Learn about the codebase organization and key files
Creating Routes
Build your own OpenAPI routes with full type safety
Database Schema
Work with Drizzle ORM and define your data models
Deployment
Deploy your API to production environments
