Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/thanhdaon/hono-showcase

backend template with hono
https://github.com/thanhdaon/hono-showcase

backend drizzle honojs mysql nodejs serverless swagger typescript vercel

Last synced: about 2 months ago
JSON representation

backend template with hono

Awesome Lists containing this project

README

        

# Overview

Overview
This project is a template designed to help you quickly get started with building a backend using the Hono framework. Hono is a lightweight and high-performance web framework that focuses on simplicity and ease of use. This template provides a solid foundation for building RESTful APIs and other backend services.

# Tech stack

- TypeScript
TypeScript is a strongly-typed superset of JavaScript that brings static type definitions to your codebase. By using TypeScript, you gain the benefits of type safety, better code completion, and easier refactoring, all of which lead to a more maintainable and robust application.
- Hono
Hono is a lightweight and high-performance web framework for building backend applications. It focuses on simplicity and speed, making it ideal for developing RESTful APIs and microservices. With its modular design, Hono allows you to extend functionality as needed while keeping the core minimal.
- Hono/Zod-OpenAPI
The @hono/zod-openapi package integrates Zod with OpenAPI, allowing you to define your API schemas using Zod and automatically generate OpenAPI documentation. This ensures that your API is well-documented and that the schema definitions used for validation are consistent with the API documentation. This integration enhances developer productivity by unifying schema validation and API documentation.

- Drizzle ORM
Drizzle ORM is a TypeScript-first Object-Relational Mapping (ORM) tool that simplifies database interactions. It allows you to define your database schema using TypeScript, enabling you to work with database entities as strongly-typed objects. Drizzle ORM is designed to be minimal and easy to integrate with modern web frameworks like Hono.

- Drizzle Kit
Drizzle Kit is a powerful toolkit that complements Drizzle ORM by providing tools for database migrations, schema generation, and other database-related tasks. It ensures that your database schema stays in sync with your application code, streamlining the development process.

- Zod
Zod is a TypeScript-first schema declaration and validation library. It provides a simple and intuitive way to define and validate the structure of your data, ensuring that your application handles inputs and outputs consistently. Zod is highly composable, making it easy to create complex schemas from simpler building blocks.

# Development

## Commands

1. dev: this command starts the development server for a Next.js application. Although your project focuses on using Hono as the backbone framework, it seems that Next.js is also being used, possibly for frontend purposes.

2. build: This command builds the Next.js application for production. It compiles the code, optimizes it, and prepares it for deployment.

3. db:seed: Runs the seed.ts file located in the src/db/ directory using tsx. This script is typically used to populate your database with initial data.

4. db:migrate: Executes database migrations using Drizzle ORM's migration tool. The --config flag points to the configuration file (drizzle.config.ts) that contains the database setup details.

5. db:generate: Generates database schema files or TypeScript types based on your database schema using Drizzle ORM. This helps in keeping your codebase aligned with the database structure.

6. db:studio: Opens the Drizzle Studio, an interface for managing your database, running queries, and performing other database-related tasks interactively.

7. db:push: Pushes the current state of your code to the database, applying migrations or syncing the schema as defined in the configuration file.

## Endpoint

- Document swagger

```
http://localhost:3000/api/docs
```