How tobychui/arozos works
1. What this repository is
- ArozOS is a Go-based “web desktop” platform: one backend process serves a full browser UI, manages users and permissions, and exposes OS-like services for files, storage, networking, and device control.
- The architecture is not a single web app; it is a host operating system shell plus a service framework for multiple built-in apps.
2. Top-level runtime model
- The main executable is in src/ (main.go, startup.go, main.router.go, main.flags.go).
- At startup it loads flags, initializes system paths/config, brings up HTTP/TLS listeners, and wires routers to module handlers.
- The process also coordinates background subsystems such as nightly tasks, discovery, networking, and storage initialization.
3. Backend layering
- Core logic is organized as Go modules under src/mod/.
- Each domain area has a module package with its own handler/state logic, while the root-level files in src/ act as the central orchestration layer.
- This creates a clear boundary between platform services and the web UI: the browser talks to Go handlers, not directly to the host OS.
4. Web desktop shell and applications
- The browser-facing UI lives mostly under src/web/ and includes a desktop shell, login/reset pages, system settings, and many app folders such as File Manager, Photo, Music, Video, NotepadA, OfficeViewer, SystemAO, and others.
- Apps are served as static frontend bundles plus app-specific backend scripts or endpoints.
- src/web/desktop.html, login.html, mobile.html, and manifest.webmanifest indicate a desktop/mobile responsive shell with PWA support.
5. File and storage architecture
- The core storage abstraction is in src/mod/storage/ and src/mod/filesystem/.
- The system supports local filesystems, remote filesystems, and protocol bridges such as FTP, SFTP, SMB, and WebDAV.
- Storage pools and virtual file paths are central concepts: the UI and apps operate on abstracted roots, while the backend maps them to real host mounts or remote endpoints.
6. Filesystem-driven data flow
- User actions in the file manager and other apps flow from the browser UI to backend handlers, then into the virtual filesystem layer, then down to local disk or network filesystem adapters.
- Supporting packages handle permissions, hidden files, sorting, metadata extraction, thumbnails, shortcuts, and file operations.
- This layer is the main boundary where application logic meets host OS files and mounted external storage.
7. File sharing and network file servers
- The repository includes built-in sharing/export subsystems under src/mod/fileservers/ and src/mod/share/.
- Supported services include FTP, SFTP, TFTP, WebDAV, Samba, and a lightweight directory server for legacy browser access.
- The share system is separate from normal file browsing: it exposes selected storage content through controlled access modes and service-specific handlers.
8. Authentication, identity, and security
- Authentication is handled under src/mod/auth/ with support for local login flows, account switching, auto-login, batch operations, public registration, LDAP, and OAuth2 providers.
- Security controls include CSRF protection, IP white/blacklists, access control, session/token management, and login timeout logic.
- Permissions and quotas are first-class modules, so authorization is enforced across file, share, and admin operations rather than only at the UI layer.
9. Network and discovery services
- Networking features are grouped under src/mod/network/ and include mDNS, SSDP, UPnP, reverse proxying, gzip middleware, websocket support, Wi-Fi management, neighbor discovery, and network statistics.
- These services support both local LAN discovery and exposure of subservices or web apps to other hosts.
- The architecture treats LAN visibility and port forwarding as platform services, not app-level concerns.
10. System management and device control
- Administrative and hardware-facing logic lives in modules such as src/mod/disk/, src/mod/info/, src/mod/console/, src/mod/cluster/, src/mod/updates/, src/mod/user/, and src/mod/permission/.
- These cover disk health/RAID/SMART, hardware and usage stats, console access, clustering/wake-on-LAN, user/group management, and OTA update flows.
- The src/system/ tree contains the static templates, binary helpers, config files, and platform-specific resources these modules rely on.
11. Media, IoT, and other optional subsystems
- Media-related capabilities are split into src/mod/media/ and app-specific frontend code under src/web/Music, src/web/Video, src/web/Photo, and src/web/PDF Viewer.
- IoT support is in src/mod/iot/ and connects to device discovery/control logic exposed through the UI and AGI scripts.
- These are add-on domains built on top of the same backend routing and storage primitives.
12. Extensibility model
- src/mod/agi/ is the scripting/runtime extension layer: apps and examples show ECMA5-style scripts invoking backend capabilities like file, HTTP, image, and IoT operations.
- src/mod/subservice/ and the “serverless”/proxy-related packages provide a way to mount third-party Go/Python services behind the platform.
- This is a key architectural boundary: core platform services are stable, while features can be extended through scripts, modules, or proxied subservices.
13. Assets, examples, and deployment
- examples/ contains AGI examples that document the app-extension contract and typical backend operations.
- installer/ provides shell-based deployment/uninstall logic for Linux targets; src/system/ includes platform-specific binaries and templates used after installation.
- The project is designed to run self-contained on the host, with most UI assets and supporting libraries shipped in-repo rather than fetched from external services.
14. How to read the architecture diagram
- A useful diagram would place the browser desktop UI on one side, the Go backend orchestration layer in the center, and the host OS plus mounted local/remote storage on the other side.
- Around the backend core, group modules into: auth/security, filesystem/storage, file services, networking/discovery, system/admin, media/IoT, and extensibility.
- The main flows are: browser request → router/module handler → auth/permission check → domain service → host OS/storage/network operation → response back to the frontend.
Main entry points: personalization.html SystemAO · main.router.go Router · agi.go AGI Runtime · auth.go Auth
Components 23
Runtime
Startup and process orchestration
Backend Core
Central Go modules and request routing
- Modules · Loads and coordinates feature modules
src/mod/modules/module.go
Security & Identity
Authentication, permissions, quotas, and sessions
- Auth · Login flows, account switching, LDAP, OAuth2, tokens
src/mod/auth/auth.go - Permissions · Group, permission, and request authorization
src/mod/permission/permission.go - Quota · User and storage quota enforcement
src/mod/quota/quota.go - CSRF · Anti-forgery protection for browser requests
src/mod/security/csrf/csrf.go
Storage & Files
Virtual filesystem, adapters, and file operations
- Filesystem · Virtual paths, operations, hidden files, metadata, shortcuts
src/mod/filesystem/filesystem.go - Storage Pool · Abstracts roots, pools, and storage mappings
src/storage.pool.go - Bridge · Connects storage backends to virtual paths
src/mod/storage/bridge/bridge.go - Local FS · Local disk filesystem adapter
src/mod/filesystem/abstractions/localfs/localfs.go - Remote FS · FTP, SFTP, SMB, and WebDAV filesystem adapters
src/mod/filesystem/abstractions/webdavfs/webdavfs.go
Network & Sharing
Discovery, proxies, and file-serving protocols
- Share · Share entries and public access controls
src/mod/share/share.go - File Servers · FTP, SFTP, TFTP, Samba, WebDAV, and dir serving
src/mod/fileservers/fileservers.go - Network · mDNS, SSDP, UPnP, reverse proxy, websocket, Wi-Fi, stats
src/mod/network/network.go
Web Desktop
Browser shell and built-in apps
- Desktop UI · Browser desktop, login, reset, mobile shell, manifest
src/web/desktop.html - SystemAO · System settings, users, storage, network, security, updates, info
src/web/SystemAO/desktop/personalization.html - File Manager · Browser file explorer, operations, sharing, trash, permissions
src/web/SystemAO/file_system/file_explorer.html - Media Apps · Music, Video, Photo, PDF Viewer, and utilities
src/web/Music/index.html
Extensibility
AGI scripts and subservices
- AGI Runtime · Scripted extension layer for app backends
src/mod/agi/agi.go - Subservice · Hosts external Go or Python services behind the platform
src/mod/subservice/subservice.go - Example Apps · AGI examples and backend contract samples
examples/agi_examples/basics/hello world.js
Connections 28
- Main → Startup: boot · Main initializes startup sequence
- Main → Router: wire routes · Main attaches request routing
- Startup → Modules: load · Boot sequence loads feature modules
- Router → Auth: login · Routes pass through authentication handlers
- Router → Permissions: authorize · Routes enforce permissions
- Router → CSRF: protect · Browser requests are CSRF-checked
- Router → Filesystem: file ops · HTTP handlers expose filesystem services
- Modules → AGI Runtime: extend · Modules expose scripted extension hooks
- Modules → Subservice: mount · Modules can proxy external services into the platform
- AGI Runtime → Filesystem: file api · Scripts call filesystem capabilities
- AGI Runtime → Share: share api · Scripts can create or inspect shares
- AGI Runtime → Network: net api · Scripts can invoke web/network capabilities
- Auth → Permissions: sessions · Identity feeds authorization decisions
- Auth → Quota: limits · Accounts may be subject to quotas
- Filesystem → Storage Pool: roots · Virtual paths resolve through storage pools
- Storage Pool → Bridge: map · Pools map to storage bridges
- Bridge → Local FS: local · Bridges can target local filesystem adapters
- Bridge → Remote FS: remote · Bridges can target remote filesystem adapters
- Share → File Servers: publish · Selected content is exported via file-serving protocols
- Network → File Servers: expose · Network services support hosting and discovery of services
- Desktop UI → SystemAO: launch · Desktop shell opens system administration views
- SystemAO → File Manager: manage files · Admin UI links into file manager flows
- SystemAO → Share: sharing · Admin UI configures sharing and exports
- SystemAO → Network: network · Admin UI configures discovery, proxying, and Wi-Fi
- SystemAO → Auth: identity · Admin UI configures login and account systems
- SystemAO → Permissions: access · Admin UI manages permissions and groups
- Media Apps → Filesystem: browse media · Media apps read content through the filesystem layer
- Example Apps → AGI Runtime: contract · Examples document the AGI extension contract