Skip to content

A template for building APIs using Hono.js with Prisma ORM, designed for deployment on Cloudflare Workers.

Notifications You must be signed in to change notification settings

pantharshit007/hono-prisma-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hono Prisma Template

A template for building APIs using Hono.js with Prisma ORM, designed for deployment on Cloudflare Workers.

Features

  • 🚀 Hono.js - Fast, Lightweight, Web-standards
  • 🛠 Prisma ORM with PostgreSQL
  • Prisma Accelerate Support
  • 🔒 Environment Variable Validation with Zod
  • 📦 TypeScript Support

Prerequisites

  • Node.js 18+
  • PostgreSQL Database
  • Cloudflare Account (for deployment)

Getting Started

  1. Clone the repository and install dependencies:
npm install
  1. Create a .dev.vars file based on the .dev.vars.example file:
cp .dev.vars.example .dev.vars
  1. Run the database migration and seeding:
npm run db:prisma
npm run db:migrate
npm run db:seed
  1. Start the development server:
npm run dev
  1. Deploy the application to Cloudflare Workers:
npm run db:no-engine
npm run deploy
  1. Visit the deployed application in your browser:
https://<your-subdomain>.workers.dev

Database

The application uses PostgreSQL as the database. You can configure the database connection in the .dev.vars file.

  • DATABASE_URL: The database URL for the production environment which is an accelerated database from Prisma Accelerate.
  • DATABASE_URL_UNPOOLED: This is the database URL for the development environment which is a non-accelerated database.

Environment Variables

The application uses environment variables to configure the database connection. You can configure the database connection in the .dev.vars file.

Deployment

To deploy the application to Cloudflare Workers, you need to have a Cloudflare account and install the Wrangler CLI.

  1. Install the Wrangler CLI:
npm install -g wrangler
  1. Authenticate the Wrangler CLI:
wrangler login
  1. generate prisma client -no-engine
npm run db:no-engine
  1. Deploy the application to Cloudflare Workers:
npm run deploy
  1. Visit the deployed application in your browser:
https://<your-subdomain>.workers.dev

धन्यवाद्

About

A template for building APIs using Hono.js with Prisma ORM, designed for deployment on Cloudflare Workers.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published