crstnmac / tanstack-router-hono-drizzle-template

Tanstack Router, Drizzle and Hono production template
16 stars 0 forks source link

Bun Project

This project uses Bun as the JavaScript runtime for server-side development. It also includes support for process management with PM2 in production environments.

Prerequisites

Scripts

The project includes the following Bun scripts in package.json:

start

Starts the server using Bun.

bun start

dev

Starts the server in watch mode for development. This will automatically restart the server whenever changes are detected in server/index.ts.

bun dev

prod

Starts the server in production using PM2. It runs Bun as the interpreter via PM2, ensuring that the server process is automatically restarted if it crashes.

bun prod

kill

Stops the PM2-managed process for server/index.ts. Use this to clean up running instances of the server.

bun kill

Running the Project

Development Mode

To start the server in development mode with automatic reloading:

bun run dev

Production Mode

To start the server in production mode with PM2:

bun run prod

To stop the server in production mode:

bun run kill

Additional Notes

Bun is used as the runtime for both development and production. PM2 is used to manage the production server, ensuring high availability with process monitoring and automatic restarts.