Start with Bun
Palinx runs on Bun. Before adding palinx, write the server it replaces: a few lines of Bun.serve.
This track builds a small app one palinx concept per page. Each page is the smallest change from the one before, and every file shown is a real project that's built and tested with each docs release.
Install Bun
Palinx needs Bun 1.3 or newer. On macOS or Linux:
curl -fsSL https://bun.sh/install | bashOn Windows (PowerShell):
powershell -c "irm bun.sh/install.ps1 | iex"Open a new terminal and check it:
bun --version1.3.14A server by hand
Create a project folder with two files:
mkdir my-app && cd my-app{
"name": "my-app",
"type": "module",
"devDependencies": {
"@types/bun": "latest"
}
}const server = Bun.serve({
fetch() {
return new Response("hello");
},
});
console.log(`Listening on ${server.url}`);"type": "module" makes the project use ES modules (import/export), and @types/bun gives your editor Bun's types. Install, then run the server:
bun install
bun index.tsListening on http://localhost:3000/bun install also writes bun.lock, which pins the exact versions installed; commit it.
Open http://localhost:3000 and you get hello. Bun.serve uses the PORT environment variable when it's set, and 3000 otherwise. Stop it with Ctrl+C.
How it works
Bun.serve starts an HTTP server and calls fetch for every request; whatever Response it returns is the answer. Routing, rendering HTML, serving files and APIs would all be up to you, inside that one function.
That is the job palinx takes over.
Next: Let palinx run it.