Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CRUD API with Hono and Prisma generated by TryBase.app

A modern REST API built with Hono.js, Prisma ORM, and PostgreSQL.

Features

  • High Performance: Built with Hono.js for blazing fast API responses
  • 🛡️ Type Safety: Full-stack type safety with TypeScript and Prisma
  • Data Validation: Secure input validation with Zod
  • 🗄️ Database Ready: PostgreSQL integration with automated migrations
  • 🚀 Modern Stack: Bun runtime for optimal performance
  • 🐳 Easy Deployment: Docker support for hassle-free deployment

Prerequisites

  • Bun (v1.2.0 or later)
  • PostgreSQL (v14 or later)
  • Docker (optional, for containerized deployment)

Setup

  1. Clone the repository:

    git clone <repository-url>
    cd <repository-name>
  2. Install dependencies:

    bun install
  3. Set up environment variables: Create a .env file in the root directory with the following content:

    DATABASE_URL="postgresql://username:password@localhost:5432/your_database_name"

    Edit .env with your database connection string and other configuration.

Available Scripts

Development

# Start development server with hot reload
bun run dev

# Create a new migration
bun run migrate:dev

# Check migration status
bun run migrate:status

# Reset database (development only)
bun run migrate:reset

Production

# Build the project
bun run build

# Deploy migrations and start the server
bun run deploy

# Apply pending migrations
bun run migrate:deploy

Running the Application

Development Mode

To run the application in development mode with hot reloading:

bun run dev

Production Mode

  1. Build the TypeScript code:

    bun run build
  2. Start the application:

    bun run start

Using Docker

  1. Build the Docker image:

    docker build -t crud-api .
  2. Run the container:

    docker run -p \
       3000:3000 \
       -e DATABASE_URL="postgresql://username:password@host:5432/database" \
       crud-api

Project Structure

.
├── api/            # API route handlers
├── prisma/         # Database schema and migrations
├── app.ts          # Main application entry point
├── Dockerfile      # The dockerfile
├── package.json    # Project dependencies and scripts
└── tsconfig.json   # TypeScript configuration

About

Demo

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages