This project uses Bun as the JavaScript runtime for server-side development. It also includes support for process management with PM2 in production environments.
Install Bun by running:
curl https://bun.sh/install | bash
Install PM2 for process management:
npm install pm2 -g
Create the .env
file by copying the variables from .env.example
file in the root folder of the project
The project includes the following Bun scripts in package.json:
Starts the server using Bun.
bun start
Starts the server in watch mode for development. This will automatically restart the server whenever changes are detected in server/index.ts.
bun dev
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
Stops the PM2-managed process for server/index.ts. Use this to clean up running instances of the server.
bun kill
To start the server in development mode with automatic reloading:
bun run dev
To start the server in production mode with PM2:
bun run prod
To stop the server in production mode:
bun run kill
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.