A modern REST API built with Hono.js, Prisma ORM, and PostgreSQL.
- ⚡ 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
- Bun (v1.2.0 or later)
- PostgreSQL (v14 or later)
- Docker (optional, for containerized deployment)
-
Clone the repository:
git clone <repository-url> cd <repository-name>
-
Install dependencies:
bun install
-
Set up environment variables: Create a
.envfile in the root directory with the following content:DATABASE_URL="postgresql://username:password@localhost:5432/your_database_name"Edit
.envwith your database connection string and other configuration.
# 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# Build the project
bun run build
# Deploy migrations and start the server
bun run deploy
# Apply pending migrations
bun run migrate:deployTo run the application in development mode with hot reloading:
bun run dev-
Build the TypeScript code:
bun run build
-
Start the application:
bun run start
-
Build the Docker image:
docker build -t crud-api . -
Run the container:
docker run -p \ 3000:3000 \ -e DATABASE_URL="postgresql://username:password@host:5432/database" \ crud-api
.
├── 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