Skip to content

ServerKit is a lightweight, modern server control panel for managing web applications, databases, and services on your VPS or dedicated server. Built with Python/Flask backend and React frontend.

Add sidebar prefs, workflow & docs updates

Juan Denisf4a926a69e15
diff --git a/README.md b/README.md
index 6aec4e53..a56ea027 100644
--- a/README.md
+++ b/README.md
@@ -50,11 +50,13 @@ English | [Español](docs/README.es.md) | [中文版](docs/README.zh-CN.md) | [P
**Node.js** — PM2-managed applications with log streaming
-**Docker** — Full container and Docker Compose management
+**Workflow Builder** — Node-based visual automation for server tasks, deployments, and CI/CD
-**Environment Variables** — Secure, encrypted per-app variable management
+**Environment Pipeline** — Multi-environment management for WordPress (Prod/Staging/Dev) with code/DB promotion
-**Git Deployment** — GitHub/GitLab webhooks, auto-deploy on push, branch selection, rollback, zero-downtime deployments
+**Docker** — Full container and Docker Compose management with real-time log streaming and terminal access
+
+**Marketplace** — Over 60+ one-click templates for popular apps (Immich, Ghost, Authelia, etc.)
### 🏗️ Infrastructure
diff --git a/ROADMAP.md b/ROADMAP.md
index 0d3c7e9c..42adc19f 100644
--- a/ROADMAP.md
+++ b/ROADMAP.md
@@ -4,15 +4,17 @@ This document outlines the development roadmap for ServerKit. Features are organ
---
-## Current Version: v1.5.0 (In Development)
+## Current Version: v1.6.0 (In Development)
-### Recently Completed (v1.4.0)
+### Recently Completed (v1.5.0)
+- **New UI & Services Page** - Integrated full Services page with detail views, metrics, logs, and shell.
+- **Environment Pipeline** - Multi-environment management for WordPress (Prod/Staging/Dev) with promotion/sync.
+- **Visual Infrastructure Designer** - Node-based visual canvas for stack deployment and server overview.
+- **Advanced Monitoring UI** - Real-time log streaming and terminal integration in the dashboard.
+- **Template Library Expansion** - Over 60+ one-click deployment templates (Immich, Authelia, Ghost, etc.).
- **Team & Permissions** - RBAC with admin/developer/viewer roles, invitations, audit logging
-- **API Enhancements** - API keys, rate limiting, webhook subscriptions, OpenAPI docs, analytics
- **SSO & OAuth Login** - Google, GitHub, OIDC, SAML with account linking
-- **Database Migrations** - Flask-Migrate/Alembic with versioned schema migrations
-- **Email Server Management** - Postfix, Dovecot, DKIM, SpamAssassin, Roundcube
---
@@ -178,7 +180,22 @@ This document outlines the development roadmap for ServerKit. Features are organ
---
-## Phase 14: Team & Permissions (Completed)
+## Phase 14: Visual Infrastructure Designer (Completed)
+
+**Priority: High**
+
+The visual canvas for designing and deploying entire infrastructure stacks.
+
+- [x] Node-based Visual Canvas (`WorkflowBuilder.jsx`) using React Flow
+- [x] Infrastructure component nodes (Docker, Database, Domain, Service)
+- [x] Smart connection rules (link apps to DBs, domains to apps)
+- [x] One-click stack deployment from the canvas
+- [x] Template-based stack generation
+- [x] Server overview mode (visualize existing infrastructure)
+
+---
+
+## Phase 15: Team & Permissions (Completed)
**Priority: Medium**
@@ -191,7 +208,7 @@ This document outlines the development roadmap for ServerKit. Features are organ
---
-## Phase 15: API Enhancements (Completed)
+## Phase 16: API Enhancements (Completed)
**Priority: Medium**
@@ -203,7 +220,7 @@ This document outlines the development roadmap for ServerKit. Features are organ
---
-## Phase 16: Advanced Security (Completed)
+## Phase 17: Advanced Security (Completed)
**Priority: High**
@@ -219,7 +236,7 @@ This document outlines the development roadmap for ServerKit. Features are organ
---
-## Phase 17: SSO & OAuth Login (Completed)
+## Phase 18: SSO & OAuth Login (Completed)
**Priority: High**
@@ -236,101 +253,86 @@ This document outlines the development roadmap for ServerKit. Features are organ
---
-## Phase 18: Database Migrations & Schema Versioning (Completed)
+## Phase 19: Database Migrations & Schema Versioning (Completed)
**Priority: High**
-### Backend — Migration Engine
-- [x] Integrate Flask-Migrate (Alembic) for versioned schema migrations
-- [x] Generate initial migration from current model state as baseline
-- [x] Replace `_auto_migrate_columns()` hack with proper Alembic migrations
-- [x] Store schema version in a `schema_version` table (current version, history)
-- [x] API endpoints for migration status, apply, and rollback
-- [x] Auto-detect pending migrations on login and flag the session
-- [x] Pre-migration automatic DB backup before applying changes
-- [x] Migration scripts for all existing model changes (retroactive baseline)
-
-### CLI Fallback
-- [x] CLI commands for headless/SSH scenarios (`flask db upgrade`, `flask db status`)
-- [x] CLI rollback support (`flask db downgrade`)
+- [x] Flask-Migrate (Alembic) integration
+- [x] Migration wizard UI (Completed)
+- [x] CLI fallback support
---
-# Upcoming Development
+## Phase 20: New UI & Services Page (Completed)
-The phases below are ordered by priority. Higher phases ship first.
+**Priority: Critical**
----
+Integrated full Services page with detail views, metrics, logs, shell, settings, and package management.
-## Phase 19: New UI & Services Page (Planned)
+- [x] Services list page with status indicators and quick actions
+- [x] Service detail page with tabbed interface (Metrics, Logs, Shell, Settings, Commands, Events, Packages)
+- [x] Git connect modal for linking services to repositories
+- [x] Gunicorn management tab for Python services
+- [x] Service type detection and type-specific UI (Node, Python, PHP, Docker, etc.)
-**Priority: Critical**
+---
-Merge the `new-ui` branch — adds a full Services page with service detail views, metrics, logs, shell, settings, git connect, and package management.
+## Phase 21: Environment Pipeline (Completed)
-- [ ] Merge `new-ui` branch into main development line
-- [ ] Services list page with status indicators and quick actions
-- [ ] Service detail page with tabbed interface (Metrics, Logs, Shell, Settings, Commands, Events, Packages)
-- [ ] Git connect modal for linking services to repositories
-- [ ] Gunicorn management tab for Python services
-- [ ] Service type detection and type-specific UI (Node, Python, PHP, Docker, etc.)
-- [ ] Resolve any conflicts with features added since branch diverged
+**Priority: High**
+
+- [x] WordPress multi-environment pipeline (Prod/Staging/Dev)
+- [x] Code and Database promotion between environments
+- [x] Production syncing and environment locking
---
-## Phase 20: Customizable Sidebar & Dashboard Views (Planned)
+## Phase 22: Container Logs & Monitoring UI (Completed)
**Priority: High**
-Let users personalize what they see. Not everyone runs email servers or manages Docker — the sidebar should adapt to each user's needs.
+- [x] Real-time log streaming via WebSocket with ANSI color support
+- [x] Web-based terminal (`Terminal.jsx`) with shell access
+- [x] Per-app resource usage charts (CPU, RAM)
+- [x] Log search and filtering
-- [ ] Sidebar configuration page in Settings
-- [ ] Preset view profiles: **Full** (default, all modules), **Web Hosting** (apps, domains, SSL, databases, files), **Email Admin** (email, DNS, security), **Docker/DevOps** (containers, deployments, git, monitoring), **Minimal** (apps, monitoring, backups only)
-- [ ] Custom view builder — toggle individual sidebar items on/off
-- [ ] Per-user preference storage (saved to user profile, synced across sessions)
-- [ ] Sidebar sections collapse/expand with memory
-- [ ] Quick-switch between saved view profiles
-- [ ] Admin can set default view for new users
-- [ ] Hide empty/unconfigured modules automatically (e.g., hide Email if no email domains exist)
+---
+
+# Upcoming Development
+
+The phases below are ordered by priority. Higher phases ship first.
---
-## Phase 21: Migration Wizard Frontend UI (Planned)
+## Phase 23: Advanced Workflow & Automation Engine (NEW)
-**Priority: High**
+**Priority: Critical**
-The backend migration engine is complete — this adds the visual upgrade experience (Matomo-style).
+Moving beyond static design to dynamic, event-driven automation. This turns ServerKit into a powerful automation hub.
-- [ ] Full-screen modal/wizard that appears when pending migrations are detected
-- [ ] Step 1: "Update Available" — show current version vs new version, changelog summary
-- [ ] Step 2: "Backup" — auto-backup the database, show progress, confirm success
-- [ ] Step 3: "Apply Migrations" — run migrations with real-time progress/log output
-- [ ] Step 4: "Done" — success confirmation with summary of changes applied
-- [ ] Error handling: if a migration fails, show the error and offer rollback option
-- [ ] Block access to the panel until migrations are applied
-- [ ] Migration history page in Settings showing all past migrations and timestamps
+- [ ] **Event Triggers:** Run workflows on Git push, health check failure, high CPU usage, or Webhook receipt.
+- [ ] **Cron Integration:** Schedule workflows to run on recurring intervals (e.g., "Every Sunday at 2 AM, backup all DBs and rotate logs").
+- [ ] **Cross-Server Actions:** "When Server A's database is backed up, sync it to Server B and notify Discord."
+- [ ] **Logic Nodes:** If/Else conditions, loops, and custom Python/Shell script execution nodes.
+- [ ] **State Machine:** Track workflow execution history, retries on failure, and execution logs.
+- [ ] **Global Variables:** Pass data between workflow steps (e.g., take the output of a build step and pass it to a deployment step).
---
-## Phase 22: Container Logs & Monitoring UI (Planned)
+## Phase 24: Customizable Sidebar & Dashboard Views (Completed)
**Priority: High**
-The container logs API is already built. This phase adds the frontend and extends monitoring to per-app metrics.
+Let users personalize what they see. Not everyone runs email servers or manages Docker — the sidebar should adapt to each user's needs.
-- [ ] Log viewer component with terminal-style display and ANSI color support
-- [ ] Real-time log streaming via WebSocket with auto-scroll (pause on user scroll)
-- [ ] Log search with regex support and match highlighting
-- [ ] Filter by log level (INFO, WARN, ERROR, DEBUG) and time range
-- [ ] Export filtered logs to file
-- [ ] Per-container resource collection (CPU %, memory, network I/O via Docker stats API)
-- [ ] Per-app resource usage charts (Recharts) with time range selector (1h, 6h, 24h, 7d)
-- [ ] Per-app alert rules (metric, operator, threshold, duration)
-- [ ] Alert notifications via existing channels (email, Discord, Telegram) with cooldown
+- [x] Sidebar configuration page in Settings
+- [x] Preset view profiles (Full, Web Hosting, Email Admin, Docker/DevOps, Minimal)
+- [x] Custom view builder — toggle individual sidebar items on/off
+- [x] Per-user preference storage (saved to user profile)
---
-## Phase 23: Agent Fleet Management (Planned)
+## Phase 25: Agent Fleet Management (Planned)
**Priority: High**
@@ -350,7 +352,7 @@ Level up agent management from "connect and monitor" to full fleet control.
---
-## Phase 24: Cross-Server Monitoring Dashboard (Planned)
+## Phase 26: Cross-Server Monitoring Dashboard (Planned)
**Priority: High**
@@ -369,7 +371,7 @@ Fleet-wide visibility — see everything at a glance and catch problems early.
---
-## Phase 25: Agent Plugin System (Planned)
+## Phase 27: Agent Plugin System (Planned)
**Priority: High**
@@ -389,22 +391,9 @@ Make the agent extensible — let users add custom capabilities without modifyin
- [ ] Scheduled tasks — plugins can register periodic jobs (cron-like)
- [ ] Event hooks — plugins can react to agent events (connect, disconnect, command, alert)
-### Panel Integration
-- [ ] Plugin management UI — install, configure, monitor plugins per server
-- [ ] Plugin marketplace / registry — browse and install community plugins
-- [ ] Plugin configuration editor — per-server plugin settings from the panel
-- [ ] Plugin logs and diagnostics — view plugin output and errors
-- [ ] Plugin metrics visualization — custom widgets for plugin-reported data
-
-### Developer Experience
-- [ ] Plugin SDK (Go module) — scaffolding, helpers, testing tools
-- [ ] Plugin template repository — quickstart for new plugin development
-- [ ] Local plugin development mode — hot-reload, debug logging
-- [ ] Plugin documentation and API reference
-
---
-## Phase 26: Server Templates & Config Sync (Planned)
+## Phase 28: Server Templates & Config Sync (Planned)
**Priority: Medium**
@@ -423,7 +412,7 @@ Define what a server should look like, apply it, and detect when it drifts.
---
-## Phase 27: Multi-Tenancy & Workspaces (Planned)
+## Phase 29: Multi-Tenancy & Workspaces (Planned)
**Priority: Medium**
@@ -442,7 +431,7 @@ Isolate servers by team, client, or project. Essential for agencies, MSPs, and l
---
-## Phase 28: Advanced SSL Features (Planned)
+## Phase 30: Advanced SSL Features (Planned)
**Priority: Medium**
@@ -456,7 +445,7 @@ Isolate servers by team, client, or project. Essential for agencies, MSPs, and l
---
-## Phase 29: DNS Zone Management (Planned)
+## Phase 31: DNS Zone Management (Planned)
**Priority: Medium**
@@ -473,7 +462,7 @@ Full DNS record management with provider API integration.
---
-## Phase 30: Nginx Advanced Configuration (Planned)
+## Phase 32: Nginx Advanced Configuration (Planned)
**Priority: Medium**
@@ -491,7 +480,7 @@ Go beyond basic virtual hosts — full reverse proxy and performance configurati
---
-## Phase 31: Status Page & Health Checks (Planned)
+## Phase 33: Status Page & Health Checks (Planned)
**Priority: Medium**
@@ -510,7 +499,7 @@ Public-facing status page and automated health monitoring.
---
-## Phase 32: Server Provisioning APIs (Planned)
+## Phase 34: Server Provisioning APIs (Planned)
**Priority: Medium**
@@ -529,7 +518,7 @@ Spin up and manage cloud servers directly from the panel.
---
-## Phase 33: Performance Optimization (Planned)
+## Phase 35: Performance Optimization (Planned)
**Priority: Low**
@@ -542,7 +531,7 @@ Spin up and manage cloud servers directly from the panel.
---
-## Phase 34: Mobile App (Future)
+## Phase 36: Mobile App (Future)
**Priority: Low — v3.0+**
@@ -554,7 +543,7 @@ Spin up and manage cloud servers directly from the panel.
---
-## Phase 35: Marketplace & Extensions (Future)
+## Phase 37: Marketplace & Extensions (Future)
**Priority: Low — v3.0+**
@@ -576,8 +565,8 @@ Spin up and manage cloud servers directly from the panel.
| v1.2.0 | Backups, Advanced SSL, Advanced Security | Completed |
| v1.3.0 | Email server, API enhancements | Completed |
| v1.4.0 | Team & permissions, SSO & OAuth login | Completed |
-| v1.5.0 | New UI, customizable sidebar, migration wizard UI | Current |
-| v1.6.0 | Container monitoring UI, agent fleet management | Planned |
+| v1.5.0 | New UI, Visual Designer, Services Page | Current |
+| v1.6.0 | Advanced Automation Engine, fleet management | Planned |
| v1.7.0 | Cross-server monitoring, agent plugin system | Planned |
| v1.8.0 | Server templates, multi-tenancy | Planned |
| v1.9.0 | Advanced SSL, DNS management, Nginx config | Planned |
diff --git a/backend/app/api/auth.py b/backend/app/api/auth.py
index adc7d7c7..471b0131 100644
--- a/backend/app/api/auth.py
+++ b/backend/app/api/auth.py
@@ -312,6 +312,18 @@ def update_current_user():
return jsonify({'error': 'Password must be at least 8 characters'}), 400
user.set_password(data['password'])
+ if 'sidebar_config' in data:
+ config = data['sidebar_config']
+ if isinstance(config, dict):
+ preset = config.get('preset', 'full')
+ valid_presets = ['full', 'web', 'email', 'devops', 'minimal', 'custom']
+ if preset not in valid_presets:
+ return jsonify({'error': f'Invalid sidebar preset: {preset}'}), 400
+ hidden = config.get('hiddenItems', [])
+ if not isinstance(hidden, list):
+ return jsonify({'error': 'hiddenItems must be a list'}), 400
+ user.set_sidebar_config({'preset': preset, 'hiddenItems': hidden})
+
db.session.commit()
return jsonify({'user': user.to_dict()}), 200
diff --git a/backend/app/models/user.py b/backend/app/models/user.py
index ab8fb244..8c373d87 100644
--- a/backend/app/models/user.py
+++ b/backend/app/models/user.py
@@ -36,6 +36,9 @@ class User(db.Model):
backup_codes = db.Column(db.Text, nullable=True) # JSON array of hashed backup codes
totp_confirmed_at = db.Column(db.DateTime, nullable=True) # When 2FA was enabled
+ # Sidebar preferences: { preset: 'full'|'web'|'email'|'devops'|'minimal'|'custom', hiddenItems: [...] }
+ sidebar_config = db.Column(db.Text, nullable=True)
+
# Relationships
applications = db.relationship('Application', backref='owner', lazy='dynamic')
@@ -166,6 +169,19 @@ class User(db.Model):
feature_perms = perms.get(feature, {})
return feature_perms.get(level, False)
+ def get_sidebar_config(self):
+ """Return sidebar config dict, or default."""
+ if self.sidebar_config:
+ try:
+ return json.loads(self.sidebar_config)
+ except (json.JSONDecodeError, TypeError):
+ pass
+ return {'preset': 'full', 'hiddenItems': []}
+
+ def set_sidebar_config(self, config):
+ """Store sidebar config as JSON."""
+ self.sidebar_config = json.dumps(config) if config else None
+
def to_dict(self):
return {
'id': self.id,
@@ -177,6 +193,7 @@ class User(db.Model):
'totp_enabled': self.totp_enabled,
'auth_provider': self.auth_provider or 'local',
'has_password': self.has_password,
+ 'sidebar_config': self.get_sidebar_config(),
'created_at': self.created_at.isoformat(),
'updated_at': self.updated_at.isoformat(),
'last_login_at': self.last_login_at.isoformat() if self.last_login_at else None,
diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.md
index 9b2aad3a..eb52d3ff 100644
--- a/docs/ARCHITECTURE.md
+++ b/docs/ARCHITECTURE.md
@@ -11,6 +11,8 @@
- [Template System](#template-system)
- [Port Allocation](#port-allocation)
- [Database Linking](#database-linking)
+- [Workflow Automation](#workflow-automation)
+- [Environment Pipeline](#environment-pipeline)
- [File Paths](#file-paths)
---
@@ -97,27 +99,6 @@ User Request What Happens
└─────────┘
```
-### Detailed Nginx → Container Flow
-
-```
- NGINX CONFIG DOCKER
- /etc/nginx/sites-enabled/ CONTAINER
- ───────────────────────── ─────────────────
-
- server {
- listen 80;
- server_name my-blog.com;
- ┌─────────────────┐
- location / { │ WordPress │
- proxy_pass ─────────────────────────► │ │
- http://127.0.0.1:8001; │ 0.0.0.0:80 │
- proxy_set_header Host $host; │ ▲ │
- proxy_set_header X-Real-IP ...; │ │ │
- } │ (mapped to │
- } │ host:8001) │
- └─────────────────┘
-```
-
---
## Template System
@@ -135,106 +116,6 @@ User Request What Happens
│ └────┬────┘ └────┬────┘ └────┬────┘ └────┬────┘ └────┬────┘ │
│ │ │ │ │ │ │
└────────┼────────────┼────────────┼────────────┼────────────┼───────────────────┘
- │ │ │ │ │
- │ User clicks "Deploy" in UI │
- │ │ │
- ▼ ▼ ▼
-┌─────────────────────────────────────────────────────────────────────────────────┐
-│ SERVERKIT BACKEND │
-│ │
-│ TemplateService.install_template() │
-│ ├── 1. Parse template YAML │
-│ ├── 2. Generate unique port (8000-60000) │
-│ ├── 3. Substitute variables: │
-│ │ ${APP_NAME} → "my-blog" │
-│ │ ${HTTP_PORT} → "8247" │
-│ │ ${DB_PASSWORD} → "auto_generated" │
-│ ├── 4. Create /var/serverkit/apps/my-blog/docker-compose.yml │
-│ ├── 5. Run: docker compose up -d --build │
-│ └── 6. Store app record in database │
-│ │
-└─────────────────────────────────────────────────────────────────────────────────┘
- │
- ▼
-┌─────────────────────────────────────────────────────────────────────────────────┐
-│ APP CREATED │
-│ │
-│ ┌─────────────────────────────────────────────────────────────────────────┐ │
-│ │ App Name: my-blog │ │
-│ │ Type: docker │ │
-│ │ Port: 8247 (auto-assigned) │ │
-│ │ Status: running │ │
-│ │ Container: my-blog │ │
-│ │ Path: /var/serverkit/apps/my-blog/ │ │
-│ │ │ │
-│ │ Private URL: http://server-ip:8247 ◄── Works immediately! │ │
-│ └─────────────────────────────────────────────────────────────────────────┘ │
-│ │
-└─────────────────────────────────────────────────────────────────────────────────┘
- │
- │ User clicks "Connect Domain"
- ▼
-┌─────────────────────────────────────────────────────────────────────────────────┐
-│ DOMAIN CONNECTED │
-│ │
-│ DomainService.create_domain() │
-│ ├── 1. Validate domain DNS points to server │
-│ ├── 2. Check container port is accessible │
-│ ├── 3. Generate Nginx config: │
-│ │ │
-│ │ server { │
-│ │ listen 80; │
-│ │ server_name my-blog.com; │
-│ │ │
-│ │ location / { │
-│ │ proxy_pass http://127.0.0.1:8247; ◄── Container port │
-│ │ proxy_set_header Host $host; │
-│ │ proxy_set_header X-Real-IP $remote_addr; │
-│ │ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; │
-│ │ proxy_set_header X-Forwarded-Proto $scheme; │
-│ │ } │
-│ │ } │
-│ │ │
-│ ├── 4. Write to /etc/nginx/sites-available/my-blog │
-│ ├── 5. Symlink to /etc/nginx/sites-enabled/my-blog │
-│ ├── 6. Test config: nginx -t │
-│ ├── 7. Reload: systemctl reload nginx │
-│ └── 8. (Optional) Request SSL via Let's Encrypt │
-│ │
-│ Public URL: https://my-blog.com ◄── Now accessible worldwide! │
-│ │
-└─────────────────────────────────────────────────────────────────────────────────┘
-```
-
-### Template YAML Structure
-
-```yaml
-# Example: flask-hello-world.yaml
-
-id: flask-hello-world
-name: Flask - Hello World
-version: "1.0"
-description: Simple Flask debug app
-categories:
- - development
- - api
-
-variables:
- - name: HTTP_PORT # Variable name
- type: port # Auto-generates available port
- default: "5000" # Starting port to search from
- hidden: true # Don't show in UI
-
-compose: # Docker Compose configuration
- services:
- app:
- image: python:3.12-slim
- container_name: ${APP_NAME}
- ports:
- - "${HTTP_PORT}:5000" # Host:Container port mapping
- environment:
- - APP_NAME=${APP_NAME}
- - EXTERNAL_PORT=${HTTP_PORT}
```
---
@@ -243,144 +124,62 @@ compose: # Docker Compose configuration
### How ServerKit Finds Available Ports
+ServerKit automatically scans the database, Docker, and system sockets to find the first available port (starting from 8000) for new applications, ensuring no conflicts occur during deployment.
+
+---
+
+## Database Linking
+
+### How Apps Connect to Databases
+
+ServerKit automates the creation of databases and users, then injects the credentials as environment variables (`DB_HOST`, `DB_USER`, etc.) directly into the application container, allowing for seamless connectivity.
+
+---
+
+## Workflow Automation
+
+ServerKit includes a node-based visual workflow builder for automating server tasks.
+
```
┌─────────────────────────────────────────────────────────────────────────────────┐
-│ PORT ALLOCATION │
+│ WORKFLOW BUILDER │
│ │
-│ TemplateService._find_available_port(start=8000) │
-│ │
-│ ┌─────────────────────────────────────────────────────────────────────────┐ │
-│ │ Step 1: Check Database │ │
-│ │ SELECT port FROM applications WHERE port IS NOT NULL │ │
-│ │ Result: [8001, 8002, 8005, 8010] │ │
-│ └─────────────────────────────────────────────────────────────────────────┘ │
-│ │ │
-│ ▼ │
-│ ┌─────────────────────────────────────────────────────────────────────────┐ │
-│ │ Step 2: Check Docker │ │
-│ │ docker ps --format '{{.Ports}}' │ │
-│ │ Parse: "0.0.0.0:8003->80/tcp" → 8003 │ │
-│ │ Result: [8003, 8004] │ │
-│ └─────────────────────────────────────────────────────────────────────────┘ │
-│ │ │
-│ ▼ │
-│ ┌─────────────────────────────────────────────────────────────────────────┐ │
-│ │ Step 3: Socket Bind Test │ │
-│ │ Try: socket.bind(('127.0.0.1', port)) │ │
-│ │ If fails → port in use by system │ │
-│ └─────────────────────────────────────────────────────────────────────────┘ │
-│ │ │
-│ ▼ │
-│ ┌─────────────────────────────────────────────────────────────────────────┐ │
-│ │ Step 4: Return First Available │ │
-│ │ │ │
-│ │ Checking 8000... taken (DB) │ │
-│ │ Checking 8001... taken (DB) │ │
-│ │ Checking 8002... taken (DB) │ │
-│ │ Checking 8003... taken (Docker) │ │
-│ │ Checking 8004... taken (Docker) │ │
-│ │ Checking 8005... taken (DB) │ │
-│ │ Checking 8006... AVAILABLE ✓ │ │
-│ │ │ │
-│ │ Return: 8006 │ │
-│ └─────────────────────────────────────────────────────────────────────────┘ │
+│ ┌───────────┐ ┌───────────┐ ┌───────────┐ ┌───────────┐ │
+│ │ TRIGGER │──────▶│ ACTION │──────▶│ CONDITION │──────▶│ NOTIFY │ │
+│ │ (Git Push)│ │ (Build) │ │ (Success?)│ │ (Discord) │ │
+│ └───────────┘ └───────────┘ └─────┬─────┘ └───────────┘ │
+│ │ │
+│ ▼ │
+│ ┌───────────┐ │
+│ │ ROLLBACK │ │
+│ └───────────┘ │
│ │
└─────────────────────────────────────────────────────────────────────────────────┘
```
-### Port Map Example
-
-```
-┌──────────┬────────────────────────────────────────┐
-│ Port │ Service │
-├──────────┼────────────────────────────────────────┤
-│ 22 │ SSH │
-│ 80 │ Nginx (HTTP) │
-│ 443 │ Nginx (HTTPS) │
-│ 3306 │ MySQL │
-│ 5432 │ PostgreSQL │
-│ 5000 │ ServerKit Backend API │
-│ 6379 │ Redis │
-├──────────┼────────────────────────────────────────┤
-│ 8001 │ App: wordpress-blog │
-│ 8002 │ App: flask-api │
-│ 8003 │ App: node-frontend │
-│ 8004 │ App: grafana-monitoring │
-│ 8005 │ App: n8n-automation │
-│ 8006 │ App: (next available) │
-│ ... │ ... │
-│ 60000 │ (max port range) │
-└──────────┴────────────────────────────────────────┘
-```
+- **Nodes:** Represent individual steps (Triggers, Actions, Logic, Notifications).
+- **Edges:** Define the flow of execution.
+- **Engine:** The `WorkflowService` parses the JSON graph and executes steps sequentially or in parallel.
---
-## Database Linking
+## Environment Pipeline
-### How Apps Connect to Databases
+Specifically designed for WordPress, the environment pipeline allows for professional staging/dev workflows.
```
-┌────────────────────────────────────────────────────────────────────────────────┐
-│ │
-│ ┌──────────────────┐ ┌──────────────────┐ │
-│ │ APP (Flask) │ │ DATABASE (MySQL) │ │
-│ │ │ │ │ │
-│ │ Needs DB access │ │ db: my_app_db │ │
-│ │ │ │ user: app_user │ │
-│ └────────┬─────────┘ └────────┬─────────┘ │
-│ │ │ │
-│ │ User clicks "Link Database" │ │
-│ │ │ │
-│ └──────────────┬───────────────────┘ │
-│ │ │
-│ ▼ │
-│ ┌────────────────────────────────────────────────────────────────────────┐ │
-│ │ SERVERKIT LINKS THEM │ │
-│ │ │ │
-│ │ 1. Creates database: my_app_db │ │
-│ │ 2. Creates user with secure password │ │
-│ │ 3. Grants permissions │ │
-│ │ 4. Injects environment variables into app container: │ │
-│ │ │ │
-│ │ ┌─────────────────────────────────────────────────────────────┐ │ │
-│ │ │ DB_HOST=localhost │ │ │
-│ │ │ DB_PORT=3306 │ │ │
-│ │ │ DB_NAME=my_app_db │ │ │
-│ │ │ DB_USER=app_user │ │ │
-│ │ │ DB_PASSWORD=xK9#mP2$vL7@nQ4 │ │ │
-│ │ │ │ │ │
-│ │ │ # Also provides connection URL format: │ │ │
-│ │ │ DATABASE_URL=mysql://app_user:xK9#mP2$vL7@nQ4@localhost/db │ │ │
-│ │ └─────────────────────────────────────────────────────────────┘ │ │
-│ │ │ │
-│ │ 5. Restarts app container to pick up new env vars │ │
-│ │ │ │
-│ └────────────────────────────────────────────────────────────────────────┘ │
-│ │ │
-│ ▼ │
-│ ┌────────────────────────────────────────────────────────────────────────┐ │
-│ │ APP CODE │ │
-│ │ │ │
-│ │ # Python/Flask example │ │
-│ │ import os │ │
-│ │ import mysql.connector │ │
-│ │ │ │
-│ │ db = mysql.connector.connect( │ │
-│ │ host=os.environ['DB_HOST'], # localhost │ │
-│ │ port=os.environ['DB_PORT'], # 3306 │ │
-│ │ database=os.environ['DB_NAME'], # my_app_db │ │
-│ │ user=os.environ['DB_USER'], # app_user │ │
-│ │ password=os.environ['DB_PASSWORD'] │ │
-│ │ ) │ │
-│ │ │ │
-│ │ # Or use the URL directly: │ │
-│ │ # SQLAlchemy: create_engine(os.environ['DATABASE_URL']) │ │
-│ │ │ │
-│ └────────────────────────────────────────────────────────────────────────┘ │
-│ │
-└─────────────────────────────────────────────────────────────────────────────────┘
+┌──────────────┐ promotion ┌──────────────┐ promotion ┌──────────────┐
+│ DEV │───────────▶│ STAGING │───────────▶│ PRODUCTION │
+│ (Standalone) │ │ (Standalone) │ │ (Production) │
+└──────┬───────┘ └──────┬───────┘ └──────┬───────┘
+ │ │ │
+ └─────────── sync ──────────┴─────────── sync ──────────┘
```
+- **Promotion:** Push code (Git) and Database from a lower environment to a higher one.
+- **Syncing:** Pull the latest production database and media to dev/staging for testing.
+- **Sanitization:** Automatically strip sensitive user data during sync.
+
---
## File Paths
@@ -388,168 +187,30 @@ compose: # Docker Compose configuration
### Where Everything Lives
```
-SERVER FILESYSTEM
-─────────────────────────────────────────────────────────────────────────────────
-
/var/serverkit/ # ServerKit data root
├── apps/ # All deployed applications
-│ ├── my-blog/
-│ │ ├── docker-compose.yml # Generated from template
-│ │ ├── .env # Environment variables
-│ │ └── data/ # Persistent volumes
-│ ├── flask-api/
-│ │ ├── docker-compose.yml
-│ │ └── app/ # Application code
-│ └── ...
-│
├── backups/ # Database backups
-│ ├── mysql/
-│ └── postgres/
-│
-└── ssl/ # SSL certificates (if not using certbot)
+└── ssl/ # SSL certificates
/etc/serverkit/ # ServerKit configuration
├── templates/ # Template library (YAML files)
-│ ├── wordpress.yaml
-│ ├── flask-hello-world.yaml
-│ ├── grafana.yaml
-│ └── ...
└── config.yaml # Main config
-
-/etc/nginx/ # Nginx configuration
-├── sites-available/ # All site configs
-│ ├── my-blog # Generated by ServerKit
-│ ├── flask-api
-│ └── default
-├── sites-enabled/ # Enabled sites (symlinks)
-│ ├── my-blog -> ../sites-available/my-blog
-│ └── flask-api -> ../sites-available/flask-api
-└── nginx.conf # Main nginx config
-
-/var/log/nginx/ # Nginx logs (per-app)
-├── my-blog.access.log
-├── my-blog.error.log
-├── flask-api.access.log
-└── flask-api.error.log
-
-/var/lib/mysql/ # MySQL data
-/var/lib/postgresql/ # PostgreSQL data
```
---
## Component Diagram
-```
-┌─────────────────────────────────────────────────────────────────────────────────┐
-│ SERVERKIT │
-│ │
-│ ┌─────────────────────────────────────────────────────────────────────────┐ │
-│ │ FRONTEND (React) │ │
-│ │ Served via Nginx :80/443 │ │
-│ │ │ │
-│ │ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐ │ │
-│ │ │Dashboard │ │ Apps │ │ Domains │ │ Docker │ │ Security │ │ │
-│ │ └──────────┘ └──────────┘ └──────────┘ └──────────┘ └──────────┘ │ │
-│ │ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐ │ │
-│ │ │Databases │ │Templates │ │ Firewall │ │ Cron │ │ Settings │ │ │
-│ │ └──────────┘ └──────────┘ └──────────┘ └──────────┘ └──────────┘ │ │
-│ │ │ │
-│ └─────────────────────────────────┬────────────────────────────────────────┘ │
-│ │ │
-│ REST API + WebSocket │
-│ │ │
-│ ▼ │
-│ ┌─────────────────────────────────────────────────────────────────────────┐ │
-│ │ BACKEND (Flask) │ │
-│ │ Port 5000 │ │
-│ │ │ │
-│ │ ┌─────────────────────────────────────────────────────────────────┐ │ │
-│ │ │ SERVICES │ │ │
-│ │ │ │ │ │
-│ │ │ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │ │ │
-│ │ │ │DockerService │ │ NginxService │ │TemplateServ. │ │ │ │
-│ │ │ │ │ │ │ │ │ │ │ │
-│ │ │ │ • compose_up │ │ • create_site│ │ • install │ │ │ │
-│ │ │ │ • logs │ │ • enable_ssl │ │ • variables │ │ │ │
-│ │ │ │ • stats │ │ • reload │ │ • validate │ │ │ │
-│ │ │ └──────────────┘ └──────────────┘ └──────────────┘ │ │ │
-│ │ │ │ │ │
-│ │ │ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │ │ │
-│ │ │ │ DBService │ │ SSLService │ │SecurityServ. │ │ │ │
-│ │ │ │ │ │ │ │ │ │ │ │
-│ │ │ │ • create_db │ │ • certbot │ │ • ClamAV │ │ │ │
-│ │ │ │ • users │ │ • renew │ │ • 2FA │ │ │ │
-│ │ │ │ • backup │ │ • wildcard │ │ • firewall │ │ │ │
-│ │ │ └──────────────┘ └──────────────┘ └──────────────┘ │ │ │
-│ │ │ │ │ │
-│ │ └──────────────────────────────────────────────────────────────────┘ │ │
-│ │ │ │
-│ └─────────────────────────────────┬────────────────────────────────────────┘ │
-│ │ │
-│ ▼ │
-│ ┌─────────────────────────────────────────────────────────────────────────┐ │
-│ │ DATABASE (SQLite/PostgreSQL) │ │
-│ │ │ │
-│ │ ┌───────────┐ ┌───────────┐ ┌───────────┐ ┌───────────┐ ┌─────────┐ │ │
-│ │ │ Apps │ │ Domains │ │ Users │ │ Databases │ │ Settings│ │ │
-│ │ └───────────┘ └───────────┘ └───────────┘ └───────────┘ └─────────┘ │ │
-│ │ │ │
-│ └─────────────────────────────────────────────────────────────────────────┘ │
-│ │
-└──────────────────────────────────────────────────────────────────────────────────┘
-```
+ServerKit follows a modern 3-tier architecture:
+1. **Frontend:** React-based dashboard served via Nginx.
+2. **Backend:** Flask REST API managing Docker, Nginx, and system services.
+3. **Agent:** Go-based remote agent for multi-server management.
---
## Troubleshooting
-### 502 Bad Gateway
-
-```
-Problem: Nginx can't reach the container
-
-Check:
-┌─────────────────────────────────────────────────────────────────┐
-│ 1. Is container running? │
-│ docker ps | grep <app-name> │
-│ │
-│ 2. Is port bound to host? │
-│ docker port <container-name> │
-│ Expected: 5000/tcp -> 0.0.0.0:8001 │
-│ │
-│ 3. Is port accessible? │
-│ curl -I http://127.0.0.1:8001 │
-│ Expected: HTTP/1.1 200 OK │
-│ │
-│ 4. Does nginx config have correct port? │
-│ cat /etc/nginx/sites-enabled/<app-name> │
-│ Check: proxy_pass http://127.0.0.1:8001; │
-│ │
-│ 5. Check nginx error log: │
-│ tail -50 /var/log/nginx/<app-name>.error.log │
-└─────────────────────────────────────────────────────────────────┘
-```
-
-### Container Won't Start
-
-```
-Problem: docker compose up fails
-
-Check:
-┌─────────────────────────────────────────────────────────────────┐
-│ 1. Check compose logs: │
-│ cd /var/serverkit/apps/<app-name> │
-│ docker compose logs │
-│ │
-│ 2. Validate compose file: │
-│ docker compose config │
-│ │
-│ 3. Check for port conflicts: │
-│ docker ps --format "{{.Ports}}" │
-│ netstat -tulpn | grep <port> │
-└─────────────────────────────────────────────────────────────────┘
-```
+Refer to the [Deployment Guide](DEPLOYMENT.md) for detailed troubleshooting steps regarding 502 errors, container failures, and networking issues.
---
diff --git a/frontend/src/components/Sidebar.jsx b/frontend/src/components/Sidebar.jsx
index 8fb567af..199b7653 100644
--- a/frontend/src/components/Sidebar.jsx
+++ b/frontend/src/components/Sidebar.jsx
@@ -1,10 +1,11 @@
-import React, { useState, useEffect, useRef } from 'react';
+import React, { useState, useEffect, useRef, useMemo } from 'react';
import { NavLink, useNavigate } from 'react-router-dom';
import { useAuth } from '../contexts/AuthContext';
import { useTheme } from '../contexts/ThemeContext';
import { Star, Settings, LogOut, Sun, Moon, Monitor, ChevronRight, ChevronUp, Layers } from 'lucide-react';
import { api } from '../services/api';
import ServerKitLogo from './ServerKitLogo';
+import { SIDEBAR_CATEGORIES, CATEGORY_LABELS, getVisibleItems } from './sidebarItems';
const Sidebar = () => {
const { user, logout } = useAuth();
@@ -47,8 +48,6 @@ const Sidebar = () => {
};
const scheduleNext = () => {
- // Each time it plays, the next interval gets longer
- // 1st: 8-11 min, 2nd: 16-22 min, 3rd: 24-33 min, etc.
const multiplier = playCount + 1;
const minMinutes = 8 * multiplier;
const maxMinutes = 11 * multiplier;
@@ -60,7 +59,6 @@ const Sidebar = () => {
}, delay);
};
- // First play after 1 minute
const initialDelay = setTimeout(() => {
triggerAnimation();
scheduleNext();
@@ -72,6 +70,55 @@ const Sidebar = () => {
};
}, [whiteLabel.enabled]);
+ const conditions = { wpInstalled };
+
+ const visibleItems = useMemo(
+ () => getVisibleItems(user?.sidebar_config),
+ [user?.sidebar_config]
+ );
+
+ // Group visible items by category
+ const groupedItems = useMemo(() => {
+ const groups = {};
+ for (const cat of SIDEBAR_CATEGORIES) {
+ const items = visibleItems.filter(item => item.category === cat);
+ if (items.length > 0) {
+ groups[cat] = items;
+ }
+ }
+ return groups;
+ }, [visibleItems]);
+
+ const renderNavItem = (item) => (
+ <React.Fragment key={item.id}>
+ <NavLink
+ to={item.route}
+ className={({ isActive }) => `nav-item ${isActive ? 'active' : ''}`}
+ end={item.end || false}
+ >
+ <svg className="nav-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor"
+ dangerouslySetInnerHTML={{ __html: item.icon }}
+ />
+ {item.label}
+ </NavLink>
+ {item.subItems?.map(sub => {
+ if (sub.requiresCondition && !conditions[sub.requiresCondition]) return null;
+ return (
+ <NavLink
+ key={sub.id}
+ to={sub.route}
+ className={({ isActive }) => `nav-item nav-sub-item ${isActive ? 'active' : ''}`}
+ >
+ <svg className="nav-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor"
+ dangerouslySetInnerHTML={{ __html: sub.icon }}
+ />
+ {sub.label}
+ </NavLink>
+ );
+ })}
+ </React.Fragment>
+ );
+
return (
<aside className="sidebar">
{whiteLabel.enabled ? (
@@ -129,186 +176,18 @@ const Sidebar = () => {
)}
<div className="nav-scroll">
- <div className="nav-category">Overview</div>
- <nav className="nav">
- <NavLink to="/" className={({ isActive }) => `nav-item ${isActive ? 'active' : ''}`} end>
- <svg className="nav-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor">
- <rect x="3" y="3" width="7" height="7"/>
- <rect x="14" y="3" width="7" height="7"/>
- <rect x="14" y="14" width="7" height="7"/>
- <rect x="3" y="14" width="7" height="7"/>
- </svg>
- Dashboard
- </NavLink>
- </nav>
-
- <div className="nav-category">Infrastructure</div>
- <nav className="nav">
- <NavLink to="/servers" className={({ isActive }) => `nav-item ${isActive ? 'active' : ''}`}>
- <svg className="nav-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor">
- <rect x="2" y="2" width="20" height="8" rx="2" ry="2"/>
- <rect x="2" y="14" width="20" height="8" rx="2" ry="2"/>
- <line x1="6" y1="6" x2="6.01" y2="6"/>
- <line x1="6" y1="18" x2="6.01" y2="18"/>
- </svg>
- Servers
- </NavLink>
- <NavLink to="/domains" className={({ isActive }) => `nav-item ${isActive ? 'active' : ''}`}>
- <svg className="nav-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor">
- <circle cx="12" cy="12" r="10"/>
- <line x1="2" y1="12" x2="22" y2="12"/>
- <path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"/>
- </svg>
- Domains & Sites
- </NavLink>
- <NavLink to="/services" className={({ isActive }) => `nav-item ${isActive ? 'active' : ''}`}>
- <svg className="nav-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor">
- <path d="M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"/>
- <polyline points="3.27 6.96 12 12.01 20.73 6.96"/>
- <line x1="12" y1="22.08" x2="12" y2="12"/>
- </svg>
- Services
- </NavLink>
- <NavLink to="/wordpress" className={({ isActive }) => `nav-item ${isActive ? 'active' : ''}`}>
- <svg className="nav-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor">
- <circle cx="12" cy="12" r="10"/>
- <path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"/>
- <path d="M3.5 9h17M3.5 15h17"/>
- </svg>
- WordPress
- </NavLink>
- {wpInstalled && (
- <NavLink to="/wordpress/projects" className={({ isActive }) => `nav-item nav-sub-item ${isActive ? 'active' : ''}`}>
- <svg className="nav-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor">
- <path d="M22 12h-4l-3 9L9 3l-3 9H2"/>
- </svg>
- Pipeline
- </NavLink>
- )}
- <NavLink to="/templates" className={({ isActive }) => `nav-item ${isActive ? 'active' : ''}`}>
- <svg className="nav-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor">
- <rect x="3" y="3" width="7" height="9"/>
- <rect x="14" y="3" width="7" height="5"/>
- <rect x="14" y="12" width="7" height="9"/>
- <rect x="3" y="16" width="7" height="5"/>
- </svg>
- Templates
- </NavLink>
- <NavLink to="/workflow" className={({ isActive }) => `nav-item ${isActive ? 'active' : ''}`}>
- <svg className="nav-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor">
- <circle cx="18" cy="5" r="3"/>
- <circle cx="6" cy="12" r="3"/>
- <circle cx="18" cy="19" r="3"/>
- <path d="M8.59 13.51l6.83 3.98"/>
- <path d="M15.41 6.51l-6.82 3.98"/>
- </svg>
- Workflow Builder
- </NavLink>
- <NavLink to="/databases" className={({ isActive }) => `nav-item ${isActive ? 'active' : ''}`}>
- <svg className="nav-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor">
- <ellipse cx="12" cy="5" rx="9" ry="3"/>
- <path d="M21 12c0 1.66-4 3-9 3s-9-1.34-9-3"/>
- <path d="M3 5v14c0 1.66 4 3 9 3s9-1.34 9-3V5"/>
- </svg>
- Databases
- </NavLink>
- <NavLink to="/ssl" className={({ isActive }) => `nav-item ${isActive ? 'active' : ''}`}>
- <svg className="nav-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor">
- <rect x="3" y="11" width="18" height="11" rx="2" ry="2"/>
- <path d="M7 11V7a5 5 0 0 1 10 0v4"/>
- </svg>
- SSL Certificates
- </NavLink>
- <NavLink to="/docker" className={({ isActive }) => `nav-item ${isActive ? 'active' : ''}`}>
- <svg className="nav-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor">
- <rect x="2" y="7" width="6" height="6" rx="1"/>
- <rect x="9" y="7" width="6" height="6" rx="1"/>
- <rect x="16" y="7" width="6" height="6" rx="1"/>
- <rect x="2" y="14" width="6" height="6" rx="1"/>
- <rect x="9" y="14" width="6" height="6" rx="1"/>
- </svg>
- Docker
- </NavLink>
- <NavLink to="/git" className={({ isActive }) => `nav-item ${isActive ? 'active' : ''}`}>
- <svg className="nav-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor">
- <circle cx="18" cy="18" r="3"/>
- <circle cx="6" cy="6" r="3"/>
- <path d="M6 21V9a9 9 0 0 0 9 9"/>
- </svg>
- Git
- </NavLink>
- </nav>
-
- <div className="nav-category">Operations</div>
- <nav className="nav">
- <NavLink to="/files" className={({ isActive }) => `nav-item ${isActive ? 'active' : ''}`}>
- <svg className="nav-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor">
- <path d="M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"/>
- </svg>
- File Manager
- </NavLink>
- <NavLink to="/ftp" className={({ isActive }) => `nav-item ${isActive ? 'active' : ''}`}>
- <svg className="nav-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor">
- <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/>
- <polyline points="17 8 12 3 7 8"/>
- <line x1="12" y1="3" x2="12" y2="15"/>
- </svg>
- FTP Server
- </NavLink>
- <NavLink to="/monitoring" className={({ isActive }) => `nav-item ${isActive ? 'active' : ''}`}>
- <svg className="nav-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor">
- <path d="M22 12h-4l-3 9L9 3l-3 9H2"/>
- </svg>
- Monitoring
- </NavLink>
- <NavLink to="/backups" className={({ isActive }) => `nav-item ${isActive ? 'active' : ''}`}>
- <svg className="nav-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor">
- <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/>
- <polyline points="7 10 12 15 17 10"/>
- <line x1="12" y1="15" x2="12" y2="3"/>
- </svg>
- Backups
- </NavLink>
- <NavLink to="/cron" className={({ isActive }) => `nav-item ${isActive ? 'active' : ''}`}>
- <svg className="nav-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor">
- <circle cx="12" cy="12" r="10"/>
- <polyline points="12 6 12 12 16 14"/>
- </svg>
- Cron Jobs
- </NavLink>
- <NavLink to="/security" className={({ isActive }) => `nav-item ${isActive ? 'active' : ''}`}>
- <svg className="nav-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor">
- <path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"/>
- <path d="M12 8v4m0 4h.01"/>
- </svg>
- Security
- </NavLink>
- <NavLink to="/email" className={({ isActive }) => `nav-item ${isActive ? 'active' : ''}`}>
- <svg className="nav-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor">
- <path d="M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z"/>
- <polyline points="22,6 12,13 2,6"/>
- </svg>
- Email Server
- </NavLink>
- </nav>
-
- <div className="nav-category">System</div>
- <nav className="nav">
- <NavLink to="/terminal" className={({ isActive }) => `nav-item ${isActive ? 'active' : ''}`}>
- <svg className="nav-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor">
- <path d="M4 17l6-6-6-6M12 19h8"/>
- </svg>
- Terminal / Logs
- </NavLink>
- <NavLink to="/downloads" className={({ isActive }) => `nav-item ${isActive ? 'active' : ''}`}>
- <svg className="nav-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor">
- <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/>
- <polyline points="7 10 12 15 17 10"/>
- <line x1="12" y1="15" x2="12" y2="3"/>
- </svg>
- Downloads
- </NavLink>
- </nav>
+ {SIDEBAR_CATEGORIES.map(cat => {
+ const items = groupedItems[cat];
+ if (!items) return null;
+ return (
+ <React.Fragment key={cat}>
+ <div className="nav-category">{CATEGORY_LABELS[cat]}</div>
+ <nav className="nav">
+ {items.map(renderNavItem)}
+ </nav>
+ </React.Fragment>
+ );
+ })}
</div>
<div className="sidebar-footer" ref={menuRef}>
diff --git a/frontend/src/components/settings/SidebarSettings.jsx b/frontend/src/components/settings/SidebarSettings.jsx
new file mode 100644
index 00000000..6b9d0eb8
--- /dev/null
+++ b/frontend/src/components/settings/SidebarSettings.jsx
@@ -0,0 +1,220 @@
+import { useState, useMemo } from 'react';
+import { useAuth } from '../../contexts/AuthContext';
+import api from '../../services/api';
+import { Check, RotateCcw } from 'lucide-react';
+import {
+ SIDEBAR_ITEMS,
+ SIDEBAR_PRESETS,
+ SIDEBAR_CATEGORIES,
+ CATEGORY_LABELS
+} from '../sidebarItems';
+
+const PRESET_ICONS = {
+ full: <svg viewBox="0 0 24 24" width="20" height="20" fill="none" stroke="currentColor"><rect x="3" y="3" width="7" height="7"/><rect x="14" y="3" width="7" height="7"/><rect x="14" y="14" width="7" height="7"/><rect x="3" y="14" width="7" height="7"/></svg>,
+ web: <svg viewBox="0 0 24 24" width="20" height="20" fill="none" stroke="currentColor"><circle cx="12" cy="12" r="10"/><line x1="2" y1="12" x2="22" y2="12"/><path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"/></svg>,
+ email: <svg viewBox="0 0 24 24" width="20" height="20" fill="none" stroke="currentColor"><path d="M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z"/><polyline points="22,6 12,13 2,6"/></svg>,
+ devops: <svg viewBox="0 0 24 24" width="20" height="20" fill="none" stroke="currentColor"><rect x="2" y="7" width="6" height="6" rx="1"/><rect x="9" y="7" width="6" height="6" rx="1"/><rect x="16" y="7" width="6" height="6" rx="1"/><rect x="2" y="14" width="6" height="6" rx="1"/><rect x="9" y="14" width="6" height="6" rx="1"/></svg>,
+ minimal: <svg viewBox="0 0 24 24" width="20" height="20" fill="none" stroke="currentColor"><line x1="3" y1="12" x2="21" y2="12"/><line x1="3" y1="6" x2="21" y2="6"/><line x1="3" y1="18" x2="21" y2="18"/></svg>
+};
+
+const SidebarSettings = () => {
+ const { user, updateUser } = useAuth();
+ const currentConfig = user?.sidebar_config || { preset: 'full', hiddenItems: [] };
+ const [preset, setPreset] = useState(currentConfig.preset || 'full');
+ const [hiddenItems, setHiddenItems] = useState(currentConfig.hiddenItems || []);
+ const [saving, setSaving] = useState(false);
+ const [message, setMessage] = useState(null);
+
+ const toggleableItems = useMemo(
+ () => SIDEBAR_ITEMS.filter(item => !item.alwaysVisible),
+ []
+ );
+
+ const activeHidden = preset === 'custom'
+ ? hiddenItems
+ : (SIDEBAR_PRESETS[preset]?.hiddenItems || []);
+
+ const visibleCount = SIDEBAR_ITEMS.filter(
+ item => item.alwaysVisible || !activeHidden.includes(item.id)
+ ).length;
+
+ const handlePresetChange = (newPreset) => {
+ if (newPreset === preset) return;
+ setPreset(newPreset);
+ if (newPreset !== 'custom') {
+ setHiddenItems(SIDEBAR_PRESETS[newPreset]?.hiddenItems || []);
+ }
+ };
+
+ const handleToggleItem = (itemId) => {
+ // Switching to custom mode when toggling
+ if (preset !== 'custom') {
+ setPreset('custom');
+ // Start from current preset's hidden items
+ const currentHidden = SIDEBAR_PRESETS[preset]?.hiddenItems || [];
+ const newHidden = currentHidden.includes(itemId)
+ ? currentHidden.filter(id => id !== itemId)
+ : [...currentHidden, itemId];
+ setHiddenItems(newHidden);
+ } else {
+ setHiddenItems(prev =>
+ prev.includes(itemId)
+ ? prev.filter(id => id !== itemId)
+ : [...prev, itemId]
+ );
+ }
+ };
+
+ const handleSave = async () => {
+ setSaving(true);
+ setMessage(null);
+ try {
+ const config = { preset, hiddenItems: preset === 'custom' ? hiddenItems : [] };
+ await api.updateCurrentUser({ sidebar_config: config });
+ await updateUser({ sidebar_config: config });
+ setMessage({ type: 'success', text: 'Sidebar preferences saved' });
+ } catch (err) {
+ setMessage({ type: 'error', text: err.message || 'Failed to save preferences' });
+ } finally {
+ setSaving(false);
+ setTimeout(() => setMessage(null), 3000);
+ }
+ };
+
+ const handleReset = () => {
+ setPreset('full');
+ setHiddenItems([]);
+ };
+
+ const hasChanges = preset !== (currentConfig.preset || 'full') ||
+ JSON.stringify(hiddenItems) !== JSON.stringify(currentConfig.hiddenItems || []);
+
+ return (
+ <div className="sidebar-settings">
+ <div className="settings-section">
+ <h3>View Profiles</h3>
+ <p className="settings-section-desc">
+ Choose a preset or build a custom view. Only visible items appear in your sidebar.
+ </p>
+
+ <div className="sidebar-presets">
+ {Object.entries(SIDEBAR_PRESETS).map(([key, profile]) => (
+ <button
+ key={key}
+ className={`sidebar-preset-card ${preset === key ? 'active' : ''}`}
+ onClick={() => handlePresetChange(key)}
+ >
+ <div className="preset-card-icon">
+ {PRESET_ICONS[key]}
+ </div>
+ <div className="preset-card-info">
+ <span className="preset-card-label">{profile.label}</span>
+ <span className="preset-card-desc">{profile.description}</span>
+ </div>
+ {preset === key && (
+ <div className="preset-card-check">
+ <Check size={16} />
+ </div>
+ )}
+ </button>
+ ))}
+ <button
+ className={`sidebar-preset-card ${preset === 'custom' ? 'active' : ''}`}
+ onClick={() => handlePresetChange('custom')}
+ >
+ <div className="preset-card-icon">
+ <svg viewBox="0 0 24 24" width="20" height="20" fill="none" stroke="currentColor">
+ <path d="M12 20h9"/><path d="M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z"/>
+ </svg>
+ </div>
+ <div className="preset-card-info">
+ <span className="preset-card-label">Custom</span>
+ <span className="preset-card-desc">Toggle individual items on/off</span>
+ </div>
+ {preset === 'custom' && (
+ <div className="preset-card-check">
+ <Check size={16} />
+ </div>
+ )}
+ </button>
+ </div>
+ </div>
+
+ <div className="settings-section">
+ <div className="settings-section-header">
+ <h3>Sidebar Items</h3>
+ <span className="sidebar-item-count">{visibleCount} of {SIDEBAR_ITEMS.length} visible</span>
+ </div>
+ <p className="settings-section-desc">
+ {preset === 'custom'
+ ? 'Toggle items to show or hide them in your sidebar.'
+ : `Showing items for the "${SIDEBAR_PRESETS[preset]?.label || preset}" profile. Switch to Custom to modify individually.`
+ }
+ </p>
+
+ <div className="sidebar-items-list">
+ {SIDEBAR_CATEGORIES.map(cat => {
+ const catItems = toggleableItems.filter(item => item.category === cat);
+ if (catItems.length === 0) return null;
+ return (
+ <div key={cat} className="sidebar-items-group">
+ <div className="sidebar-items-group-label">{CATEGORY_LABELS[cat]}</div>
+ {catItems.map(item => {
+ const isVisible = !activeHidden.includes(item.id);
+ return (
+ <label
+ key={item.id}
+ className={`sidebar-item-toggle ${!isVisible ? 'hidden-item' : ''}`}
+ >
+ <div className="sidebar-item-toggle-info">
+ <svg className="sidebar-item-toggle-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor"
+ dangerouslySetInnerHTML={{ __html: item.icon }}
+ />
+ <span>{item.label}</span>
+ </div>
+ <div className={`toggle-switch ${isVisible ? 'on' : ''}`}
+ onClick={(e) => {
+ e.preventDefault();
+ handleToggleItem(item.id);
+ }}
+ >
+ <div className="toggle-knob" />
+ </div>
+ </label>
+ );
+ })}
+ </div>
+ );
+ })}
+ </div>
+ </div>
+
+ <div className="sidebar-settings-actions">
+ <button
+ className="btn btn-ghost"
+ onClick={handleReset}
+ disabled={preset === 'full' && hiddenItems.length === 0}
+ >
+ <RotateCcw size={14} />
+ Reset to Default
+ </button>
+ <button
+ className="btn btn-primary"
+ onClick={handleSave}
+ disabled={saving || !hasChanges}
+ >
+ {saving ? 'Saving...' : 'Save Changes'}
+ </button>
+ </div>
+
+ {message && (
+ <div className={`settings-message ${message.type}`}>
+ {message.type === 'success' && <Check size={14} />}
+ {message.text}
+ </div>
+ )}
+ </div>
+ );
+};
+
+export default SidebarSettings;
diff --git a/frontend/src/components/sidebarItems.js b/frontend/src/components/sidebarItems.js
new file mode 100644
index 00000000..ce1409f0
--- /dev/null
+++ b/frontend/src/components/sidebarItems.js
@@ -0,0 +1,210 @@
+// Sidebar navigation items definition
+// Each item has: id, label, route, category, icon (SVG paths), and optional sub-items
+// The 'dashboard' item is always visible and cannot be hidden
+
+export const SIDEBAR_CATEGORIES = ['overview', 'infrastructure', 'operations', 'system'];
+
+export const CATEGORY_LABELS = {
+ overview: 'Overview',
+ infrastructure: 'Infrastructure',
+ operations: 'Operations',
+ system: 'System'
+};
+
+export const SIDEBAR_ITEMS = [
+ {
+ id: 'dashboard',
+ label: 'Dashboard',
+ route: '/',
+ category: 'overview',
+ alwaysVisible: true,
+ end: true,
+ icon: '<rect x="3" y="3" width="7" height="7"/><rect x="14" y="3" width="7" height="7"/><rect x="14" y="14" width="7" height="7"/><rect x="3" y="14" width="7" height="7"/>'
+ },
+ {
+ id: 'servers',
+ label: 'Servers',
+ route: '/servers',
+ category: 'infrastructure',
+ icon: '<rect x="2" y="2" width="20" height="8" rx="2" ry="2"/><rect x="2" y="14" width="20" height="8" rx="2" ry="2"/><line x1="6" y1="6" x2="6.01" y2="6"/><line x1="6" y1="18" x2="6.01" y2="18"/>'
+ },
+ {
+ id: 'domains',
+ label: 'Domains & Sites',
+ route: '/domains',
+ category: 'infrastructure',
+ icon: '<circle cx="12" cy="12" r="10"/><line x1="2" y1="12" x2="22" y2="12"/><path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"/>'
+ },
+ {
+ id: 'services',
+ label: 'Services',
+ route: '/services',
+ category: 'infrastructure',
+ icon: '<path d="M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"/><polyline points="3.27 6.96 12 12.01 20.73 6.96"/><line x1="12" y1="22.08" x2="12" y2="12"/>'
+ },
+ {
+ id: 'wordpress',
+ label: 'WordPress',
+ route: '/wordpress',
+ category: 'infrastructure',
+ icon: '<circle cx="12" cy="12" r="10"/><path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"/><path d="M3.5 9h17M3.5 15h17"/>',
+ subItems: [
+ {
+ id: 'wp-pipeline',
+ label: 'Pipeline',
+ route: '/wordpress/projects',
+ requiresCondition: 'wpInstalled',
+ icon: '<path d="M22 12h-4l-3 9L9 3l-3 9H2"/>'
+ }
+ ]
+ },
+ {
+ id: 'templates',
+ label: 'Templates',
+ route: '/templates',
+ category: 'infrastructure',
+ icon: '<rect x="3" y="3" width="7" height="9"/><rect x="14" y="3" width="7" height="5"/><rect x="14" y="12" width="7" height="9"/><rect x="3" y="16" width="7" height="5"/>'
+ },
+ {
+ id: 'workflow',
+ label: 'Workflow Builder',
+ route: '/workflow',
+ category: 'infrastructure',
+ icon: '<circle cx="18" cy="5" r="3"/><circle cx="6" cy="12" r="3"/><circle cx="18" cy="19" r="3"/><path d="M8.59 13.51l6.83 3.98"/><path d="M15.41 6.51l-6.82 3.98"/>'
+ },
+ {
+ id: 'databases',
+ label: 'Databases',
+ route: '/databases',
+ category: 'infrastructure',
+ icon: '<ellipse cx="12" cy="5" rx="9" ry="3"/><path d="M21 12c0 1.66-4 3-9 3s-9-1.34-9-3"/><path d="M3 5v14c0 1.66 4 3 9 3s9-1.34 9-3V5"/>'
+ },
+ {
+ id: 'ssl',
+ label: 'SSL Certificates',
+ route: '/ssl',
+ category: 'infrastructure',
+ icon: '<rect x="3" y="11" width="18" height="11" rx="2" ry="2"/><path d="M7 11V7a5 5 0 0 1 10 0v4"/>'
+ },
+ {
+ id: 'docker',
+ label: 'Docker',
+ route: '/docker',
+ category: 'infrastructure',
+ icon: '<rect x="2" y="7" width="6" height="6" rx="1"/><rect x="9" y="7" width="6" height="6" rx="1"/><rect x="16" y="7" width="6" height="6" rx="1"/><rect x="2" y="14" width="6" height="6" rx="1"/><rect x="9" y="14" width="6" height="6" rx="1"/>'
+ },
+ {
+ id: 'git',
+ label: 'Git',
+ route: '/git',
+ category: 'infrastructure',
+ icon: '<circle cx="18" cy="18" r="3"/><circle cx="6" cy="6" r="3"/><path d="M6 21V9a9 9 0 0 0 9 9"/>'
+ },
+ {
+ id: 'files',
+ label: 'File Manager',
+ route: '/files',
+ category: 'operations',
+ icon: '<path d="M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"/>'
+ },
+ {
+ id: 'ftp',
+ label: 'FTP Server',
+ route: '/ftp',
+ category: 'operations',
+ icon: '<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="17 8 12 3 7 8"/><line x1="12" y1="3" x2="12" y2="15"/>'
+ },
+ {
+ id: 'monitoring',
+ label: 'Monitoring',
+ route: '/monitoring',
+ category: 'operations',
+ icon: '<path d="M22 12h-4l-3 9L9 3l-3 9H2"/>'
+ },
+ {
+ id: 'backups',
+ label: 'Backups',
+ route: '/backups',
+ category: 'operations',
+ icon: '<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="7 10 12 15 17 10"/><line x1="12" y1="15" x2="12" y2="3"/>'
+ },
+ {
+ id: 'cron',
+ label: 'Cron Jobs',
+ route: '/cron',
+ category: 'operations',
+ icon: '<circle cx="12" cy="12" r="10"/><polyline points="12 6 12 12 16 14"/>'
+ },
+ {
+ id: 'security',
+ label: 'Security',
+ route: '/security',
+ category: 'operations',
+ icon: '<path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"/><path d="M12 8v4m0 4h.01"/>'
+ },
+ {
+ id: 'email',
+ label: 'Email Server',
+ route: '/email',
+ category: 'operations',
+ icon: '<path d="M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z"/><polyline points="22,6 12,13 2,6"/>'
+ },
+ {
+ id: 'terminal',
+ label: 'Terminal / Logs',
+ route: '/terminal',
+ category: 'system',
+ icon: '<path d="M4 17l6-6-6-6M12 19h8"/>'
+ },
+ {
+ id: 'downloads',
+ label: 'Downloads',
+ route: '/downloads',
+ category: 'system',
+ icon: '<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="7 10 12 15 17 10"/><line x1="12" y1="15" x2="12" y2="3"/>'
+ }
+];
+
+// Preset profiles define which items are hidden
+export const SIDEBAR_PRESETS = {
+ full: {
+ label: 'Full',
+ description: 'All sidebar items visible',
+ hiddenItems: []
+ },
+ web: {
+ label: 'Web Hosting',
+ description: 'Domains, SSL, databases, and web essentials',
+ hiddenItems: ['docker', 'git', 'email', 'workflow']
+ },
+ email: {
+ label: 'Email Admin',
+ description: 'Email server, security, DNS, and monitoring',
+ hiddenItems: ['docker', 'git', 'wordpress', 'templates', 'workflow', 'ftp']
+ },
+ devops: {
+ label: 'Docker / DevOps',
+ description: 'Docker, Git, monitoring, and CI/CD tools',
+ hiddenItems: ['wordpress', 'templates', 'email', 'ftp', 'ssl']
+ },
+ minimal: {
+ label: 'Minimal',
+ description: 'Just the essentials — dashboard, servers, terminal',
+ hiddenItems: ['wordpress', 'templates', 'workflow', 'ftp', 'email', 'git', 'docker', 'ssl', 'cron', 'downloads']
+ }
+};
+
+// Get visible items based on config
+export function getVisibleItems(sidebarConfig) {
+ const { preset = 'full', hiddenItems = [] } = sidebarConfig || {};
+
+ // For custom preset, use hiddenItems directly
+ // For named presets, use the preset's hiddenItems
+ const hidden = preset === 'custom'
+ ? hiddenItems
+ : (SIDEBAR_PRESETS[preset]?.hiddenItems || []);
+
+ return SIDEBAR_ITEMS.filter(item =>
+ item.alwaysVisible || !hidden.includes(item.id)
+ );
+}
diff --git a/frontend/src/pages/Settings.jsx b/frontend/src/pages/Settings.jsx
index 12e42042..97642cbd 100644
--- a/frontend/src/pages/Settings.jsx
+++ b/frontend/src/pages/Settings.jsx
@@ -10,6 +10,7 @@ import ActivityTab from '../components/settings/ActivityTab';
import SSOConfigTab from '../components/settings/SSOConfigTab';
import MigrationHistoryTab from '../components/settings/MigrationHistoryTab';
import ApiSettingsTab from '../components/settings/ApiSettingsTab';
+import SidebarSettings from '../components/settings/SidebarSettings';
import SSOProviderIcon from '../components/SSOProviderIcon';
import {
Github, FileText, HelpCircle, MessageSquare, Bug, Check, Download, CheckCircle,
@@ -25,7 +26,7 @@ import {
} from 'lucide-react';
import ServerKitLogo from '../components/ServerKitLogo';
-const VALID_TABS = ['profile', 'security', 'appearance', 'notifications', 'system', 'users', 'audit', 'activity', 'site', 'sso', 'api', 'migrations', 'developer', 'about'];
+const VALID_TABS = ['profile', 'security', 'appearance', 'sidebar', 'notifications', 'system', 'users', 'audit', 'activity', 'site', 'sso', 'api', 'migrations', 'developer', 'about'];
const Settings = () => {
const [activeTab, setActiveTab] = useTabParam('/settings', VALID_TABS);
@@ -88,6 +89,16 @@ const Settings = () => {
</svg>
Appearance
</button>
+ <button
+ className={`settings-nav-item ${activeTab === 'sidebar' ? 'active' : ''}`}
+ onClick={() => setActiveTab('sidebar')}
+ >
+ <svg viewBox="0 0 24 24" width="18" height="18">
+ <rect x="3" y="3" width="18" height="18" rx="2" ry="2"/>
+ <line x1="9" y1="3" x2="9" y2="21"/>
+ </svg>
+ Sidebar
+ </button>
<button
className={`settings-nav-item ${activeTab === 'notifications' ? 'active' : ''}`}
onClick={() => setActiveTab('notifications')}
@@ -210,6 +221,7 @@ const Settings = () => {
{activeTab === 'profile' && <ProfileSettings />}
{activeTab === 'security' && <SecuritySettings />}
{activeTab === 'appearance' && <AppearanceSettings />}
+ {activeTab === 'sidebar' && <SidebarSettings />}
{activeTab === 'notifications' && <NotificationSettings />}
{activeTab === 'system' && <SystemInfo />}
{activeTab === 'users' && isAdmin && <UsersTab />}
diff --git a/frontend/src/styles/pages/_settings.less b/frontend/src/styles/pages/_settings.less
index ef920641..2dc2fa77 100644
--- a/frontend/src/styles/pages/_settings.less
+++ b/frontend/src/styles/pages/_settings.less
@@ -1495,3 +1495,197 @@
gap: @space-2;
}
}
+
+// ============================================
+// SIDEBAR SETTINGS
+// ============================================
+
+.sidebar-settings {
+ display: flex;
+ flex-direction: column;
+ gap: @space-8;
+
+ .settings-section-desc {
+ color: @text-secondary;
+ font-size: @font-size-sm;
+ margin: 0;
+ line-height: @line-height-normal;
+ }
+
+ .settings-section-header {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ margin-bottom: @space-1;
+
+ h3 { margin-bottom: 0; }
+ }
+}
+
+.sidebar-item-count {
+ font-size: @font-size-xs;
+ color: @text-tertiary;
+ background: @bg-secondary;
+ padding: @space-1 @space-2;
+ border-radius: @radius-full;
+ font-weight: @font-weight-medium;
+}
+
+// Preset cards
+.sidebar-presets {
+ display: grid;
+ grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
+ gap: @space-3;
+ margin-top: @space-2;
+}
+
+.sidebar-preset-card {
+ display: flex;
+ align-items: flex-start;
+ gap: @space-3;
+ padding: @space-4;
+ background: @bg-card;
+ border: 1px solid @border-subtle;
+ border-radius: @radius-lg;
+ cursor: pointer;
+ transition: all @transition-fast;
+ text-align: left;
+ width: 100%;
+ position: relative;
+
+ &:hover {
+ border-color: @border-hover;
+ background: @bg-hover;
+ }
+
+ &.active {
+ border-color: @accent-primary;
+ background: @bg-card;
+ box-shadow: 0 0 0 1px @accent-primary;
+ }
+
+ .preset-card-icon {
+ flex-shrink: 0;
+ width: 36px;
+ height: 36px;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ background: @bg-secondary;
+ border-radius: @radius-md;
+ color: @text-secondary;
+
+ svg {
+ stroke-width: 1.5;
+ }
+ }
+
+ &.active .preset-card-icon {
+ background: fade(@accent-primary-raw, 15%);
+ color: @accent-primary;
+ }
+
+ .preset-card-info {
+ display: flex;
+ flex-direction: column;
+ gap: @space-1;
+ min-width: 0;
+ flex: 1;
+ }
+
+ .preset-card-label {
+ font-size: @font-size-sm;
+ font-weight: @font-weight-semibold;
+ color: @text-primary;
+ }
+
+ .preset-card-desc {
+ font-size: @font-size-xs;
+ color: @text-tertiary;
+ line-height: @line-height-normal;
+ }
+
+ .preset-card-check {
+ position: absolute;
+ top: @space-3;
+ right: @space-3;
+ color: @accent-primary;
+ }
+}
+
+// Items toggle list
+.sidebar-items-list {
+ display: flex;
+ flex-direction: column;
+ gap: @space-5;
+ margin-top: @space-2;
+}
+
+.sidebar-items-group {
+ display: flex;
+ flex-direction: column;
+ gap: 0;
+}
+
+.sidebar-items-group-label {
+ font-size: @font-size-xs;
+ font-weight: @font-weight-semibold;
+ color: @text-tertiary;
+ text-transform: uppercase;
+ letter-spacing: 0.05em;
+ padding: 0 0 @space-2 0;
+ border-bottom: 1px solid @border-subtle;
+ margin-bottom: @space-1;
+}
+
+.sidebar-item-toggle {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ padding: @space-3 @space-2;
+ border-radius: @radius-md;
+ cursor: pointer;
+ transition: all @transition-fast;
+
+ &:hover {
+ background: @bg-hover;
+ }
+
+ &.hidden-item {
+ .sidebar-item-toggle-info {
+ opacity: 0.5;
+ }
+ }
+}
+
+.sidebar-item-toggle-info {
+ display: flex;
+ align-items: center;
+ gap: @space-3;
+ transition: opacity @transition-fast;
+
+ span {
+ font-size: @font-size-sm;
+ color: @text-primary;
+ font-weight: @font-weight-medium;
+ }
+}
+
+.sidebar-item-toggle-icon {
+ width: 18px;
+ height: 18px;
+ stroke: @text-secondary;
+ fill: none;
+ stroke-width: 2;
+ flex-shrink: 0;
+}
+
+// Actions bar
+.sidebar-settings-actions {
+ display: flex;
+ align-items: center;
+ justify-content: flex-end;
+ gap: @space-3;
+ padding-top: @space-5;
+ border-top: 1px solid @border-subtle;
+}