# Technology Stack
## AtlasOS - Calypso Backup Appliance

**Version:** 1.0.0-alpha  
**Last Updated:** 2025-01-XX

---

## Overview

This document provides a comprehensive list of all technologies, frameworks, libraries, and tools used in the Calypso backup appliance.

---

## 1. Operating System & Base Platform

### 1.1 Operating System
- **Ubuntu Server 24.04 LTS** (Primary target)
- **Linux Kernel** 6.8+ (with ZFS, SCST support)
- **systemd** - Service management
- **journald** - System logging

### 1.2 Base System Tools
- **chrony** - NTP time synchronization
- **ufw** - Firewall management
- **nftables** - Network filtering (alternative)
- **udev** - Device management
- **lsb-release** - Linux Standard Base

---

## 2. Backend Technology Stack

### 2.1 Programming Language
- **Go 1.22+** (golang)
  - Version: 1.22.0 or later
  - Architecture: linux-amd64

### 2.2 Web Framework
- **Gin** - HTTP web framework
  - `github.com/gin-gonic/gin`
  - RESTful API implementation
  - Middleware support

### 2.3 Database
- **PostgreSQL 14+**
  - Primary database for metadata
  - Connection pooling (pgxpool)
  - Migration system

### 2.4 Database Drivers
- **pgx/v5** - PostgreSQL driver
  - `github.com/jackc/pgx/v5`
  - `github.com/jackc/pgx/v5/pgxpool`
- **lib/pq** - PostgreSQL driver (for array types)
  - `github.com/lib/pq`

### 2.5 Authentication & Security
- **JWT** - JSON Web Tokens
  - `github.com/golang-jwt/jwt/v5`
- **bcrypt** - Password hashing
  - `golang.org/x/crypto/bcrypt`
- **Argon2** - Password hashing (alternative)

### 2.6 Configuration Management
- **Viper** - Configuration management
  - `github.com/spf13/viper`
- **YAML** - Configuration format

### 2.7 Logging
- **Zerolog** - Structured logging
  - `github.com/rs/zerolog`
- **JSON** - Log format

### 2.8 HTTP Client & Utilities
- **HTTP Client** - Standard library
- **Context** - Request context management
- **Time** - Time handling

### 2.9 Additional Go Libraries
- **UUID** - UUID generation
  - `github.com/google/uuid`
- **Errors** - Error handling
  - `github.com/pkg/errors`
- **Sync** - Concurrency primitives
  - `golang.org/x/sync/errgroup`

---

## 3. Frontend Technology Stack

### 3.1 Core Framework
- **React 18** - UI library
  - Version: 18.x
  - TypeScript support

### 3.2 Build Tool
- **Vite** - Build tool and dev server
  - Fast HMR (Hot Module Replacement)
  - Optimized production builds

### 3.3 Programming Language
- **TypeScript** - Type-safe JavaScript
  - Type checking
  - Modern ES6+ features

### 3.4 Routing
- **React Router DOM** - Client-side routing
  - `react-router-dom`
  - Version: 6.x

### 3.5 State Management
- **Zustand** - Lightweight state management
  - `zustand`
  - Global state (auth, UI state)

### 3.6 Data Fetching
- **TanStack Query (React Query)** - Server state management
  - `@tanstack/react-query`
  - Caching, refetching, mutations

### 3.7 HTTP Client
- **Axios** - HTTP client
  - `axios`
  - Request/response interceptors

### 3.8 Styling
- **TailwindCSS** - Utility-first CSS framework
  - `tailwindcss`
  - PostCSS integration
  - Dark theme support

### 3.9 Icons
- **Lucide React** - Icon library
  - `lucide-react`
  - Modern icon set

### 3.10 UI Components
- **shadcn/ui** - UI component library (planned)
- **Custom Components** - Built with TailwindCSS

### 3.11 Charts & Visualization
- **Recharts** - Chart library
  - `recharts`
  - Line, bar, pie charts

### 3.12 Notifications
- **Sonner** - Toast notifications
  - `sonner`
  - Success, error, warning toasts

---

## 4. Storage Technologies

### 4.1 File System
- **ZFS** - Zettabyte File System
  - `zfsutils-linux`
  - `zfs-dkms`
  - Pool and dataset management
  - Snapshots and replication

