itsybitsy/README.md

65 lines
2.6 KiB
Markdown

# 🕸 itsybitsy
[![License: Apache-2.0](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](LICENSE) [![AI-DECLARATION: copilot](https://img.shields.io/badge/%E4%B7%BC%20AI--DECLARATION-copilot-fee2e2?labelColor=fee2e2)](https://ai-declaration.md)
Serve folders of Markdown to different domains over HTTP, [Spartan](https://portal.mozz.us/gemini/spartan.mozz.us/) and [Nex](https://nightfall.city/nex/info/specification.txt), rendered on the fly with no build step.
A Rust re-implementation of [smolweb](https://code.randogoth.com/randogoth/smolweb), which serves one folder from one process with its output formats hardcoded and its configuration in per-file frontmatter. itsybitsy changes all three: one process serves many domains, each output format is a separate crate behind a cargo feature, and configuration lives in a TOML file per content directory.
## Status
Early. The configuration layer is implemented and tested; nothing is served yet.
| Area | State |
| --- | --- |
| Server configuration, virtual hosts, `--check` | implemented |
| Path resolution and the render cache | planned |
| gemtext and HTML output | planned |
| HTTP, Spartan and Nex listeners | planned |
| 80-column text and Nex output | planned |
| WML and XHTML-MP decks | planned |
| Gemini and Gopher | planned |
## Configuration
Two files. A server file names the virtual hosts and the listeners:
```toml
version = 1
[site.smol]
root = "/srv/smol/content"
hosts = ["smol.place", "www.smol.place"]
[listener.web]
protocol = "http"
bind = "0.0.0.0:8080"
formats = ["xhtmlmp", "html"]
default_site = "smol"
```
A `.itsybitsy.toml` in any content directory says how the Markdown in **that directory** renders. There is no inheritance: a subdirectory without its own file uses the built-in defaults rather than its parent's. Repetition in a deep tree is the price of never having to look elsewhere to know how a page renders.
`--check` validates the configuration and reports the routing it resolved, without binding a port:
```console
$ itsybitsy --config /etc/itsybitsy.toml --check
sites:
smol: /srv/smol/content
hosts:
smol.place -> smol
www.smol.place -> smol
listeners:
web: http on 0.0.0.0:8080 [xhtmlmp, html] by host, default smol
formats rendered per page: html, xhtmlmp
```
Everything the schema cannot express is checked here rather than on first request: a format no enabled feature provides, two sites claiming one hostname, a content root that does not exist, a server file sitting inside a content root where it would be served.
## Development
```bash
devbox run check # fmt --check, clippy -D warnings, test
devbox run test
devbox run build
```