This is a lightweight, high-performance Api built with Bun
and Hono
, leveraging Mongoose
for MongoDB interactions, bcryptjs
for password hashing, and Zod
for validation.
Ensure you have Bun
installed, then run:
bun install
Rename, .env.sample
file to .env
and define required variables:
IMAGEKIT_PUBLIC_KEY=""
IMAGEKIT_PRIVATE_KEY=""
IMAGEKIT_URL_ENDPOINT=""
MONGODB_URI=""
ACCESS_SECRET=""
ACCESS_EXPIRY=""
REFRESH_SECRET=""
REFRESH_EXPIRY=""
PORT=""
CORS_ORIGIN=""
BODY_LIMIT=""
NODE_ENV=""
Note: BODY_LIMIT
is in MB & NODE_ENV
should be development or production.
bun run dev
bun run start
.
├── src/
│ ├── index.ts # Entry point
│ ├── app.ts # Hono app config
│ ├── routes/ # API routes
│ ├── models/ # Mongoose models
│ ├── middleware/ # Custom middlewares
│ ├── utils/ # Utility functions
│ ├── helpers/ # Helper functions
│
├── bun.lockb # Lockfile
├── package.json # Project metadata
└── README.md # Documentation
This project was created using bun init
in bun v1.2.1. Bun is a fast all-in-one JavaScript runtime.