### 4.2 Block Storage
- **LVM2** - Logical Volume Manager
  - Volume group management
  - Thin provisioning

### 4.3 File Systems
- **XFS** - High-performance filesystem (primary)
- **ext4** - Alternative filesystem

### 4.4 Disk Management
- **parted** - Partition management
- **gdisk** - GPT partition editor
- **smartmontools** - SMART disk monitoring
- **nvme-cli** - NVMe device management

---

## 5. Network & File Sharing

### 5.1 File Sharing Protocols
- **NFS** - Network File System
  - `nfs-kernel-server`
  - `nfs-common`
  - NFSv4 support

- **Samba** - SMB/CIFS protocol
  - `samba`
  - `samba-common-bin`
  - Windows file sharing compatibility

### 5.2 iSCSI
- **SCST** - SCSI Target Subsystem
  - Kernel module
  - `iscsi-scst`
  - `scstadmin` - Management tool

### 5.3 Network Tools
- **open-iscsi** - iSCSI initiator
- **iscsiadm** - iSCSI administration

---

## 6. Backup & Tape Technologies

### 6.1 Backup Software
- **Bacula** - Backup software
  - `bacula-common`
  - `bacula-sd` - Storage daemon
  - `bacula-client`
  - `bacula-console` - Management console

- **Bareos** - Bacula fork (alternative)

### 6.2 Virtual Tape Library
- **MHVTL** - Virtual Tape Library
  - `mhvtl`
  - `mhvtl-utils`
  - `vtlcmd` - Management tool

### 6.3 Physical Tape
- **lsscsi** - List SCSI devices
- **sg3-utils** - SCSI generic utilities
- **mt-st** - Magnetic tape utilities
- **mtx** - Media changer control

---

## 7. Security & Antivirus

### 7.1 Antivirus
- **ClamAV** - Antivirus engine
  - `clamav`
  - `clamav-daemon`
  - `clamav-freshclam` - Virus definition updates
  - `clamav-unofficial-sigs` - Unofficial signatures

---

## 8. Object Storage

### 8.1 S3-Compatible Storage
- **MinIO** - Object storage (planned/integration)
  - S3-compatible API
  - Bucket management

---

## 9. Development Tools

### 9.1 Build Tools
- **Make** - Build automation
- **Go Build** - Go compiler
- **npm/pnpm** - Node.js package manager

### 9.2 Version Control
- **Git** - Version control system

### 9.3 Code Quality
- **gofmt** - Go code formatter
- **goimports** - Go import organizer
- **golint** - Go linter (optional)
- **go vet** - Go static analysis

### 9.4 Frontend Tools
- **Prettier** - Code formatter
- **ESLint** - JavaScript/TypeScript linter
- **TypeScript Compiler** - Type checking

---

## 10. System Services

### 10.1 Service Management
- **systemd** - Service manager
- **journalctl** - Log viewing

### 10.2 Reverse Proxy (Optional)
- **Nginx** - Web server and reverse proxy
- **Caddy** - Web server with automatic HTTPS

---

## 11. Monitoring & Observability

### 11.1 Metrics Collection
- **Custom Metrics Service** - Built-in metrics
- **System Metrics** - CPU, memory, disk, network

### 11.2 Logging
- **Structured Logging** - JSON format
- **Audit Logging** - Database-backed audit trail

### 11.3 Health Checks
- **Health Endpoint** - `/api/v1/health`
- **Service Status** - Component health monitoring

---

## 12. Database Technologies

### 12.1 Primary Database
- **PostgreSQL 14+**
  - Metadata storage
  - User management
  - Audit logs
  - Task tracking
  - Alert management

### 12.2 Database Tools
- **psql** - PostgreSQL client
- **pg_dump** - Database backup
- **pg_restore** - Database restore

---

## 13. Web Technologies

### 13.1 Protocols
- **HTTP/1.1** - Web protocol
- **HTTPS** - Secure HTTP (with TLS)
- **WebSocket** - Real-time communication (planned)

### 13.2 API
- **RESTful API** - Resource-based API
- **JSON** - Data interchange format

---

## 14. Container & Virtualization (Future)

### 14.1 Container Technologies (Not in V1)
- **Docker** - Containerization (future)
- **Kubernetes** - Orchestration (future)

---

## 15. Package Management

### 15.1 Backend
- **Go Modules** - Dependency management
  - `go.mod`
  - `go.sum`

