Skip to main content

smolserve

A lightweight, multi-protocol server serving Gemini, Gopher, Finger, and Spartan protocols for local testing and documentation.

Features

  • Gemini Server: Serves Gemtext documents (.gmi, .gemini) and static files over TLS. Auto-generates Gemtext directory listings when index files are absent. Auto-generates self-signed TLS certificates for development if none are provided.
  • Gopher Server: Serves gophermap menus, directory listings, text files (with dot-stuffing), and binary files.
  • Finger Server: Responds to Finger queries (RFC 1288) with contents of a plan file.
  • Spartan Server: Serves Gemtext documents (.gmi, .gemini), static files, and directory listings over TCP. Supports file upload blocks.
  • Flexible Configuration: Configurable via command-line arguments or a TOML configuration file.
  • AsyncIO Powered: Lightweight, single-process asynchronous server implementation.

Installation & Setup

smolserve is managed using uv.

uv sync

Usage

Quick Start

Run smolserve with defaults (binds to 127.0.0.1, Gemini on port 1965, Gopher on port 7070, Finger on port 7979, Spartan on port 3000):

uv run smolserve

If target directories or plan files do not exist, smolserve automatically creates sample content directories (public_gemini/, public_gopher/, public_spartan/, plan.txt) and self-signed TLS dev certificates.


Exec / Command Wrapper Mode

smolserve includes a built-in process wrapper mode (exec), allowing you to temporarily run the Gemini, Gopher, Finger, and Spartan servers for the lifespan of an arbitrary command (such as static documentation site generation, live dev servers, or automated test runs).

How It Works

  1. Server Initialization: smolserve starts and binds all configured protocol servers.
  2. Process Execution: Once servers are running, smolserve launches the specified child command.
  3. Signal Forwarding: Signals such as SIGINT (Ctrl+C) and SIGTERM are trapped and forwarded directly to the child process.
  4. Automatic Cleanup & Exit Propagation: When the child process completes, smolserve gracefully stops all background servers and exits with the exact exit code returned by the child process (or exit code 130 on cancellation).

Command Syntax

You can specify the subcommand using exec --, exec, or --exec:

# Recommended POSIX standard syntax (using '--' separator)
uv run smolserve exec -- <command> [args...]

# Direct syntax without '--'
uv run smolserve exec <command> [args...]

# Flag syntax
uv run smolserve --exec <command> [args...]

Passing Server Options

smolserve flags and configuration options should be placed before the exec subcommand:

# Custom configuration file with exec
uv run smolserve -c smolserve.toml exec -- mkdocs build

# Custom host and port flags with exec
uv run smolserve --host 0.0.0.0 --gemini-port 1966 exec -- pytest

Use Cases & Examples

  • Build Pipelines: Ensure background protocol servers are available while building documentation or static sites.

    uv run smolserve exec -- mkdocs build
    
  • Live Development Servers: Run interactive documentation servers with live reload while smolserve serves required content.

    uv run smolserve exec -- mkdocs serve --livereload
    
  • Integration Testing: Automatically spin up servers, run integration test suites or test clients, and shut down cleanly.

    uv run smolserve exec -- pytest tests/
    
  • Makefile Integration:

    .PHONY: docs
    docs:
    	uv run smolserve exec -- $(mkdocs) build
    
    .PHONY: rtfm
    rtfm:
    	uv run smolserve exec -- $(mkdocs) serve --livereload
    

Command Line Options

uv run smolserve --help

Available flags:

  • -c, --config: Path to TOML configuration file.
  • --generate-config: Print sample TOML configuration to stdout and exit.
  • --host: Host address to bind servers to (e.g. 127.0.0.1 or 0.0.0.0).
  • --gemini-port: Gemini server port.
  • --gemini-root: Directory containing Gemtext/static content.
  • --gemini-cert: Path to custom TLS PEM certificate.
  • --gemini-key: Path to custom TLS PEM private key.
  • --no-gemini: Disable Gemini server.
  • --gopher-port: Gopher server port.
  • --gopher-root: Directory containing Gopher content / gophermaps.
  • --no-gopher: Disable Gopher server.
  • --finger-port: Finger server port.
  • --finger-plan: Path to Finger plan file.
  • --no-finger: Disable Finger server.
  • --spartan-port: Spartan server port.
  • --spartan-root: Directory containing Spartan content.
  • --no-spartan: Disable Spartan server.

TOML Configuration

You can pass a TOML configuration file via -c / --config:

[general]
host = "127.0.0.1"

[gemini]
enabled = true
port = 1965
root = "./public_gemini"
# cert_file = "./cert.pem"
# key_file = "./key.pem"

[gopher]
enabled = true
port = 7070
root = "./public_gopher"

[finger]
enabled = true
port = 7979
plan_file = "./plan.txt"

[spartan]
enabled = true
port = 3000
root = "./public_spartan"

To generate a sample configuration file:

uv run smolserve --generate-config > smolserve.toml

Running Tests

Run the test suite using pytest:

uv run pytest

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

smolserve-0.0.4.tar.gz (13.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

smolserve-0.0.4-py3-none-any.whl (19.4 kB view details)

Uploaded Python 3

File details

Details for the file smolserve-0.0.4.tar.gz.

File metadata

  • Download URL: smolserve-0.0.4.tar.gz
  • Upload date:
  • Size: 13.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.2 {"installer":{"name":"uv","version":"0.12.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for smolserve-0.0.4.tar.gz
Algorithm Hash digest
SHA256 92f1b410d73a3683a215c623c288357bb2bf2152230a35adc59a3d9036fb383e
MD5 616c85c41f80c84a22751a80c96001f0
BLAKE2b-256 be477dd460c8660b82ed3134e93984dbacd619545b38c8c89f138402a3026798

See more details on using hashes here.

File details

Details for the file smolserve-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: smolserve-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 19.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.2 {"installer":{"name":"uv","version":"0.12.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for smolserve-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 983a140c7b65323a373880c229c68c0c4f673044cebce2cf31d0548d5a2bf285
MD5 74aeac33e49563a387644bac2e2bffe5
BLAKE2b-256 85356161d404b06c097e4bd40c4549b2dd06c534c277bb1098b22db736f1f67c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page