DigitalBase API
FastAPI backend of DigitalBase (internal name: lmlight). Single source tree — the
inference backend is chosen at runtime with LLM_BACKEND=ollama|vllm|sglang|none
(vllm / sglang spawn and supervise their own chat/embed/vision servers via
common/llm/local_engine.py; none = cloud LLM APIs only). Shipped to customers
as a PyInstaller single binary built by .github/workflows/release.yml.
Run from source
cd api
uv sync # deps + dev group (pytest, ruff, cython, ...)
# write api/.env (python-dotenv): DATABASE_URL, JWT_SECRET, LLM_BACKEND, ... (all keys: common/config/)
uv run python main.py # listens on API_HOST:API_PORT (default 0.0.0.0:8000)
uv run python manage.py db diff # show pending schema ALTERs (see ../docs/migrations.md)
PostgreSQL with pgvector is required for knowledge (RAG) (DATABASE_URL). Startup creates schemas, tables
and the vector extension itself; the database must already exist. Without the extension the API still
starts with RAG disabled, and an admin enables it from License > RAG search enhancement once a superuser has
run CREATE EXTENSION vector (see ../docs/migrations.md). The SPA build in static/ is served by the
same process when present.
Layout
| Dir | Role |
|---|---|
main.py |
app assembly: lifespan (DB migration, local engine start), router registration, SPA static files |
auth/, user/, admin/, system/, system_settings/ |
login/JWT/LDAP/OIDC, user settings, admin console (users/models/license/env/audit), health/license |
chat/ |
chat orchestration (NDJSON stream, tool loop, approvals, history, compaction, prompt suggest) |
rag/ |
bots, documents, ingest jobs (/api/bots, /api/documents, /api/upload) |
sql/, table/, files/ |
SQL connections + datalake + dashboards, table editing engine, file storage with shared-dir ACL (files/virtual_path.py = the user_id-based virtual path resolver operators and tools share) |
operators/ |
execution units shared by workflows, chat tools and MCP: flow/transform/ai/files/data/saas/fa/actions (@register, ExecutionContext) |
pipeline/ |
workflow engine: graph, scheduler, runs, webhooks, AI flow editing (runs operators/) |
connections/ |
API connection (SaaS credential) CRUD; SQL / file / OAuth connections live in sql/ files/ oauth/ |
mcp_servers/, oauth/, approvals/, prompts/, history_share/, transcribe/, benchmark/ |
managed custom MCP servers, OAuth connectors, tool approvals, prompt library, history sharing, whisper, benchmark |
gateway/ |
/v1/* OpenAI/Anthropic-compatible API and /mcp server for sk- API keys |
common/ |
cross-cutting code: config/, db/ (models + startup migrations), llm/ (all LLM I/O over httpx, invoke.py = one-shot call helper), rag/ (lifecycle.py = document / chunk deletion shared by upload and workflows), sql/, tools/ (tool handlers, permissions, MCP), connectors/ (HTTP retry / templating core), document/, file_connector/ (snapshot.py = file_landed diff ledger), runtime/ |
tests/ |
unit/ + contract/ (no external deps), e2e/ + connection/ (need E2E_BASE), see tests/README.md |
Conventions (short list)
- Function-first Python; classes only for state / inheritance / library requirements. One-line Japanese comments.
- LLM HTTP goes through
common/llm(httpx,auth_headers()), never an SDK. Chat uses/v1/chat/completionsonly. - New module → import it explicitly in the package
__init__.pyand add a--hidden-importinrelease.yml(tests/contract/test_packaging.pyenforces this; Cython-compiled modules are invisible to PyInstaller). - Tunable constants live in
common/configviaget_env(..., advanced=True); API datetimes useiso_utc(). - Document text comes only from
common.document.extract_document(chat attachments, tools, RAG, pipelines); callers never import parsers or branch on format (tests/contract/test_document_extraction_boundary.py). - Full principles:
../docs/CODING_PRINCIPLES.md.
Tests
Single entry point is the repo-root ./test.sh (layer definitions: ../docs/test/MATRIX.md).
../test.sh unit # api unit+contract + app vitest (no external deps)
../test.sh api # api unit+contract only
../test.sh integration # tests/e2e against E2E_BASE (default http://localhost:8000); add `fast` to skip @llm
../test.sh connection # tests/connection (mocks: ../test.sh env up demo)
../test.sh smoke # GET sweep of every route on a running instance
uv run ruff check . # lint / format (ruff format)
Release gate (release.yml) runs only tests/contract/test_packaging.py plus the app tsc / vite build;
everything else is run manually before tagging.
Metadata
Release files for digitalbase 26.923
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| digitalbase-26.923-cp313-cp313-win_amd64.whl | CPython 3.13 | CPython 3.13 | Windows x86-64 | Details |
| digitalbase-26.923-cp313-cp313-manylinux_2_39_x86_64.whl | CPython 3.13 | CPython 3.13 | Linux glibc 2.39+ x86-64 | Details |
| digitalbase-26.923-cp313-cp313-manylinux_2_39_aarch64.whl | CPython 3.13 | CPython 3.13 | Linux glibc 2.39+ ARM64 | Details |
| digitalbase-26.923-cp313-cp313-macosx_15_0_arm64.whl | CPython 3.13 | CPython 3.13 | macOS 15.0+ ARM64 | Details |
Total release size: 109.1 MB
Release files / digitalbase-26.923-cp313-cp313-win_amd64.whl
| Download URL | digitalbase-26.923-cp313-cp313-win_amd64.whl |
|---|---|
| Size | 19.8 MB |
| Tags | CPython 3.13 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
88ef2852988c6a82de35cb67cab64e3c8f76644aafd115d98068df8f9b0984a9
|
|
BLAKE2b-256 checksum How to use checksums |
54e386a4f07466f728a74976225c567db7d658193a429e33364e5876dfe055a7
|
| 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 Sep 23, 2026.
Transparency logRelease files / digitalbase-26.923-cp313-cp313-manylinux_2_39_x86_64.whl
| Download URL | digitalbase-26.923-cp313-cp313-manylinux_2_39_x86_64.whl |
|---|---|
| Size | 26.1 MB |
| Tags | CPython 3.13 Linux glibc 2.39+ x86-64 |
|
SHA-256 checksum How to use checksums |
6f18b3e8acdeb4810a89f47c5ee0c4a911e3873d86a7c8b8c9ac3882db33a70b
|
|
BLAKE2b-256 checksum How to use checksums |
d3d5fa7624ddd91235c42d71f6eac2e8a0197d24eb78679272aa6d544ffd7230
|
| 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 Sep 23, 2026.
Transparency logRelease files / digitalbase-26.923-cp313-cp313-manylinux_2_39_aarch64.whl
| Download URL | digitalbase-26.923-cp313-cp313-manylinux_2_39_aarch64.whl |
|---|---|
| Size | 23.9 MB |
| Tags | CPython 3.13 Linux glibc 2.39+ ARM64 |
|
SHA-256 checksum How to use checksums |
2e1661e92b3475d52cb9f25599cf2d81d579afc28f2b973dac12f63508ef857f
|
|
BLAKE2b-256 checksum How to use checksums |
9f21b85c56795ce5be1c4c41f7115fea1e4d0cf9d162e5a216e621bbc9f99d38
|
| 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 Sep 23, 2026.
Transparency logRelease files / digitalbase-26.923-cp313-cp313-macosx_15_0_arm64.whl
| Download URL | digitalbase-26.923-cp313-cp313-macosx_15_0_arm64.whl |
|---|---|
| Size | 39.3 MB |
| Tags | CPython 3.13 macOS 15.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
6036b4fc76efbbf496c8c8298be5288e2b3bb3e4acbca8cb3b4f11b0c5bb8875
|
|
BLAKE2b-256 checksum How to use checksums |
862410d9d6f390068831798981652bdd52305bed84c598bd03c722c5be797f9a
|
| 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 Sep 23, 2026.
Transparency log