Volt v0.1 · TypeScript APIs on Bun · Get started
Docs/Getting Started/Quick Start

Quick Start

Install Volt, start a server, and verify its response.

Prerequisites

Install a recent stable Bun release. Check the runtime before starting:

bash
bun --version

Create a project

bash
mkdir my-volt-api
cd my-volt-api
bun init -y
bun add voltts

Create index.ts

Copy the entire file below. The globalThis._importMeta_.main guard starts the server only when this file is run directly, so you can import the app in tests.

index.ts
import { Volt } from 'voltts';

const app = new Volt({ port: 3000 });
app.get('/hello', () => ({ message: 'Hello Volt' }));

if (globalThis._importMeta_.main) app.listen(3000);
export default app;

Run and verify

bash
bun run index.ts
# In another terminal:
curl -i http://localhost:3000/hello

Expect HTTP 200 and {"message":"Hello Volt"}. For automatic reload while editing, run bun --watch index.ts.

Continue learning

Follow Build a Tasks API. If startup fails, see Troubleshooting.