Skip to main content

brixta-core

Reusable infrastructure primitives for BRIXTA FastAPI services.

Documented API: 0.1.2Python: >=3.11

Install

python -m pip install "brixta-core==0.1.2"

Verify:

python - <<'PY' import brixta_core print(brixta_core.version) PY

Public API

from brixta_core import ( Base, CoreSettings, RequestIDMiddleware, SecurityHeadersMiddleware, TimestampMixin, UUIDPrimaryKeyMixin, create_database, new_uuid, )

API

Purpose

CoreSettings

BRIXTA configuration from environment variables / .env

create_database()

SQLAlchemy engine + session factory

Base

Shared SQLAlchemy declarative base

UUIDPrimaryKeyMixin

Adds UUID id

TimestampMixin

Adds created_at / updated_at

new_uuid()

New UUID4

RequestIDMiddleware

Adds/preserves X-Request-ID

SecurityHeadersMiddleware

Adds baseline HTTP security headers

Configuration

from brixta_core import CoreSettings settings = CoreSettings()

Supported environment variables:

BRIXTA_ENVIRONMENT=development BRIXTA_DATABASE_URL=sqlite:///./app.db BRIXTA_CACHE_URL=redis://localhost:6379/0 BRIXTA_AUTO_CREATE_TABLES=true

Production example:

BRIXTA_ENVIRONMENT=production BRIXTA_DATABASE_URL=postgresql+psycopg://user:password@db:5432/app BRIXTA_CACHE_URL=redis://valkey:6379/0 BRIXTA_AUTO_CREATE_TABLES=false

Use migrations in production instead of automatic table creation.

Database

from brixta_core import CoreSettings, create_database

settings = CoreSettings() engine, SessionLocal = create_database(settings.database_url)

FastAPI session dependency:

from collections.abc import Iterator from sqlalchemy.orm import Session

def get_session() -> Iterator[Session]: with SessionLocal() as session: yield session

Application models

from brixta_core import Base, TimestampMixin, UUIDPrimaryKeyMixin from sqlalchemy import String from sqlalchemy.orm import Mapped, mapped_column

class Plant(UUIDPrimaryKeyMixin, TimestampMixin, Base): tablename = "plants" name: Mapped[str] = mapped_column(String(200), nullable=False)

The model gets:

id created_at updated_at

For local development:

Base.metadata.create_all(engine)

Request IDs

from fastapi import FastAPI from brixta_core import RequestIDMiddleware

app = FastAPI() app.add_middleware(RequestIDMiddleware)

Responses receive:

X-Request-ID:

Inside a route:

from fastapi import Request

@app.get("/debug") def debug(request: Request): return {"request_id": request.state.request_id}

Security headers

from brixta_core import SecurityHeadersMiddleware

app.add_middleware( SecurityHeadersMiddleware, hsts=False, )

Adds baseline headers including:

X-Content-Type-Options: nosniff X-Frame-Options: DENY Referrer-Policy: no-referrer Permissions-Policy: camera=(), microphone=(), geolocation=()

For HTTPS production only:

app.add_middleware(SecurityHeadersMiddleware, hsts=True)

Minimal service

from contextlib import asynccontextmanager from fastapi import FastAPI

from brixta_core import ( Base, CoreSettings, RequestIDMiddleware, SecurityHeadersMiddleware, create_database, )

settings = CoreSettings() engine, SessionLocal = create_database(settings.database_url)

@asynccontextmanager async def lifespan(app: FastAPI): if settings.auto_create_tables: Base.metadata.create_all(engine) yield engine.dispose()

app = FastAPI(lifespan=lifespan) app.add_middleware(RequestIDMiddleware) app.add_middleware( SecurityHeadersMiddleware, hsts=settings.environment.casefold() == "production", )

What brixta-core does NOT do

It does not provide authentication, login UI, users, roles, CRUD generation, app migrations, cement-domain logic, or frontend components.

LLM IMPLEMENTATION CONTRACT

Copy this into an LLM prompt:

Use brixta-core as an installed dependency. Do not copy its source into the application.

Prefer only these public APIs: Base CoreSettings RequestIDMiddleware SecurityHeadersMiddleware TimestampMixin UUIDPrimaryKeyMixin create_database new_uuid

Rules:

  1. Use CoreSettings for shared BRIXTA infrastructure configuration.
  2. Use create_database() for the SQLAlchemy engine/session factory.
  3. Make application ORM models inherit from brixta_core.Base.
  4. Reuse UUIDPrimaryKeyMixin and TimestampMixin instead of recreating those columns.
  5. Add RequestIDMiddleware to FastAPI services.
  6. Add SecurityHeadersMiddleware; only enable HSTS on HTTPS production deployments.
  7. Do not use Base.metadata.create_all() as the production migration strategy.
  8. Do not invent brixta-core APIs not listed above.
  9. Domain/business logic stays in the consuming application.
  10. When brixta-auth is used, share the same Base/engine/session infrastructure.

Metadata

Release files for brixta-core 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for brixta-core 0.1.3
File Size Uploaded Provenance Actions
brixta_core-0.1.3.tar.gz 5.8 kB With provenance Details for brixta_core-0.1.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for brixta-core 0.1.3
File Interpreter ABI Platform Actions
brixta_core-0.1.3-py3-none-any.whl Python 3 none any Details for brixta_core-0.1.3-py3-none-any.whl

Total release size: 12.4 kB

Release files / brixta_core-0.1.3.tar.gz

Download URL brixta_core-0.1.3.tar.gz
Size 5.8 kB
Tags Source
SHA-256 checksum
How to use checksums
5e552c91d0b30519c44b8c1eef2035f5267cf61d2da8f0b46b4b3ff25838b690
BLAKE2b-256 checksum
How to use checksums
0ffb7d79ef10a3a7eac509bd2297c805464026d2bcb47a5530f8b9a7b69b0d66
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 9, 2026.

Transparency log

Release files / brixta_core-0.1.3-py3-none-any.whl

Download URL brixta_core-0.1.3-py3-none-any.whl
Size 6.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
25987d420a4f2bdc4a7c85915a42fbfaa1dcf199206627d2467dd61b0d784c4d
BLAKE2b-256 checksum
How to use checksums
7422b2cda092d2ddf642a332a14a9655a20912a69b88ef0cae49fda01fcb2357
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 9, 2026.

Transparency log

Security for brixta-core 0.1.3

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for brixta_core-0.1.3.tar.gz

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 Aug 9, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page