Repository navigation
Repository Layout
KingresDB lives in one repository. The root of the repository is the PostgreSQL source tree (the fork); KingresDB's own code is added next to it and is never mixed into upstream directories except through registered core patches (ADR 0003). The current layout is described in repository-layout.md; the sketch with a postgres/ subdirectory in the architecture document is superseded by it.
<repository root>/ Upstream PostgreSQL tree (branch kingres-18, base REL_18_7)
contrib/
kingres_shard/ Sharding extension (C)
kingres_ledger/ Ledger extension (C)
kingres_columnar/ Columnar table access method (C)
kingres_sketch/ Approximate aggregates (C)
kingres_timepart/ Time partitioning and retention (SQL and PL/pgSQL)
... Upstream contrib modules, untouched
src/, doc/, config/, ... Upstream PostgreSQL, changed only by registered core patches
.github/ CONTRIBUTING.md, CODE_OF_CONDUCT.md, SECURITY.md
kingres/
README.md Project entry point: phase table, repository map, status
CHANGELOG.md Changes by release (0.1.0 was released on 2026-11-28)
LICENSE, COPYRIGHT, AUTHORS The licence of KingresDB's own code (AGPL-3.0-only) and the authors
api/ OpenAPI contract (openapi.yaml); the REST API is defined here first
brand/ Brand files that the console and the documents use
control-plane/ Go module: kingresd, kingres-watchdog and kingres-cli (the last is part of 0.2.0)
cmd/ One subdirectory per executable (main packages only)
internal/ All other Go packages
web/ Vue 3 and TypeScript console
verifier/ Standalone ledger verifier (does not trust the database)
packaging/ Release build recipe, release script, container image, development cluster, Debian package, artifact tests
dev/ Developer scripts: build.sh, ext.sh, ext-majors.sh, setup-ubuntu.sh
docs/
architecture.md Design and decisions (source of truth for design)
guide/ User guides: install, quickstart, operator guide, upgrade, limitations
research/ Research notes behind the architecture document
design/ One design document per phase
adr/ Architecture decision records, one decision each
dev/ How to work on the project
reviews/ Independent review reports
release-notes-template.md Template of the release notes that the release script fills
worklog.md Dated record of work done
Each extension directory holds kingres_<name>.control, the install script kingres_<name>--<version>.sql, one upgrade script per step, src/ (C sources and the compatibility header pg_compat.h), Makefile (PGXS) and meson.build, sql/ and expected/ for pg_regress, t/ for TAP tests and a README.md. kingres_timepart is SQL only. See Coding Standards for the rules.
| Path | Role | Wiki page |
|---|---|---|
contrib/kingres_shard |
Catalog, bucket map, planner and executor hooks, two-phase commit, background worker, bucket movement, standbys | Sharding |
contrib/kingres_ledger |
Ledger tables, block builder, digest and verify functions, client signatures | Ledger |
contrib/kingres_sketch, kingres_timepart, kingres_columnar
|
Analytics | Analytics Extensions |
kingres/control-plane |
kingresd: agent, manager, client router, REST API, with the web console embedded; kingres-watchdog, the small program that covers a dead or hung kingresd
|
Control Plane and REST API |
kingres/api |
The OpenAPI contract that the server and the client are checked against | REST API Reference |
kingres/web |
The web console | Web Console |
kingres/verifier |
Command-line verifier that does not import the control plane or any server code | The Verifier |
kingres/packaging |
Packages, images and the release script | Installing and Packaging, Release Process |
The sketch's agent, manager, api and cli are roles, not separate directories: they are Go packages under kingres/control-plane/internal/ of the single kingresd binary. The patches/ directory of the sketch is replaced by the core-patch register. The sketch's deploy/ and ci/ do not exist; if they are needed they go under kingres/deploy/ and kingres/ci/ so that the top level stays upstream's.
Decide in this order and stop at the first rule that fits.
-
Can it be an extension? Anything that runs inside a backend or background worker and can be done with hooks, CustomScan, transaction callbacks, background workers or SQL goes in
contrib/kingres_*. -
Is it a process outside PostgreSQL? Instance lifecycle, the client router, cluster management, the task engine, the REST API and the command-line client go in
kingres/control-plane/. The agent must not be a background worker, because it has to be able to start and restart postgres. -
Is it user interface? It goes in
kingres/web/and talks only to the REST API inkingres/api/openapi.yaml; a panel feature needs the API change first. -
Is it verification that must not trust the server? It goes in
kingres/verifier/and must not import the control-plane module or server code. -
Is it packaging, service files or images?
kingres/packaging/. - Only if none of these can work: a core patch. See Branching and Synchronisation.
Other placement rules: test code lives next to the code it tests (sql/, expected/ and t/ in each extension, *_test.go beside Go code, *.test.ts in kingres/web/tests and beside components); do not create new top-level directories in the repository root; do not edit upstream doc/ to describe KingresDB (its documentation is in kingres/docs/).
| Document | Holds |
|---|---|
kingres/README.md |
What the project is, repository map, status |
kingres/CHANGELOG.md |
Changes by release |
kingres/docs/guide/ |
The user guides: install, quickstart, operator guide, upgrade, limitations |
kingres/docs/architecture.md |
The design; separates sourced facts, [Recommendation] and [Needs verification] items |
kingres/docs/design/ |
Design per phase (see Status and Roadmap) |
kingres/docs/adr/ |
One decision per file (Architecture Decisions) |
kingres/docs/dev/ |
Setup, standards, layout, core patches, upstream sync, testing, documentation, releases |
kingres/docs/reviews/ |
Review reports (Review Process) |
kingres/docs/worklog.md |
Dated record of work, newest first |
contrib/kingres_*/README.md |
User-facing description of one extension |
kingres/api/openapi.yaml |
The REST contract |
KingresDB's own code is licensed under AGPL-3.0-only. PostgreSQL code keeps the PostgreSQL License. Copyright of the project's own code: RooyeKhat Media Co. KingresDB is derived from PostgreSQL and is not endorsed by the PostgreSQL project. Repository | Licence | COPYRIGHT
KingresDB
1. Product
- Product Overview and Features
- Status and Roadmap
- User Guide
- Administrator Guide
- REST API Reference
- Web Console
- Command Line Client
- Extensions
- Limitations and Known Issues
- Release Notes
Features in detail
- Sharding
- Sharding Query Pushdown
- Sharding Table Lifecycle
- High Availability
- Ledger
- Ledger Signing and Publication
- Ledger Anchoring
- The Verifier
- Analytics Extensions
Administration
- Cluster Setup
- Servers Databases and Roles
- Rebalancing
- Configuration
- Memory and Warm-up
- Control Plane and REST API
- Upgrades
2. Architecture (arc42)
- Architecture
- Architecture Introduction and Goals
- Architecture Constraints
- Architecture System Context
- Architecture Containers
- Architecture Components
- Architecture Runtime Views Sharding
- Architecture Runtime Views Availability and Ledger
- Architecture Deployment
- Architecture Crosscutting Concepts
- Security Model
- Architecture Decisions
- Architecture Quality Requirements
- Architecture Risks and Technical Debt
- Enterprise Architecture
3. Data architecture
- Data Architecture
- Data Model Sharding
- Data Model Ledger
- Data Model System Database
- Data Model Analytics
- Data Lifecycle
- Backup Restore and PITR
- Data Security
- Data Quality and Integrity
4. Development
- Building from Source
- Development and Testing
- Repository Layout
- Coding Standards
- Branching and Synchronisation
- Testing Strategy
- Review Process
- Release Process
- Contributing
5. Operations