forgejoPages/README.md
creations 9389fd5f8c
All checks were successful
Code quality checks / biome (push) Successful in 7s
first commit
2025-05-11 14:07:03 -04:00

1.7 KiB

Bun Forgejo Pages Proxy

A simple static page server built with Bun that proxies files from a Forgejo repository.

Features

  • Serves static files (HTML, CSS, JS, images, etc.) from a static-pages branch
  • Automatic index.html resolution for directory paths
  • Proper MIME type handling via mime package
  • Minimal and fast Bun server

Requirements

  • Bun >= 1.2
  • A Forgejo instance with an API token
  • Repositories with a static-pages branch (or any configured via BRANCH)

Setup

1. Clone the repository

git clone https://git.creations.works/creations/forgejoPages
cd forgejoPages

2. Install dependencies

bun install

3. Configure environment

Copy .env.example to .env and fill in your Forgejo details:

cp .env.example .env

4. Start the server

bun run dev

Environment Variables

Name Description
HOST Host to bind the server to
PORT Port to run the server on
FORGEJO_URL URL to your Forgejo instance
FORGEJO_TOKEN Personal access token with repo read access
BRANCH Branch to serve files from (e.g., static-pages)
REPO Repository name to use (defaults to pages)

How It Works

Requesting /username/path/to/file will fetch:

https://FORGEJO_URL/api/v1/repos/username/pages/raw/path/to/file?ref=BRANCH

If a request ends in /, it automatically appends index.html.

License

MIT