### 15.2 Frontend
- **npm** - Node.js package manager
- **pnpm** - Fast, disk space efficient package manager

---

## 16. Testing Tools (Development)

### 16.1 Backend Testing
- **Go Testing** - Built-in testing framework
- **Testify** - Testing toolkit (if used)

### 16.2 Frontend Testing
- **Vitest** - Unit testing (with Vite)
- **React Testing Library** - Component testing

---

## 17. Documentation Tools

### 17.1 Documentation
- **Markdown** - Documentation format
- **Mermaid** - Diagram generation (in docs)

---

## 18. Security Tools

### 18.1 Encryption
- **TLS/SSL** - Transport layer security
- **bcrypt** - Password hashing
- **Argon2** - Password hashing (alternative)

### 18.2 Access Control
- **JWT** - Token-based authentication
- **RBAC** - Role-Based Access Control
- **Permission System** - Resource-based permissions

---

## 19. Version Information

### 19.1 Backend Dependencies
See `backend/go.mod` for complete list of Go dependencies.

### 19.2 Frontend Dependencies
See `frontend/package.json` for complete list of npm dependencies.

---

## 20. External Integrations

### 20.1 System Integrations
- **ZFS Commands** - `zpool`, `zfs`
- **SCST Commands** - `scstadmin`
- **Bacula Commands** - `bconsole`
- **MHVTL Commands** - `vtlcmd`
- **Systemd Commands** - `systemctl`

### 20.2 File System Integrations
- **NFS Exports** - `/etc/exports`
- **Samba Config** - `/etc/samba/smb.conf`
- **ClamAV Config** - `/etc/clamav/`

---

## 21. Build & Deployment

### 21.1 Build Process
- **Go Build** - Compile Go binary
- **Vite Build** - Build frontend assets
- **Makefile** - Build automation

### 21.2 Deployment
- **Systemd Services** - Service deployment
- **Installer Scripts** - Automated installation
- **Configuration Management** - YAML-based config

---

## Summary

### Core Stack
- **Backend:** Go 1.22+ + Gin + PostgreSQL
- **Frontend:** React 18 + TypeScript + Vite + TailwindCSS
- **Storage:** ZFS + LVM2 + XFS
- **File Sharing:** NFS + Samba
- **iSCSI:** SCST
- **Backup:** Bacula/Bareos
- **Tape:** MHVTL + Physical tape tools
- **Antivirus:** ClamAV
- **Security:** JWT + bcrypt + RBAC

### Technology Categories
- **Languages:** Go, TypeScript, JavaScript, SQL, Bash
- **Frameworks:** Gin, React, TailwindCSS
- **Databases:** PostgreSQL
- **Storage:** ZFS, LVM2, XFS
- **Networking:** NFS, SMB/CIFS, iSCSI
- **Security:** JWT, bcrypt, ClamAV
- **Tools:** Git, Make, systemd, journald

---

## Version Matrix

| Component | Version | Purpose |
|-----------|---------|---------|
| Go | 1.22+ | Backend language |
| Node.js | 20.x LTS | Frontend runtime |
| React | 18.x | Frontend framework |
| PostgreSQL | 14+ | Database |
| ZFS | Latest | Storage filesystem |
| SCST | Latest | iSCSI target |
| Bacula | Latest | Backup software |
| ClamAV | Latest | Antivirus |
| NFS | Latest | Network file sharing |
| Samba | Latest | SMB/CIFS file sharing |

---

## Dependencies Count

- **Backend Go Dependencies:** ~30+ packages
- **Frontend npm Dependencies:** ~300+ packages
- **System Packages:** ~50+ packages

---

## License Information

Most components use open-source licenses:
- **Go:** BSD-style license
- **React:** MIT License
- **PostgreSQL:** PostgreSQL License
- **ZFS:** CDDL License
- **ClamAV:** GPL License
- **Samba:** GPL License

---

## References

- Backend dependencies: `backend/go.mod`
- Frontend dependencies: `frontend/package.json`
- System requirements: `scripts/install-requirements.sh`
- Architecture: `docs/alpha/Calypso_System_Architecture.md`

---

**Document History**

| Version | Date | Author | Changes |
|---------|------|--------|---------|
| 1.0 | 2025-01-XX | Development Team | Initial technology stack documentation |

