firepact
Keep your Pydantic backend and your TypeScript frontend agreeing on the
wire shape of Firestore Native-mode documents read in realtime via
onSnapshot — and fail CI on a schema change that would break a frontend still
reading the old shape (FULL_TRANSITIVE).
firepact is not just a type converter. It generates the TypeScript types your frontend imports and runs a compatibility gate over the contract as it evolves. Before you rely on the green check, read what firepact is — and is not: it gates the evolution of the contract, not the data already sitting in Firestore.
Install
pip install firepact # Python CLI (firepact-gen / firepact-compat) + native engine
cargo install firepact-core # standalone Rust binary `firepact` (no Python/Node)
Quick start
1. Mark the models you read in realtime. The decorator records the collection path and which fields are guaranteed on every document; the backend writes with a camelCase alias generator (firepact matches it).
from datetime import datetime
from typing import Annotated
from firepact import firestore_realtime, FirestoreServerTimestamp
from pydantic import BaseModel, ConfigDict
from pydantic.alias_generators import to_camel
class CamelModel(BaseModel): # camelCase wire keys
model_config = ConfigDict(alias_generator=to_camel, populate_by_name=True)
@firestore_realtime(collection="rooms/{roomId}/messages", guaranteed=["body"])
class Message(CamelModel):
id: str # document id
body: str
created_at: Annotated[datetime, FirestoreServerTimestamp()]
tags: list[str] = []
2. Generate the TypeScript your frontend imports.
firepact-gen --module app.models --output src/firestore.ts
// @firestore-collection rooms/{roomId}/messages
export interface Message { // read view, for onSnapshot()
body: string; // guaranteed -> required even on old docs
createdAt?: Timestamp | null; // server timestamp: null until it resolves
id: string; // the converter injects snapshot.id
tags?: string[]; // not guaranteed -> optional (safe default)
}
export interface MessageWrite { // write view, for setDoc(): id is excluded
body: string;
createdAt: FieldValue; // serverTimestamp()
tags: string[];
}
The full worked example (refs, open enums, discriminated unions, vectors,
GeoPoints, bytes) is in examples/gen/chat/.
3. Gate compatibility in CI. Export the contract bundle per release and diff each change against the committed history; a breaking change fails CI.
firepact-gen --module app.models --bundle-out schemas/v2.json
firepact-compat --history schemas --new schemas/v2.json
See usage for the read/write/update views and the converter, and the compatibility gate for what counts as breaking.
Supported versions
Verified in CI (see .github/workflows/ci.yaml).
| Component | Supported | Notes |
|---|---|---|
| Python | 3.11 – 3.14 | one abi3 wheel covers 3.11+ |
| Pydantic | 2.9 – 2.13 | drift canary; the exact schema golden is pinned to the locked version |
| JSON Schema | Draft 2020-12 | Pydantic's default dialect |
| TypeScript (output) | 5.x / 6.x / 7.x | type-checks under verbatimModuleSyntax + isolatedModules |
| firebase JS SDK | v11+ | Timestamp, GeoPoint, DocumentReference, Bytes, VectorValue, FieldValue, UpdateData, FirestoreDataConverter |
| Rust | 1.75+ | MSRV (Cargo.toml) |
Dependency bumps within these ranges are tracked by Dependabot.
Documentation
- scope — what firepact is and is not (read this first)
- usage — annotating models, the read/write/update views, the gate
- contract & projection — the
x-firestore-*vocabulary - compatibility — the
FULL_TRANSITIVEgate and its taxonomy - architecture — the two components and the single bundle
docs/adr/— the decisions (the "Why")
How it works
firepact-core(Rust crate, binaryfirepact): pure, Python/Node-free.firepact emitprojects one enriched JSON Schema bundle into read/write/update TypeScript;firepact compatis the gate.firepact(Python package): imports your Pydantic models, delegates schema generation to Pydantic, stamps thex-firestore-*vocabulary, and emits via the native core. Console scripts:firepact-gen,firepact-compat, andpydantic2ts(a drop-in alias for the prior tool).
Contributing
just build # build the Rust core + `firepact` binary
just test # all tests (rust + python)
just lint # rust + python + markdown checks
just example-gen # regenerate the generation examples (examples/gen/)
just example-compat # gate the compat example against its committed history
Prior art & license
The Firestore-specialised, from-scratch successor to pydantic-to-typescript (which targeted FastAPI request/response types and depended on Node). MIT licensed (LICENSE).
Metadata
Release files for firepact 0.1.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| firepact-0.1.8.tar.gz | 176.8 kB | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| firepact-0.1.8-cp311-abi3-win_amd64.whl | CPython 3.11 | abi3 | Windows x86-64 | Details |
| firepact-0.1.8-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl | CPython 3.11 | abi3 | Linux glibc 2.17+ x86-64 | Details |
| firepact-0.1.8-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl | CPython 3.11 | abi3 | Linux glibc 2.17+ ARM64 | Details |
| firepact-0.1.8-cp311-abi3-macosx_11_0_arm64.whl | CPython 3.11 | abi3 | macOS 11.0+ ARM64 | Details |
| firepact-0.1.8-cp311-abi3-macosx_10_12_x86_64.whl | CPython 3.11 | abi3 | macOS 10.12+ x86-64 | Details |
Total release size: 1.7 MB
Release files / firepact-0.1.8.tar.gz
| Download URL | firepact-0.1.8.tar.gz |
|---|---|
| Size | 176.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ef11401025c9a1324fb71531941bc3e52301893b4ccc0fa88fe6b25e8f697d06
|
|
BLAKE2b-256 checksum How to use checksums |
40ef99dd7de09051d32e898d813bce4fe955ac299f074c0395c8912f941b8710
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 5, 2026.
Transparency logRelease files / firepact-0.1.8-cp311-abi3-win_amd64.whl
| Download URL | firepact-0.1.8-cp311-abi3-win_amd64.whl |
|---|---|
| Size | 214.9 kB |
| Tags | CPython 3.11 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
91ab2cee0a68a7b64f20daae0f6c17e5b8c5bfc6b02c4f6944182d988e4bb193
|
|
BLAKE2b-256 checksum How to use checksums |
5e206944a3ca33163131babb91c1e07ccd6d95df6fb5fc44b341a22cd19ae158
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 5, 2026.
Transparency logRelease files / firepact-0.1.8-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | firepact-0.1.8-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 350.0 kB |
| Tags | CPython 3.11 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
08c2dfe6c98d4b702c54cddc3587d8d662718c00b8b81bceb1abf655fad9d6d8
|
|
BLAKE2b-256 checksum How to use checksums |
b07ba83d8c7d25ba8eb0e32c45ec0736ae2d8308922ee508249358cb6531fa22
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 5, 2026.
Transparency logRelease files / firepact-0.1.8-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | firepact-0.1.8-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 332.1 kB |
| Tags | CPython 3.11 Linux glibc 2.17+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
e4b18974a3d910b5474b60732a45e874573fdb49511c0b98767a8341c9aee797
|
|
BLAKE2b-256 checksum How to use checksums |
59629618248e92f2080bfe7aab308443b9df3204e462060864cd2c1e0ea5cecf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 5, 2026.
Transparency logRelease files / firepact-0.1.8-cp311-abi3-macosx_11_0_arm64.whl
| Download URL | firepact-0.1.8-cp311-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 306.2 kB |
| Tags | CPython 3.11 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
cd18948ed617f417078f20377f79b7b2d19f693fe13a800ac3549e51d5926e6a
|
|
BLAKE2b-256 checksum How to use checksums |
a4ef920789dd56807bc426dd24f286a220892cbf7003dca4bea462e1d8afa84d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 5, 2026.
Transparency logRelease files / firepact-0.1.8-cp311-abi3-macosx_10_12_x86_64.whl
| Download URL | firepact-0.1.8-cp311-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 321.3 kB |
| Tags | CPython 3.11 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
19bc7da9ab8a99814d8b24faa3f4f9cc3a2a827f738dcb8fe2e9796782a1ea67
|
|
BLAKE2b-256 checksum How to use checksums |
b5a291bcd7f4aad2f7a45d4d96d57eed6029c535da9c6dea49c4f12ceb80b821
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 5, 2026.
Transparency log