Skip to content

Engine Database Architecture ​

This document details the database persistence architecture of the Niksphere Engine, explaining how relational data storage, multi-database schema isolation, and storage drivers operate under the hood.

1. Dual-Driver Storage Architecture ​

The Niksphere Engine incorporates a flexible dual-driver storage abstraction supporting two distinct relational backends:

Rendering diagram...

PostgreSQL (Enterprise & Cloud Production) ​

  • Architecture: Client-server relational database.
  • Use Case: Production environments, multi-tenant cloud deployments, high-concurrency enterprise workloads.
  • Features: Connection pooling, SSL/TLS transport security, online backups, horizontal read scaling.

Embedded SQLite (Zero-Config & Edge) ​

  • Architecture: In-process, serverless CGO-free file database engine.
  • Use Case: Local developer workstations, edge devices, single-tenant installations, testing environments.
  • Features: Zero external installation, single-file storage (niksphere_main.db), zero network latency.

2. Multi-Database Schema Isolation ​

To enforce security boundaries, data integrity, and compliance, the Niksphere Engine segregates persistence into distinct functional databases (or isolated SQLite files / PostgreSQL schemas):

Database IdentifierPurposeStorage Scope
authDBIdentity Provider (IDP Broker)User credentials, password hashes, OAuth2/OIDC clients, active tokens, and external IDP federation configs.
engineDBEngine Metadata & ManifestsInstalled App packages, version history, effective AST layer definitions, system settings, and audit logs.
tenantDBBusiness Application DataRuntime entity records, customer data, and operational business transactions.

3. Storage Backend Decision Matrix ​

CriteriaPostgreSQLEmbedded SQLite
Target EnvironmentSelf-Hosted Enterprise / Niksphere Cloud (Fully Managed)Local Dev / Edge / Testing
Concurrent Write PerformanceHigh (Row-level locking)Moderate (WAL mode / file locking)
External Setup NeededYes (DB Server / Container)No (Built-in file engine)
Backup Mechanismpg_dump / Point-in-time recoverySingle file copy (.db)
Network OverheadLow (TCP/IP socket)Zero (In-process memory/disk)

Release v1.0.0-build.1-channel.stable