docs: comprehensive documentation overhaul

Add complete documentation structure:
- Frontend architecture documentation
- Database schema documentation
- Deployment guides (Docker, Traefik, Authentik, Environment)
- Development guides (Setup, Testing, Contributing, Quality Gates)
- Deployment architecture documentation
- Updated docs README with complete navigation

All new features and APIs are now documented.
Quality gates: docs only, no code changes
This commit is contained in:
Fusion
2026-05-19 14:18:20 +02:00
parent 6807f449b7
commit 83f94b1f09
31 changed files with 5498 additions and 0 deletions
+100
View File
@@ -0,0 +1,100 @@
# Authentication
## Overview
Headquarter uses OAuth2 authentication via Authentik. Users log in through their Authentik identity provider and receive a session cookie for authenticated access.
## How to Use
### Logging In
1. Navigate to the application
2. Click the **"Login"** button in the header
3. You will be redirected to **Authentik**
4. Enter your Authentik credentials
5. You will be redirected back to Headquarter, now logged in
### User Profile
After logging in, you can view your profile:
1. Click your **name** in the header
2. Select **"Profile"** from the dropdown
3. View and edit:
- Display name
- Email
- Avatar (upload or change)
### Logging Out
1. Click your **name** in the header
2. Select **"Logout"**
3. Your session will be cleared
4. You will be redirected to the login page
## Authentication Flow
```
User → Click Login → Authentik Login → OAuth2 Callback → Session Cookie → Authenticated
```
### Technical Details
**Session Management:**
- Uses signed session cookies
- Cookie is `HttpOnly` and `Secure` (in production)
- Session expires after configurable TTL (default: 24 hours)
**OAuth2 Flow:**
1. User clicks login
2. Backend redirects to Authentik authorize URL
3. User authenticates with Authentik
4. Authentik redirects back with authorization code
5. Backend exchanges code for access token
6. Backend fetches user info from Authentik
7. Backend creates/updates local user record
8. Backend sets session cookie
9. User is authenticated
## API Reference
### Endpoints
- `GET /auth/login` - Initiate login (redirects to Authentik)
- `GET /auth/callback` - OAuth2 callback
- `GET /auth/me` - Get current user
- `POST /auth/logout` - Logout (clears session)
See [Auth API](../api/auth.md) for detailed endpoint documentation.
## Configuration
| Variable | Description | Default |
|----------|-------------|---------|
| `AUTHENTIK_DOMAIN` | Authentik server domain | - |
| `AUTHENTIK_CLIENT_ID` | OAuth client ID | - |
| `AUTHENTIK_CLIENT_SECRET` | OAuth client secret | - |
| `AUTHENTIK_APPLICATION_SLUG` | Application slug for URLs | `headquarter-web` |
| `SESSION_SECRET` | Session cookie signing secret | `change-me` |
| `SESSION_TTL_HOURS` | Session duration | `24` |
## Troubleshooting
### Login Loop
**Issue:** After logging in, you're redirected back to login
**Solution:** Check that cookie domain matches your domain configuration
### "Invalid State" Error
**Issue:** Error about invalid state parameter
**Solution:** Clear cookies and try again. If persistent, check Authentik configuration.
### Session Expired
**Issue:** "Session expired" message
**Solution:** Log in again. Session duration is configurable via `SESSION_TTL_HOURS`.
## Related Features
- [User Settings](settings.md) - Configure user preferences
+106
View File
@@ -0,0 +1,106 @@
# Git History Visualization
## Overview
The Git History page provides a visual representation of a repository's commit history, including a branch graph and detailed commit information.
## How to Use
### Accessing History
1. Navigate to a **project workspace**
2. Select a **repository** from the dropdown
3. Click the **"History"** button on the repository card
Or:
1. Go to the **Repositories** page
2. Click **"History"** on any repository card
### History View Layout
```
┌─────────────────────────────────────────────┐
│ [Branch Selector ▼] [Repository Name] │
├─────────────────┬───────────────────────────┤
│ Commit List │ Commit Details │
│ │ │
│ ●─●─○─● │ Commit: abc1234 │
│ │ └─○ │ Author: John Doe │
│ │ │ Date: 2024-01-01 │
│ ● │ │
│ │ │ Message: │
│ ○ │ Fix bug in parser │
│ │ │
│ │ Stats: │
│ │ +15 -3 lines │
│ │ │
│ │ Diff: │
│ │ ```diff │
│ │ + new line │
│ │ - old line │
│ │ ``` │
└─────────────────┴───────────────────────────┘
```
### Commit Graph
The left panel shows:
- **Commit hashes** (abbreviated)
- **Branch/merge indicators** (lines connecting commits)
- **Commit messages** (first line)
- **Author** and **date**
- **Branch tags** (colored labels)
**Graph symbols:**
- `●` - Regular commit
- Branch lines show merge history
- Different colors indicate different branches
### Commit Details
Click any commit to see details:
**Metadata:**
- Full commit hash
- Author name and email
- Commit date and time
- Complete commit message
**Statistics:**
- Files changed
- Lines added (+)
- Lines removed (-)
**Diff:**
- Syntax-highlighted diff
- Added lines in green
- Removed lines in red
- Context lines for reference
### Branch Filtering
Use the **Branch Selector** to filter commits:
- Select **"All"** to see all branches
- Select a specific branch to see only that branch's history
- The graph updates to show only relevant commits
### Navigation
- **Click** a commit to view details
- **Scroll** the commit list to see older commits
- The view shows up to 10,000 commits (loads all at once)
## API Reference
### Endpoints
- `GET /projects/{id}/repositories/{id}/history` - Get commit history
- `GET /projects/{id}/repositories/{id}/commits/{hash}` - Get commit details
See [Repositories API](../api/repositories.md) for detailed endpoint documentation.
## Related Features
- [Git Repositories](repositories.md) - Manage repositories
- [Repository Workspace](workspace.md) - Browse files
+73
View File
@@ -0,0 +1,73 @@
# Project Management
## Overview
Projects are the top-level organizational unit in Headquarter. Each project can contain multiple git repositories and serves as a workspace for related development work.
## How to Use
### Creating a Project
1. Navigate to the **Projects** page from the sidebar
2. Click the **"New Project"** button
3. Enter a **name** for your project (required)
4. Optionally add a **description**
5. Click **"Create Project"**
### Viewing Projects
The Projects page displays all your projects in a card layout showing:
- Project name
- Description (if set)
- Creation date
- Associated repositories count
### Opening a Project Workspace
Click on any project card to open its **workspace**. The workspace is the default view for a project and shows:
- Repository file browser
- Branch selector
- File viewer
### Editing a Project
1. From the Projects page, click the **menu icon** (⋮) on a project card
2. Select **"Edit"**
3. Update the name or description
4. Click **"Save"**
### Deleting a Project
1. From the Projects page, click the **menu icon** (⋮) on a project card
2. Select **"Delete"**
3. Confirm the deletion
**Note:** Deleting a project also deletes all associated repositories and their data. This action cannot be undone.
## Project Workspace
The project workspace is the default view when you click on a project. It provides:
- **Repository Browser**: Navigate files and directories
- **File Viewer**: View file contents with syntax highlighting
- **Branch Management**: Switch between branches
- **Repository Switcher**: Switch between project repositories
See [Repository Workspace](workspace.md) for detailed documentation.
## API Reference
### Endpoints
- `GET /projects` - List all projects
- `POST /projects` - Create a new project
- `GET /projects/{id}` - Get project details
- `PUT /projects/{id}` - Update a project
- `DELETE /projects/{id}` - Delete a project
See [Projects API](../api/projects.md) for detailed endpoint documentation.
## Related Features
- [Repository Workspace](workspace.md) - Browse and edit repository files
- [Git Repositories](repositories.md) - Manage project repositories
+91
View File
@@ -0,0 +1,91 @@
# Git Repositories
## Overview
Git repositories are managed within projects. You can create bare repositories for new projects or clone existing repositories from remote sources.
## How to Use
### Creating a Repository
1. Navigate to a **project workspace** or the **Repositories** page
2. Click the **"New Repository"** button
3. Fill in the form:
- **Name**: Repository name (required)
- **Remote URL**: For cloning (optional)
- **Mirror Clone**: Toggle for mirror clones
4. Click **"Create Repository"**
#### Bare Repository (No Remote URL)
Creates a new bare git repository. Use this for:
- New projects
- Local-only repositories
- Repositories that will be pushed to later
#### Clone from Remote
Enter a git URL to clone from:
- `https://github.com/user/repo.git`
- `git@github.com:user/repo.git`
- `https://gitlab.com/user/repo.git`
**Smart URL Parsing:** If you paste a browser URL (like `https://github.com/user/repo/tree/main`), the system will automatically suggest the correct git URL.
#### Mirror Clone
Enable **"Mirror Clone"** to create a full mirror of a remote repository:
- Clones all branches and tags
- Sets up remote tracking
- Updates can be fetched later
### Smart URL Parsing
When pasting URLs, the system automatically detects browser URLs and suggests the correct git clone URL:
**Examples:**
- `https://github.com/user/repo/tree/main``https://github.com/user/repo.git`
- `https://github.com/user/repo/blob/main/README.md``https://github.com/user/repo.git`
- `https://gitlab.com/user/repo/-/tree/develop``https://gitlab.com/user/repo.git`
You can accept the suggestion or proceed with the original URL.
### Viewing Repositories
The Repositories page shows all repositories in a project:
- Repository name
- Clone URL
- Mirror status
- Creation date
### Repository Actions
Each repository card provides:
- **History**: View commit history and branch graph
- **Browse**: Open in workspace file browser
- **Delete**: Remove the repository
### Deleting a Repository
1. Click the **menu icon** (⋮) on a repository card
2. Select **"Delete"**
3. Confirm the deletion
**Note:** This permanently deletes the repository from disk. This action cannot be undone.
## API Reference
### Endpoints
- `GET /projects/{id}/repositories` - List repositories
- `POST /projects/{id}/repositories` - Create repository
- `DELETE /projects/{id}/repositories/{id}` - Delete repository
- `POST /projects/{id}/repositories/parse-url` - Parse and validate URL
See [Repositories API](../api/repositories.md) for detailed endpoint documentation.
## Related Features
- [Repository Workspace](workspace.md) - Browse repository files
- [Git History](git-history.md) - View commit history
- [Smart Git URL Parsing](repositories.md#smart-url-parsing) - Automatic URL correction
+56
View File
@@ -0,0 +1,56 @@
# User Settings
## Overview
User settings allow you to customize your Headquarter experience, including theme preferences and git identity.
## How to Use
### Accessing Settings
1. Click your **name** in the header
2. Select **"Settings"** from the dropdown
### Theme Selection
Choose your preferred theme:
- **System** - Follows your operating system preference
- **Light** - Light color scheme
- **Dark** - Dark color scheme
Changes are applied immediately and persist across sessions.
### Git Identity
Configure your git identity for commits made through the workspace:
- **Name**: Your display name for git commits
- **Email**: Your email for git commits
This information is used when you make quick edits in the repository workspace.
### Default Editor
Choose your preferred editor for quick edits:
- Options depend on available tool types
- Used when opening files for editing
## Configuration
Settings are stored per-user in the database and persist across sessions.
## API Reference
### Endpoints
- `GET /users/me/config` - Get user settings
- `PATCH /users/me/config` - Update user settings
See [Users API](../api/users.md) for detailed endpoint documentation.
## Related Features
- [Authentication](auth.md) - User authentication
- [Repository Workspace](workspace.md) - Edit files with git identity
+70
View File
@@ -0,0 +1,70 @@
# SSH Key Management
## Overview
Manage SSH key pairs for authenticating with git remotes. Keys are generated and stored securely, with the private key encrypted.
## How to Use
### Generating a Key Pair
1. Navigate to **Settings****SSH Keys**
2. Click **"Generate New Key"**
3. Enter a **name** for the key (e.g., "GitHub Work Account")
4. Click **"Generate"**
The system will:
- Generate an Ed25519 key pair
- Encrypt the private key
- Store both keys securely
- Display the public key
### Copying Public Key
1. Find the key in the list
2. Click the **"Copy"** button next to the public key
3. Paste into your git host (GitHub, GitLab, etc.)
### Adding to Git Hosts
#### GitHub
1. Go to Settings → SSH and GPG keys
2. Click "New SSH key"
3. Paste the public key
4. Give it a title
5. Click "Add SSH key"
#### GitLab
1. Go to Preferences → SSH Keys
2. Paste the public key
3. Set expiration (optional)
4. Click "Add key"
### Deleting Keys
1. Find the key in the list
2. Click the **"Delete"** button
3. Confirm deletion
**Note:** Deleting a key removes both public and private keys. This cannot be undone.
## Security
- **Ed25519 algorithm**: Modern, secure key type
- **Encrypted storage**: Private keys are encrypted at rest
- **No export**: Private keys cannot be exported
- **One-way generation**: Keys are generated server-side, never transmitted
## API Reference
### Endpoints
- `GET /ssh-keys` - List SSH keys
- `POST /ssh-keys` - Generate new key
- `DELETE /ssh-keys/{id}` - Delete key
See [SSH Keys API](../api/ssh-keys.md) for detailed endpoint documentation.
## Related Features
- [Git Repositories](repositories.md) - Use SSH keys for repository access
+104
View File
@@ -0,0 +1,104 @@
# Tool Types
## Overview
Tool types define development tools that can be spawned for projects. Headquarter includes built-in types and supports creating custom tool types with Docker Compose templates.
## How to Use
### Built-in Tool Types
Headquarter includes these built-in tool types:
#### VS Code Server
- **Image**: `lscr.io/linuxserver/code-server:latest`
- **Purpose**: Full VS Code in the browser
- **Features**: Extensions, terminal, debugging
- **Access**: Port 8443
#### Jupyter Notebook
- **Image**: `jupyter/scipy-notebook:latest`
- **Purpose**: Interactive Python development
- **Features**: Notebooks, data visualization
- **Access**: Port 8888
### Managing Tool Types
#### Viewing Tool Types
1. Navigate to **Settings****Tool Types**
2. See a list of all tool types
3. Built-in types are marked with a badge
#### Creating Custom Tool Types
1. Click **"New Tool Type"**
2. Fill in the form:
- **Name**: Unique identifier (e.g., `my-custom-tool`)
- **Display Name**: Human-readable name
- **Description**: What this tool does
- **Compose Template**: Docker Compose YAML
3. Click **"Create"**
#### Compose Template Format
The compose template uses Docker Compose syntax with template variables:
```yaml
version: "3.8"
services:
my-tool:
image: my-image:latest
container_name: {{TOOL_NAME}}
environment:
- VARIABLE=value
volumes:
- {{REPO_PATH}}:/workspace
ports:
- "8080:8080"
```
**Required Variables:**
- `{{TOOL_NAME}}` - Unique name for the container
- `{{REPO_PATH}}` - Path to the repository
#### Validating Templates
The system validates templates:
- Must be valid YAML
- Must contain a `services` section
- Must use all required variables
- Invalid templates will be rejected
#### Editing Tool Types
1. Find the tool type in the list
2. Click **"Edit"**
3. Update fields
4. Click **"Save"**
**Note:** Built-in tool types cannot be modified or deleted.
#### Deleting Tool Types
1. Find the tool type in the list
2. Click **"Delete"**
3. Confirm deletion
**Note:** Built-in tool types cannot be deleted.
## API Reference
### Endpoints
- `GET /tool-types` - List tool types
- `POST /tool-types` - Create tool type
- `GET /tool-types/{id}` - Get tool type details
- `PUT /tool-types/{id}` - Update tool type
- `DELETE /tool-types/{id}` - Delete tool type
See [Tool Types API](../api/tool-types.md) for detailed endpoint documentation.
## Related Features
- [Tool Instances](tool-instances.md) - Spawn and manage tool instances
+101
View File
@@ -0,0 +1,101 @@
# Repository Workspace
## Overview
The Repository Workspace is the default view when you open a project. It provides a file browser and viewer for exploring repository contents, similar to GitHub or GitLab's file browser.
## How to Use
### Workspace Layout
```
┌─────────────────────────────────────────────┐
│ [Repo Selector ▼] [Branch Selector ▼] │
├─────────────────┬───────────────────────────┤
│ File Tree │ Main Content │
│ │ │
│ 📁 src/ │ Breadcrumbs: src > main │
│ 📁 tests/ │ │
│ 📄 README.md │ [Edit] [History] │
│ 📄 .gitignore │ │
│ │ File content here... │
│ │ │
└─────────────────┴───────────────────────────┘
```
### Repository Selection
If a project has multiple repositories:
1. Use the **Repository Selector** dropdown at the top
2. Choose the repository you want to browse
3. The file tree updates automatically
### Branch Selection
1. Use the **Branch Selector** dropdown
2. Select a branch from the list
3. The file tree refreshes to show that branch's contents
### Browsing Files
**Navigate directories:**
- Click on a folder (📁) to expand it
- Click again to collapse
- The file tree shows the full directory structure
**View file contents:**
- Click on a file (📄) to open it
- The file viewer shows:
- File path breadcrumbs
- File content with syntax highlighting
- File metadata (size, last commit)
### File Viewer
The file viewer supports:
- **Syntax highlighting** for common languages
- **Line numbers**
- **Breadcrumb navigation** (click any path segment)
### Quick Editing
For small changes:
1. Open a file in the viewer
2. Click the **"Edit"** button
3. Make your changes in the text area
4. Enter a **commit message**
5. Click **"Save"**
The system will:
- Commit the changes to the current branch
- Show the new commit hash
- Refresh the file view
**Note:** This creates a real git commit. Make sure your commit message describes the change.
### Binary Files
Binary files (images, compiled code, etc.) cannot be viewed or edited in the workspace. The viewer will show "Binary file - cannot display."
## Keyboard Navigation
- **Click** folder to expand/collapse
- **Click** file to view
- **Click** breadcrumb to navigate up
## API Reference
### Endpoints
- `GET /projects/{id}/repositories/{id}/files` - List files in directory
- `GET /projects/{id}/repositories/{id}/files/content` - Get file content
- `POST /projects/{id}/repositories/{id}/files/content` - Update file
- `GET /projects/{id}/repositories/{id}/branches` - List branches
See [Repositories API](../api/repositories.md) for detailed endpoint documentation.
## Related Features
- [Git Repositories](repositories.md) - Manage repositories
- [Git History](git-history.md) - View commit history