How khushal-senghani/omni-host works
Omni-Host is a self-hosted Fastify hub that discovers app plugins, validates their configuration, mounts them behind a central server, and provides authentication and system-health endpoints. The main flow is request to the server, through authentication or a mounted app, to a response; the server also owns startup discovery and registration. The README describes SQLite, but the sampled database models and server connection refer to MongoDB, so the graph reflects the sampled implementation. Unsampled subsystems are included only where the README or source index supports them.
Main entry points: index.ts Fastify Server · plugin.ts Auth Endpoints · loader.ts App Discovery · routes.ts Example App
Components 18
Server Gateway
- Fastify Server
apps/server/src/index.ts - Request IDs
apps/server/src/plugins/requestId.ts - Error Handler
apps/server/src/plugins/error-handler.ts - System Routes
apps/server/src/routes/system.ts
App Runtime
- App Discovery
packages/core/src/loader.ts - Plugin Contract
packages/core/src/types/plugin.ts - Plugin Registry
packages/core/src/registry.ts - Example App
apps/test-app/src/routes.ts
Authentication
- Auth Endpoints
packages/auth/src/plugin.ts - Auth Strategies
packages/auth/src/strategies.ts - Password Verification
packages/auth/src/password.ts
Core Services
- App Env Validation
packages/config/src/merge.ts
Persistence
- Database Connection
packages/core/src/db/index.ts - User Records
packages/core/src/db/models/Users.ts - Refresh Tokens
packages/core/src/db/models/RefreshToken.ts - API Keys
packages/core/src/db/models/ApiKey.ts - Scoped Database
packages/core/src/db/scoped.ts
Other components
- API Client
Connections 19
- API Client → Fastify Server: sends requests
README.md - Fastify Server → Request IDs: registers
apps/server/src/index.ts - Fastify Server → Error Handler: registers
apps/server/src/index.ts - Fastify Server → Auth Endpoints: registers
apps/server/src/index.ts - Fastify Server → Database Connection: connects
apps/server/src/index.ts - Fastify Server → App Discovery: discovers apps
apps/server/src/index.ts - App Discovery → Plugin Contract: validates
packages/core/src/loader.ts - App Discovery → Example App: imports app
packages/core/src/loader.ts - Fastify Server → Plugin Registry: registers results
apps/server/src/index.ts - Fastify Server → App Env Validation: validates app envs
apps/server/src/index.ts - Fastify Server → System Routes: registers
apps/server/src/index.ts - System Routes → Plugin Registry: reads status
apps/server/src/routes/system.ts - Fastify Server → Example App: mounts plugin
README.md - Example App → Auth Strategies: uses authenticate
apps/test-app/src/routes.ts - Auth Endpoints → User Records: reads user
packages/auth/src/plugin.ts - Auth Endpoints → Refresh Tokens: reads and writes
packages/auth/src/plugin.ts - Auth Endpoints → Password Verification: verifies password
packages/auth/src/plugin.ts - Auth Strategies → API Keys: checks key
packages/auth/src/strategies.ts - Fastify Server → Scoped Database: creates app scope
apps/server/src/index.ts