Project Structure

Understanding the Orbis codebase layout

Project Structure

This guide explains how the Orbis codebase is organized to help you navigate and understand where to find things.

High-Level Overview

text
orbis-assets/
├── crates/                 # Rust backend crates
├── orbis/                  # Tauri desktop app + React frontend
├── plugins/                # Example plugins
├── docs/                   # Documentation (you're here!)
├── target/                 # Rust build output
├── Cargo.toml              # Workspace manifest
└── docker-compose.yml      # Container orchestration

Backend Crates

The Rust backend is organized into focused crates for modularity:

text
crates/
├── orbis-core/            # Core types, errors, and utilities
├── orbis-config/          # Configuration management
├── orbis-db/              # Database layer (SQLite/PostgreSQL)
├── orbis-auth/            # Authentication (JWT, Argon2)
├── orbis-plugin/          # Plugin system and WASM runtime
└── orbis-server/          # HTTP server (for client-server mode)

orbis-core

Foundation types used across all crates:

FilePurpose
error.rsUnified error types
types.rsCommon data structures
mode.rsDeployment mode definitions
profile.rsUser profile types

orbis-config

Configuration from environment and files:

FilePurpose
lib.rsConfiguration aggregation
cli.rsCommand-line argument parsing
database.rsDatabase connection settings
server.rsHTTP server configuration
tls.rsTLS/SSL certificate settings
logging.rsLog level configuration

orbis-db

Database abstraction supporting both SQLite and PostgreSQL:

FilePurpose
connection.rsConnection establishment
pool.rsConnection pooling
migrations.rsSchema migration runner
repository.rsData access patterns

orbis-auth

Authentication and authorization:

FilePurpose
jwt.rsJWT token generation/validation
password.rsArgon2 password hashing
session.rsSession management
user.rsUser data structures

orbis-plugin

The backend of the plugin system:

FilePurpose
lib.rsPublic API exports
loader.rsPlugin loading logic
registry.rsPlugin registration and lookup
runtime.rsWASM execution runtime
sandbox.rsSecurity sandboxing
watcher.rsHot reload file watching

orbis-plugin-api

The plugin system public API - most important for plugin developers:

FilePurpose
lib.rsPublic API exports
manifest.rsPlugin manifest parsing and validation
ui.rsUI schema type definitions (Rust)
runtime.rsWASM execution runtime
sdk/*Plugin SDK functions (DB, HTTP, logging, etc.)

orbis-server

HTTP server for client-server deployment:

FilePurpose
app.rsApplication builder
state.rsShared server state
middleware.rsRequest middleware
extractors.rsRequest extractors
error.rsError handling
tls.rsTLS configuration
routes/*HTTP route handlers

Frontend (Tauri App)

The frontend combines a Tauri shell with a React application:

text
orbis/
├── src/                    # React frontend source
├── src-tauri/              # Tauri/Rust shell
├── public/                 # Static assets
├── package.json            # Node dependencies
├── tsconfig.json           # TypeScript config
├── vite.config.ts          # Vite bundler config
└── vitest.config.ts        # Test configuration

React Frontend (orbis/src/)

text
src/
├── main.tsx               # Application entry point
├── app.tsx                # Root component
├── app.css                # Global styles (Tailwind + shadcn)

├── lib/                   # Core functionality
│   ├── renderer.tsx       # **Schema Renderer**
│   ├── actions.ts         # **Action executor (16 action types)**
│   ├── state.ts           # **State management (Zustand factory)**
│   ├── router.tsx         # Routing configuration
│   ├── layout.tsx         # App layout
│   ├── utils.ts           # Utility functions
│   ├── a11y.ts            # Accessibility utilities
│   ├── performance.ts     # Performance optimization
│   └── form-utils.ts      # Form helpers

├── components/            # UI components
│   ├── ui/                # shadcn/ui components
│   ├── error-boundary.tsx # Error handling
│   ├── loading.tsx        # Loading states
│   └── skip-link.tsx      # Accessibility

├── pages/                 # Application pages
│   ├── dashboard.tsx      # Main dashboard
│   ├── plugins.tsx        # Plugin management
│   ├── settings.tsx       # Settings page
│   ├── login.tsx          # Authentication
│   └── not-found.tsx      # 404 page

├── hooks/                 # React hooks
│   ├── use-plugin-management.ts
│   ├── use-schema-form.ts
│   ├── use-focus-trap.ts
│   └── use-mobile.ts

├── types/                 # TypeScript definitions
│   └── schema/            # **UI schema types**
│       ├── base.ts        # Base types (StateFieldType, etc.)
│       ├── components.ts  # Component schemas
│       ├── actions.ts     # Action type definitions
│       └── index.ts       # Type exports

├── api/                   # API client
│   ├── index.ts           # API exports
│   └── tauri.ts           # Tauri command wrappers

└── tests/                 # Unit tests

Key Files for Frontend Development

  • lib/renderer.tsx - Renders JSON schemas to React components
  • lib/actions.ts - Executes action schemas
  • lib/state.ts - Creates page state stores
  • types/schema/ - TypeScript type definitions

Tauri Shell (orbis/src-tauri/)

text
src-tauri/
├── src/
│   ├── lib.rs             # Tauri plugin registration
│   ├── commands.rs        # Tauri command handlers
│   └── state.rs           # Shared application state
├── tauri.conf.json        # Tauri configuration
├── capabilities/          # Security capabilities
├── icons/                 # App icons
└── Cargo.toml             # Rust dependencies

Plugins Directory

Example plugins for reference:

text
plugins/
├── README.md              # Plugin development guide
├── add_custom_section.py  # Manifest embedding tool
├── hello-plugin/          # Sample plugin
|   ├── manifest.json      # Plugin manifest
|   ├── src/lib.rs         # WASM plugin code
|   ├── Cargo.toml         # Rust dependencies
|   └── build.sh           # Build script
├── my-first-plugin/       # Another sample plugin
|   └── ...
├── quick-start-plugin/    # Quick start example
|   └── ...
└── test-plugin/           # Plugin used in testing
    └── ...

Configuration Files

FilePurpose
Cargo.tomlRust workspace manifest
rustfmt.tomlRust formatting rules
docker-compose.ymlContainer setup

Database Migrations

text
crates/orbis-db/migrations/
├── postgres/              # PostgreSQL migrations
│   └── 001_initial.sql
└── sqlite/                # SQLite migrations
    └── 001_initial.sql

Build Outputs

text
target/
├── debug/                 # Debug builds
├── release/               # Release builds
└── wasm32-unknown-unknown/
    └── release/           # WASM plugin builds

Quick Reference

Where to Find…

Looking for…Location
UI component types (Rust)crates/orbis-plugin/src/ui.rs
UI component types (TypeScript)orbis/src/types/schema/components.ts
Action typesorbis/src/types/schema/actions.ts
Schema rendererorbis/src/lib/renderer.tsx
Action executororbis/src/lib/actions.ts
State managementorbis/src/lib/state.ts
Plugin manifest typescrates/orbis-plugin/src/manifest.rs
Tauri commandsorbis/src-tauri/src/commands.rs
Database queriescrates/orbis-db/src/repository.rs
Authenticationcrates/orbis-auth/src/

Next Steps

Now that you understand the codebase: