Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Architecture Overview

Liteskill is an event-sourced Phoenix application organized around bounded contexts with enforced boundaries (via the boundary library).

High-Level Architecture

┌─────────────────────────────────────────────────────────┐
│                    LiteskillWeb                          │
│  LiveView UI │ REST API │ Auth Plugs │ Rate Limiting     │
└──────────┬──────────────┬────────────────────────────────┘
           │              │
┌──────────▼──────────────▼────────────────────────────────┐
│                   Context Layer                           │
│  Chat │ Accounts │ Authorization │ Groups │ LLM │ ...    │
└──────────┬───────────────────────────────────────────────┘
           │
┌──────────▼───────────────────────────────────────────────┐
│              Infrastructure Layer                         │
│  EventStore │ Aggregate │ Crypto │ Repo │ PubSub         │
└──────────────────────────────────────────────────────────┘

Bounded Contexts

Each context is a top-level Boundary module that declares its dependencies and exports:

ContextResponsibility
Liteskill.ChatConversations, messages, streaming, tool calls
Liteskill.AccountsUsers, OIDC, password auth, invitations
Liteskill.AuthorizationEntity ACLs, role hierarchy, access queries
Liteskill.GroupsGroup management and memberships
Liteskill.LLMLLM completions, stream orchestration
Liteskill.LlmProvidersProvider CRUD, env bootstrapping
Liteskill.LlmModelsModel CRUD, provider options
Liteskill.LlmGatewayPer-provider circuit breaker, concurrency gates, token buckets
Liteskill.McpServersMCP server CRUD, tool selection
Liteskill.RagCollections, sources, documents, embeddings, search
Liteskill.AgentsAgent definitions, tool/source ACLs
Liteskill.TeamsTeam definitions with agent composition
Liteskill.RunsRun execution, tasks, logs
Liteskill.ReportsReports with nested sections and comments
Liteskill.SchedulesCron-based recurring runs
Liteskill.DataSourcesExternal data connectors (Google Drive, Confluence, etc.)
Liteskill.UsageToken/cost tracking and aggregation
Liteskill.CryptoAES-256-GCM encryption at rest
Liteskill.RbacRole-based permission checks
Liteskill.SettingsApplication-wide settings

Key Design Decisions

  • Event sourcing for chat — Conversations are modeled as event streams for full auditability and state replay. All other domains use standard CRUD with Ecto.
  • CQRS — Write operations go through the event sourcing pipeline; reads query projection tables directly.
  • Boundary enforcement — The boundary library enforces context dependencies at compile time, preventing unauthorized cross-context calls.
  • ReqLLM for all LLM transport — No direct HTTP calls to LLM providers. ReqLLM abstracts provider differences.
  • Unified ACL table — A single entity_acls table handles access control for all entity types (conversations, reports, wiki spaces, agents, etc.).
  • Oban for background jobs — Embedding, data source sync, and agent runs are processed as Oban jobs with configurable queues and concurrency.