A minimal Bun HTTP server, compiled to a single binary and ready to deploy on Porter.
| Component | Version | Notes |
|---|---|---|
| Bun | 1.4.3 | Bun.serve with built in routing, compiled with bun build --compile |
| TypeScript | 7.0.2 | Type checking only, Bun runs TypeScript directly |
| Runtime image | debian:13-slim | Runs the compiled binary as a non-root user |
| Method | Path | Response |
|---|---|---|
| GET | / |
JSON message confirming the app is running |
| GET | /healthz |
200 ok, used by the Porter health check |
bun install
bun test
bun run startThe server listens on $PORT, or 3000 when it is not set. Use bun run dev to restart on file changes.
With Docker:
docker build -t bun-getting-started . && docker run -p 3000:3000 bun-getting-startedPorter does not have a Bun buildpack, so this repo builds with the included Dockerfile. It runs the tests, compiles the app to a standalone binary, and copies only that binary into a slim runtime image.
- Fork this repo.
- In https://dashboard.porter.run, create a new app from your GitHub repo.
- Porter reads
porter.yaml, builds the Dockerfile, and opens a PR adding a GitHub Actions workflow. - Merge the PR. Every push to
mainredeploys the app.
See https://docs.porter.run/applications/deploy/deploy-from-github-repo for details.
Install the CLI (https://docs.porter.run/cli/installation), then:
porter auth login
porter apply -f porter.yamlporter.yaml defines a single web service:
buildusesmethod: dockerwith the rootDockerfile.run: /app/serverstarts the compiled binary, matching the DockerfileCMD.port: 3000matches the app's default port.cpuCores: 0.25andramMegabytes: 256are enough for this app. Raise them as it grows.healthCheckprobes/healthz.
| Name | Required | Description |
|---|---|---|
PORT |
No | Port to listen on. Defaults to 3000, which matches porter.yaml. |
Full reference: https://docs.porter.run/applications/configuration-as-code/reference
- https://docs.porter.run/getting-started/quickstart
- https://docs.porter.run/applications/configuration-as-code/overview
- https://docs.porter.run/applications/configure/environment-groups
- https://docs.porter.run/addons/datastores
- https://docs.porter.run/preview-environments/overview
- https://github.com/porter-dev/starters