AvyOS Architecture
docs/architecture.md
Overview
This document describes how AvyOS is organized in source code and how major runtime components fit together.
Architecture Goals
AvyOS is built as a pure Go userspace stack with these constraints:
- no CGO dependencies in core userspace binaries
- no POSIX-compatibility target as a design requirement
- service-first architecture for system capabilities
- small, readable codebase that is easy to iterate on
Repository Layout
avyos/
|- api/ IPC contracts (`api.json`) and generated client bindings
|- apps/ User-facing applications
|- cmd/ Command-line tools and core user commands
|- services/ Long-running daemons (display, login, settings, etc.)
|- pkg/ Shared libraries used by apps/commands/services
|- docs/ Project and user documentation
|- tools/ Build and code generation tools
|- config/ Default runtime config and service definitions
|- data/ Static runtime assets (icons, wallpapers, themes)
|- kernel/ Kernel integration/config artifacts
`- _cache/ Build outputs and generated docs
Runtime Layers
1. Boot and Init
- boot artifacts are built into an image
cmd/initruns as PID 1- init mounts and prepares runtime state, then starts configured services
2. Core Services
Services expose system functionality through IPC APIs:
services/display- compositor/windowing backendservices/login- authentication and session startupservices/settings- key/value settings storage and watch eventsservices/service- service control and lifecycle operationsservices/uevent- device event forwardingservices/distro- distro/container-style runtime operations
3. APIs and IPC Contracts
api/<name>/api.json defines wire-level contracts:
- service metadata (name, id, package)
- data types (request/response/event payloads)
- request and event IDs
- human-readable descriptions for docs generation
tools/apigen turns these contracts into generated client/server glue.
4. Applications and Commands
apps/contains desktop applicationscmd/contains shell commands and system tools- both layers use
pkg/libraries plus IPC clients fromapi/
5. Shared Libraries (pkg/)
pkg/ is the reusable core used everywhere:
- rendering/input/UI support (
pkg/graphics/...) - IPC transport (
pkg/sutra) - filesystem and identity helpers (
pkg/fs,pkg/identity) - logging/formatting/utilities (
pkg/logger,pkg/format, etc.)
API and Process Model
At a high level:
- apps/commands connect to a service client in
api/<name>. - client sends typed payloads over Sutra IPC.
- service receives request and executes privileged/system logic.
- response/event payloads return through typed API bindings.
This keeps application logic isolated from low-level service internals.
Documentation Model
tools/docgen generates the docs site with grouped sections:
docs/markdown guidesapps/reference pages (doc comments)cmd/reference pages (structured fromflag.Usageoutput)services/reference pages (doc comments)api/reference pages (fromapi.jsonmetadata)pkg/API reference (godoc-style exports)
Build Artifacts
A typical build produces:
- system binaries and assets in
_cache/ - bootable disk image(s)
- generated docs in
_cache/docs/
Current Scope
AvyOS is still experimental. Interfaces, service boundaries, and UX details are actively changing as the platform evolves.