Skip to content

Getting Started

ProBun is a fast, lightweight file-based routing system for Bun servers. It is designed to be simple and easy to use.

Installation

You must have Bun installed before you can use Probun.

If you have Bun installed, you can install Probun using the following command:

Terminal window
mkdir my-probun-app && cd my-probun-app && bun init -y
Terminal window
bun install probun@latest
Terminal window
mkdir routes

Creating a Route

Here we will create a simple get route that returns a JSON response. Create a new file in the routes directory called index.ts and add the following code:

import type { Route } from 'probun';
export const GET = async (c: Route): Promise<Response> => {
return c.json({ message: 'Hello, World!' });
};

Running the Server

In your index.ts (not in the routes directory), add the following code:

import { Probun } from 'probun';
Probun({
port: 3000,
routes: 'routes',
});

Now you can run your server using the following command:

Terminal window
bun --watch index.ts

Now you can visit http://localhost:3000 in your browser to see your server running.