https://github.com/syahrulbhudif/hono-starter-code
Starter code for RESTful API with hono framework, JWT Access/Refresh Token, Oauth (Google), OTP Email, Redis Caching
https://github.com/syahrulbhudif/hono-starter-code
docker drizzle-orm hono jwt postgresql redis starter-code template typescript
Last synced: 3 months ago
JSON representation
Starter code for RESTful API with hono framework, JWT Access/Refresh Token, Oauth (Google), OTP Email, Redis Caching
- Host: GitHub
- URL: https://github.com/syahrulbhudif/hono-starter-code
- Owner: SyahrulBhudiF
- Created: 2025-01-28T13:30:49.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2025-10-14T09:25:09.000Z (8 months ago)
- Last Synced: 2025-12-24T10:17:52.198Z (5 months ago)
- Topics: docker, drizzle-orm, hono, jwt, postgresql, redis, starter-code, template, typescript
- Language: TypeScript
- Homepage:
- Size: 200 KB
- Stars: 34
- Watchers: 1
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
Awesome Lists containing this project
README
# 🚀 Hono RestAPI Starter Kit
A modern, production-ready API starter kit built with cutting-edge technologies for rapid development and scalable
performance.
## ✨ Features
- **🔥 [Hono](https://hono.dev/)** - Ultra-fast web framework for the edge
- **🔐 Authentication & Authorization**
- JWT token-based authentication
- OAuth2 integration (Google)
- Email OTP verification
- **📊 Database Integration**
- [Drizzle ORM](https://orm.drizzle.team/) - Type-safe SQL query builder
- PostgreSQL - Reliable, open-source relational database
- **🗄️ Caching**
- Redis for high-performance caching and session management
- **🐳 DevOps Ready**
- Docker & Docker Compose for containerization
- **📝 API Documentation**
- Auto-generated OpenAPI documentation
- Interactive SwaggerUI interface
## 🛠️ Tech Stack
| Category | Technologies |
|----------------------|------------------------------------------------------|
| **Framework** | [Hono](https://hono.dev/) |
| **Authentication** | JWT, OAuth2, Email OTP |
| **Database** | PostgreSQL, [Drizzle ORM](https://orm.drizzle.team/) |
| **Caching** | Redis |
| **Containerization** | Docker |
| **Package Manager** | [Bun](https://bun.sh/) |
| **Documentation** | OpenAPI, SwaggerUI |
## 🚀 Getting Started
### Prerequisites
- [Bun](https://bun.sh/) (1.0.0 or later)
- [Docker](https://www.docker.com/) & [Docker Compose](https://docs.docker.com/compose/)
### Installation
1. Clone the repository
```bash
git clone https://github.com/SyahrulBhudiF/Hono-Starter-Code
cd Hono-Starter-Code
```
2. Install dependencies
```bash
bun install
```
3. Set up environment variables
```bash
cp .env.example .env
# Edit .env with your configuration
```
## 🏃♂️ Running the Application
### Development Mode
Start the application and all required services (PostgreSQL, Redis) using Docker:
```bash
docker compose build
docker compose up
```
This will launch the development environment with hot reloading enabled.
### Production Mode
For production deployment, use the same Docker Compose setup with minor configuration adjustments at Dockerfile and
docker-compose.yml.
```bash
# Run in production mode
docker compose build --no-cache
docker compose up
```
## 📖 API Documentation
Once the application is running, you can access the API documentation at:
- **OpenAPI Documentation**: [http://localhost:3000/doc](http://localhost:3000/doc)
- **Swagger UI**: [http://localhost:3000/ui](http://localhost:3000/ui)
## 📁 Project Structure
```
📦 ROOT
├── 📂 drizzle/ # 🔄 Drizzle ORM migration
├── 📂 src/
│ ├── 📂 config/ # ⚙️ Configuration files
│ ├── 📂 controllers/ # 🎮 Request handlers
│ ├── 📂 middleware/ # 🔌 Custom middleware
│ ├── 📂 models/ # 📊 Database models
│ ├── 📂 routes/ # 🛣️ API routes and Swagger documentation
│ ├── 📂 services/ # 🧩 Business logic
│ ├── 📂 types/ # 📝 Type definitions and Repository abstraction
│ ├── 📂 utils/ # 🔧 Utility functions
│ ├── 📂 validation/ # ✅ Request validation schemas
│ ├── 📄 index.ts # 🚀 App entry point
│ └── 📄 worker.ts # 👷 Worker entry point
├── 📄 .env.example # 🔐 Environment variables example
├── 📄 compose.yml # 🐳 Docker Compose configuration
├── 📄 Dockerfile # 📦 Docker configuration
├── 📄 drizzle.config.ts # 🗃️ Drizzle ORM configuration
└── 📄 package.json # 📋 Dependencies and scripts
```
## 🤝 Contributing
Contributions, issues, and feature requests are welcome! See [CONTRIBUTING.md](CONTRIBUTING.md) for more information.