Metadata-Version: 2.5
Name: nat20-bridge
Version: 0.8.2
Summary: Nat20 over HTTP: a localhost REST API for D&D 5e SRD 5.2 rolls, checks and full combat. The backend of the SillyTavern nat20 extension.
Project-URL: Homepage, https://github.com/tapestria/nat20
Project-URL: Documentation, https://tapestria.github.io/nat20/
Project-URL: Repository, https://github.com/tapestria/nat20
Project-URL: Issues, https://github.com/tapestria/nat20/issues
Project-URL: Changelog, https://github.com/tapestria/nat20/releases
License: MIT License
        
        Copyright (c) 2026 Tapestria contributors
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in
        all copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
        THE SOFTWARE.
License-File: LICENSE
Keywords: 5e,dnd,dnd5e,fastapi,game-master,nat20,rest-api,rules-engine,sillytavern,srd,ttrpg
Classifier: Development Status :: 4 - Beta
Classifier: Framework :: FastAPI
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Games/Entertainment :: Role-Playing
Requires-Python: >=3.12
Requires-Dist: dnd5e-engine>=0.8.1
Requires-Dist: dnd5e-srd-data>=0.8.1
Requires-Dist: fastapi>=0.115
Requires-Dist: uvicorn>=0.30
Provides-Extra: dev
Requires-Dist: bandit>=1.8.0; extra == 'dev'
Requires-Dist: httpx>=0.27; extra == 'dev'
Requires-Dist: mypy>=1.10; extra == 'dev'
Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
Requires-Dist: pytest-cov>=6.0.0; extra == 'dev'
Requires-Dist: pytest>=8.0; extra == 'dev'
Requires-Dist: ruff>=0.5; extra == 'dev'
Description-Content-Type: text/markdown

# nat20-bridge

[Nat20](https://github.com/tapestria/nat20) over HTTP: a localhost REST API that puts
the [`dnd5e-engine`](https://pypi.org/project/dnd5e-engine/) D&D 5e SRD 5.2 rules
engine (backed by [`dnd5e-srd-data`](https://pypi.org/project/dnd5e-srd-data/)) behind
a small FastAPI surface. Any client that speaks HTTP can roll dice, resolve checks and
run a full fight with real rules. It is the backend of the
[SillyTavern nat20 extension](https://github.com/tapestria/SillyTavern-nat20).

The bridge binds to `127.0.0.1` by default — it is not intended to be exposed on
the network. CORS is permissive because the SillyTavern browser page fetches it
cross-origin from a loopback address.

## Running

```bash
uvx nat20-bridge      # from PyPI
uv run nat20-bridge   # from a checkout of this repository
```

Options:

- `--host` (default `127.0.0.1`)
- `--port` (default `8020`)
- `--data-dir` (default `~/.nat20-bridge`) — where `homebrew.json` persists.
- `--max-combats` (default `16`) — how many combats stay live at once; starting
  one more ends the least recently used.

## Development

```bash
uv sync --extra dev
make check
```
