Skip to content

Quick Start

Get up and running with bxn start in just a few minutes.

The fastest way to get started is using the create-bxn init command:

Terminal window
pnpm create bxn@latest

Once created, start the development server:

Terminal window
cd your-project-name
pnpm dev

Visit http://localhost:3000 in your browser to see your API running!

If you prefer to set up manually, install both the framework and CLI:

Terminal window
pnpm add @buildxn/http
pnpm add -D bxn

Then add these scripts to your package.json:

{
"scripts": {
"dev": "bxn start --watch",
"start": "bxn start",
"build": "tsc"
}
}

Create a simple route file at src/routes/get.ts:

import { route, json } from '@buildxn/http';
export default route().handle(() => {
return json({
message: 'Hello, World!',
timestamp: new Date().toISOString(),
});
});

Start the development server with watch mode for auto-reload:

Terminal window
npx bxn start --watch

Your API is now running at http://localhost:3000!

Open your browser or use curl to test the endpoint:

Terminal window
curl http://localhost:3000

You should see:

{
"message": "Hello, World!",
"timestamp": "2024-01-15T10:30:00.000Z"
}