Hive is a modular C++23 universal data server. Define a
ModelDefinition once — Hive generates the REST API, drives SQLite persistence,
runs the validation and trigger pipeline, and renders a complete web frontend
from the same metadata contract.
ModelDefinition, the entire stackEvery entity in Hive is described by a struct ModelDefinition. That single object drives all downstream layers — nothing is duplicated across controllers, DTOs, persistence, validation, and UI.
// Example: defining a model in a plugin
ModelDefinition md("note", "slip_box");
md.set_group("Slip Box", 100)
.set_all_rest_operations() // Crudl: Create Read Update Delete List
.set_title_column("title")
.set_columns({
{"title", MANDATORY | TEXT},
{"content", TEXTAREA},
{"map_id", FOREIGN_KEY}, // auto-detects _id suffix → Integer
{"is_public", BOOL | MUTABLE}
});
┌──────────────────────────────────────┐
│ ModelDefinition │
└──┬──────────┬──────────┬─────────────┘
│ │ │
REST API SQLite Validator Frontend
/api/v1/note repository pipeline CRUD screen
(Crow route) + LRU cache (can_* methods) (auto-rendered)
MANDATORY · UNIQUE · FOREIGN_KEY · AUTO · HIDDEN · READONLY · MUTABLE · INTERNAL · TEXT · TEXTAREA · INTEGER · BOOL · DATETIME · REAL · BLOB
Crudl::{Create, Read, Update, Delete, List} — set per model. Shorthand: set_rest_operations("crudl") or set_all_rest_operations().
Plugin::register_model(def, validator, repo_factory) — PluginRegistry resolves topological dependency order before startup.
Crow routes appear at /api/v1/<model>. Frontend reads /api/v1/model_definition (cached 3 h in localStorage) and renders CRUD screens.
From the IValidator security gate through the three-phase trigger pipeline, LRU model cache, and schema-driven frontend — every layer is explicitly connected by metadata.
Full CRUD endpoints under /api/v1/<model> generated from allowed_rest_operations. All five Crudl operations (Create, Read, Update, Delete, List) are available per model. Supports page_number, page_size, sort, order, and field-level filters.
Class Plugin registers models, triggers, queries, jobs, and migration scripts as one unit. PluginRegistry::get_plugin_names_sorted_by_dependencies() performs topological sort. Throws CyclicDependencyException and MissingDependencyException on invalid graphs.
Pure-virtual interface with can_create / can_read / can_update / can_delete / can_list — each returning OperationResult{int status, string error}. Acts as authentication, authorisation, domain-integrity, and consistency guard in one place.
TriggerPhase::{Before, After, InsteadOf, Around}. InsteadOf variants return std::optional to override default CRUD behaviour for virtual reads, fulltext search, or derived operations.
IRepository with create / read / update / remove / list / list_in_ids / list_ids. ModelCache: LRU with TTL (default 1 week), capacity_size=10000, thread-safe via std::shared_mutex. Stats: hits, misses, evicted_lru, expired, shrinks.
Quartz-style cron via cronq. Each Job::run(JobConfig&) returns an error string or empty on success. Properties: cron_expression, enabled_by_default, run_once_when_missed. Config queried via JobConfig::get_string_or_default().
AccessMode enum controls global API access: from MaintenanceMode (full lockdown) to PublicFullAccess. Token lifecycle: access token (default 15 min), refresh token (default 30 days), rotation threshold 7 days. Tokens SHA-256 hashed before storage.
Vanilla JS ESM modules — api.js, crud.js, auth.js, navigation.js, schemas.js, state.js, dom.js, explore.js. apiFetch() handles proactive token refresh (60 s before expiry). FK labels resolved via resolveForeignKeyValue() with 24 h localStorage cache.
File format: V(\d+)__([a-zA-Z0-9_]+).sql. Each migration carries a SHA-256 checksum + chain hash over the whole sequence. Applied transactionally in plugin dependency order. Tampering with applied migrations fails startup.
Fine-grained global access control. UserRole::{Guest=0, Reader=1, Editor=2, Reviewer=3, Admin=4, SuperAdmin=5, System=100} combined with AccessMode determines what each role can do at the platform level.
| AccessMode | Admin/SA | Reviewer | Editor | Reader | Guest |
|---|---|---|---|---|---|
MaintenanceMode | ❌ | ❌ | ❌ | ❌ | ❌ |
AdminsReadOnly | R | ❌ | ❌ | ❌ | ❌ |
AdminsReadWrite | RCUD | ❌ | ❌ | ❌ | ❌ |
AuthenticatedReadOnly | RCUD | R | R | R | ❌ |
AuthenticatedReadWrite | RCUD | RCUD | RCUD | R | ❌ |
AuthenticatedFullAccess | RCUD | RCUD | RCUD | RCUD | ❌ |
PublicReadOnly…ReadOnly | RCUD | R | R | R | R |
PublicReadOnly…ReadWrite | RCUD | RCUD | RCUD | R | R |
PublicFullAccess | RCUD | RCUD | RCUD | RCUD | RCUD |
R = Read/List only · RCUD = full Create/Read/Update/Delete. Validator can_* methods add per-model constraints on top.
Core provides the platform foundation. Three domain plugins ship complete vertical slices: models, migrations, triggers, queries, jobs, and frontend apps.
14 migrations. Platform-critical foundation for all other plugins.
user, team, team_member, access_token, refresh_token, login_session, auth_log, api_log, super_admin_log, history, job_entry, job_run, errorCleanupJob (@daily), VacuumJob (@monthly, disabled by default), CleanupHistoryOrphansJobHistoryCommonTrigger (After CRUDL → history table)CleanupSQLiteQuery, VacuumSQLiteQuery, CleanupHistoryOrphansSQLiteQuery33 migrations. Zettelkasten-style knowledge management.
map, content (FTS), note, property, tag_type, tag, link, source, idea, wanted_note, flag, project, task, pinned_note, annotation, test, test_attempt…HtmlExportJobBeforeCreateNoteTrigger, AfterCreateUpdateNoteTrigger, UpdateNotePathAndDepthAfterTrigger, InsteadOfReadNoteNavigationTrigger, ContentLinkParser, LinkSynchronizer + many moreFindNotesInMapSQLiteQuery, FindPreviousAndNextNoteSQLiteQuery, GetQuestionIdsSQLiteQuery…29 migrations. Full lexicon system with fulltext search and visit analytics.
dictionary_map, dictionary_term, dictionary_term_alias, dictionary_term_visit, dictionary_term_understanding, dictionary_link, dictionary_source, dictionary_url, dictionary_search…DictionaryHtmlExportJobInsteadOfListDictionaryTermFulltextTrigger, InsteadOfReadDictionaryNewerTermTrigger, InsteadOfReadDictionaryOlderTermTrigger, InsteadOfListDictionaryTermsForReviewTrigger + 10 moreFindDictionaryTermsSQLiteQuery, FindDictionaryTermMetricsSQLiteQuery, FindDictionaryTermsViaAdvancedSearchSQLiteQuery…23 migrations. Spaced repetition (SM-style) integrated with Slip Box and Dictionary.
r_global_setting, r_user_setting, r_session, r_review, r0_state, r2_state, r4_state, r18_state, r18_perf_agg, r18_prediction_logRSessionBeforeCreateTrigger, RReviewAfterCreateTrigger, AfterCreateDeleteFlagRepetitionTrigger, AfterUpdateContentSemanticVersionTriggerGetRSessionSelectedItemsSQLiteQueryEvery screen below is generated at runtime by reading /api/v1/model_definition. The frontend renders list, read, create, update, and delete views for any model without hand-written UI.







Every dependency has a clear role. No framework imposes hidden constraints on the architecture. All layers are explicit C++23 code.
GCC 14 tested · LTO · -O3 · CMAKE_UNITY_BUILD
Lightweight C++ HTTP microframework for route generation
via SQLiteCpp + custom IRepository abstraction layer
JSON serialization for API payloads and trigger data
Cross-platform build · feature flags per plugin
SHA-256 token hashing and migration checksums
Unit tests for utils, access modes, plugin registry, cron
No build chain · api.js, crud.js, auth.js, schemas.js