AI Model Management Platform - In Development
Deployment: Automated CI/CD via GitHub Actions to Hetzner Kubernetes | Last updated: 2025-01-08
Live URL: https://airepubliq.com
AI Republic Dashboard is a platform for managing AI models, training pipelines, and deployment workflows. Built with modern architecture principles, it supports both local and cloud-based AI models with performance and scalability.
The platform enables users to manage multiple AI models, create and train custom models using LoRA fine-tuning, organize datasets, and deploy AI agents (Minions) with specialized capabilities (Spirits) for various tasks.
- Multi-Provider Model Support: Ollama, OpenAI, Anthropic, NVIDIA NIM, and custom models
- Model Registry: Centralized repository for all AI models
- Model Versioning: Track and manage model versions
- Model Performance Analytics: Monitor model usage and performance metrics
- LoRA Fine-Tuning: Efficient parameter-efficient fine-tuning for custom models
- Training Pipeline Management: Create, monitor, and manage training jobs
- Dataset Management: Upload, organize, and manage training datasets
- Training Progress Tracking: Real-time WebSocket updates for training jobs
- Checkpoint Management: Save and restore training checkpoints
- AI Agent Creation: Create specialized AI agents (Minions) for specific tasks
- Minion Classes: Pre-configured spirit pathways for common use cases (Developer, Planner, Content Marketer, etc.)
- Level System: Minions gain experience and unlock new capabilities
- Spirit System: Dynamic AI agent configurations with specialized tools
- Authentication & Authorization: JWT-based authentication with role-based access control (RBAC)
- User Management: Comprehensive user profiles, avatars, and preferences
- Session Management: Redis-backed secure session handling
- Audit Logging: Track user actions and system events
- Rate Limiting: API protection and abuse prevention
- Redis Caching: Intelligent caching layer for improved performance
- Connection Pooling: Efficient database access with SQLAlchemy
- WebSocket Support: Real-time updates for training progress and notifications
- Horizontal Scaling: Kubernetes-ready architecture for production deployment
- Modern Neumorphism Design: Beautiful, responsive UI with dark mode support
- Real-Time Updates: WebSocket-based live updates for training and jobs
- Responsive Layout: Mobile-friendly interface
- Intuitive Navigation: Easy-to-use dashboard and management interfaces
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β USER INTERFACE β
β β
β ββββββββββββββββββββββββ β
β β Frontend (Vue.js) β β
β β Nginx Static Files β β
β β Port: 80 β β
β ββββββββββββ¬ββββββββββββ β
β β β
βββββββββββββββββββββββββββββββββΌββββββββββββββββββββββββββββββββββββββββββ
β HTTP/HTTPS
β
βββββββββββββββββββββββββββββββββΌββββββββββββββββββββββββββββββββββββββββββ
β API LAYER β
β β
β ββββββββββββββββββββββββ β
β β Backend (Flask) β β
β β Port: 5001 β β
β β Flask-SocketIO β β
β βββββββββ¬βββββββββββββββ β
β β β
ββββββββββββββββββββββββββββββΌββββββββββββββββββββββββββββββββββββββββββββββ
β
ββββββββββββββββββββββΌβββββββββββββββββββββ
β β β
βΌ βΌ βΌ
ββββββββββββββββ ββββββββββββββββ ββββββββββββββββ
β PostgreSQL β β Redis β β ChromaDB β
β Port: 5432 β β Port: 6379 β β Vector DB β
β β β β β β
β β’ Users β β β’ Sessions β β β’ RAG Data β
β β’ Models β β β’ Cache β β β’ Embeddingsβ
β β’ Training β β β’ Rate Limitβ β β
β β’ Minions β β β β β
β β’ Spirits β β β β β
ββββββββββββββββ ββββββββββββββββ ββββββββββββββββ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β EXTERNAL SERVICES β
β β
β β’ Ollama (Local LLM) β’ OpenAI API β’ Anthropic API β
β β’ NVIDIA NIM β’ HuggingFace β’ RunPod (GPU Training) β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Frontend: Vue.js application built with Vite, served via Nginx in production. Provides user interface for managing models, training jobs, datasets, and minions.
Backend: Flask REST API with WebSocket support (Flask-SocketIO) for real-time updates. Handles authentication, model management, training orchestration, and minion/spirit operations.
PostgreSQL: Primary relational database storing users, models, training jobs, datasets, minions, spirits, and system metadata.
Redis: Caching layer and session storage. Also used for rate limiting and real-time data.
ChromaDB: Vector database for RAG (Retrieval Augmented Generation) functionality, storing embeddings and enabling semantic search.
External Services: Integration with various AI model providers and cloud GPU services for training and inference.
- Python 3.11
- Flask 2.3.3 - Web framework
- Flask-SocketIO 5.3.6 - WebSocket support
- SQLAlchemy 2.0.21 - Database ORM
- PostgreSQL 15 - Primary database
- Redis 7 - Caching and session storage
- PyTorch 2.0+ - Deep learning framework
- Transformers 4.30+ - HuggingFace model library
- PEFT 0.4+ - Parameter-Efficient Fine-Tuning (LoRA)
- ChromaDB - Vector database for RAG
- Vue.js 3 - Frontend framework
- Vite - Build tool and dev server
- Neumorphism UI - Design system
- WebSocket Client - Real-time updates
- Docker - Containerization
- Kubernetes (k3s) - Container orchestration
- Nginx Ingress Controller - HTTP/HTTPS routing
- GitHub Actions - CI/CD automation
- Hetzner Cloud - Cloud hosting
- Python 3.11 or higher
- Node.js 18 or higher
- PostgreSQL 12 or higher
- Redis 7 or higher
- Docker (optional, for containerized deployment)
-
Clone the repository:
git clone git@github.com:janisrael/airepublic.git cd ai-refinement-dashboard -
Set up backend:
cd backend python3 -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate pip install -r requirements.txt
-
Set up frontend:
cd frontend npm install -
Configure environment variables:
# Backend cp env.example .env # Edit .env with your configuration # Frontend cd frontend cp .env.example .env # Edit .env with your configuration
-
Set up database:
# Create PostgreSQL database createdb ai_refinement_v2 # Run migrations (if available) # python backend/manage.py migrate
-
Start services:
# Terminal 1: Start Redis redis-server # Terminal 2: Start backend cd backend python app_server_new.py # Terminal 3: Start frontend cd frontend npm run dev
-
Access the application:
- Frontend: http://localhost:5173
- Backend API: http://localhost:5001
- API Documentation: http://localhost:5001/api/docs
# Start all services with Docker Compose
docker-compose up -d
# View logs
docker-compose logs -f
# Stop services
docker-compose down# Flask Configuration
FLASK_ENV=development
SECRET_KEY=your-secret-key-here
BACKEND_PORT=5001
# Database Configuration
DATABASE_URL=postgresql://user:password@localhost:5432/ai_refinement_v2
# Redis Configuration
REDIS_URL=redis://localhost:6379/0
# ChromaDB Configuration
CHROMADB_PATH=backend/chromadb_data
# Model Provider APIs (optional)
OPENAI_API_KEY=your-openai-key
ANTHROPIC_API_KEY=your-anthropic-key
OLLAMA_BASE_URL=http://localhost:11434VITE_API_BASE_URL=http://localhost:5001ai-refinement-dashboard/
βββ backend/
β βββ app/
β β βββ routes/ # API route blueprints
β β βββ models/ # SQLAlchemy models
β β βββ services/ # Business logic
β β βββ utils/ # Utility functions
β βββ migrations/ # Database migrations
β βββ scripts/ # Utility scripts
β βββ chromadb_data/ # ChromaDB vector store
β βββ app_server_new.py # Main Flask application
β βββ requirements.txt # Python dependencies
βββ frontend/
β βββ src/
β β βββ components/ # Vue components
β β βββ views/ # Page views
β β βββ assets/ # Static assets
β β βββ config/ # Configuration
β βββ public/ # Public assets
β βββ package.json # Node dependencies
β βββ vite.config.js # Vite configuration
βββ k8s/ # Kubernetes manifests
βββ docs/ # Documentation
βββ docker-compose.yml # Docker Compose configuration
βββ CI_CD_SECRETS.md # CI/CD secrets documentation
βββ README.md # This file
POST /api/auth/register- User registrationPOST /api/auth/login- User loginPOST /api/auth/logout- User logoutGET /api/auth/me- Get current user
GET /api/models- List all modelsPOST /api/models- Create new modelGET /api/models/{id}- Get model detailsPUT /api/models/{id}- Update modelDELETE /api/models/{id}- Delete model
GET /api/training/jobs- List training jobsPOST /api/training/jobs- Create training jobGET /api/training/jobs/{id}- Get job detailsGET /api/training/jobs/{id}/progress- Get training progress (WebSocket)
GET /api/datasets- List datasetsPOST /api/datasets- Upload datasetGET /api/datasets/{id}- Get dataset detailsDELETE /api/datasets/{id}- Delete dataset
GET /api/minions- List user minionsPOST /api/minions- Create minionGET /api/minions/{id}- Get minion detailsPUT /api/minions/{id}- Update minionDELETE /api/minions/{id}- Delete minion
users- User accounts and authenticationroles- Role definitions for RBACpermissions- Permission definitionsuser_roles- User-role assignmentsmodels- AI model configurationstraining_jobs- Training pipeline jobsdatasets- Dataset metadataminions- AI agent configurationsspirits- Dynamic spirit configurationsminion_classes- Pre-configured minion classes
See docs/DATABASE_ERD.md for detailed database schema documentation.
The application is deployed to Hetzner Kubernetes (k3s) using GitHub Actions CI/CD.
Architecture:
- Namespace:
airepubliq - PostgreSQL StatefulSet with PersistentVolumeClaim (10Gi)
- Redis Deployment
- Backend Deployment (2 replicas) with PVCs for ChromaDB and logs
- Frontend Deployment (2 replicas) serving static files via Nginx
- Ingress for external access
Deployment Process:
- Push to
mainbranch triggers CI/CD - Tests run automatically
- Docker images are built on Hetzner server (backend + frontend)
- Images are imported into k3s
- Kubernetes manifests are applied
- Application is available at
https://airepubliq.com
Required GitHub Secrets:
HETZNER_SSH_PRIVATE_KEY- SSH key for server accessHETZNER_HOST- Hetzner server IP addressFLASK_SECRET_KEY- Flask secret key for sessionsPOSTGRES_PASSWORD- PostgreSQL database password
See CI_CD_SECRETS.md for detailed setup instructions.
# Backend tests
cd backend
pytest
# Frontend tests
cd frontend
npm run test# Linting
flake8 backend/
eslint frontend/src/
# Formatting
black backend/
prettier frontend/src/# Create migration
alembic revision --autogenerate -m "description"
# Apply migrations
alembic upgrade headComprehensive documentation is available in the docs/ folder:
docs/ARCHITECTURAL_PLAN/- System architecture and designdocs/AMIGO_*.md- Amigo model training documentationdocs/DATABASE_ERD.md- Database entity relationship diagramSETUP.md- Detailed setup guideCI_CD_SECRETS.md- CI/CD configuration guide
- JWT-based stateless authentication
- Role-Based Access Control (RBAC)
- Session management with Redis
- Password hashing with bcrypt
- Input validation with Pydantic models
- SQL injection protection via SQLAlchemy ORM
- XSS protection with content sanitization
- CSRF protection with token validation
- Rate limiting for API endpoints
- Redis caching for frequently accessed data
- Database connection pooling
- Lazy loading for large datasets
- Gzip compression for API responses
- CDN-ready static asset optimization
- API Response Time: < 100ms (cached)
- Database Queries: < 50ms (pooled)
- Concurrent Users: 1000+ (tested)
- Memory Usage: < 512MB per service
Database Connection Failed:
- Verify PostgreSQL is running:
systemctl status postgresql - Check connection string in
.env - Verify database exists:
psql -l
Redis Connection Failed:
- Verify Redis is running:
redis-cli ping - Check Redis URL in
.env - Verify Redis port is accessible
Training Jobs Not Starting:
- Check GPU availability (if using GPU)
- Verify dataset paths are correct
- Check training logs:
kubectl logs -n airepubliq -l app=backend
Frontend Not Loading:
- Verify backend API is accessible
- Check CORS configuration
- Verify API base URL in frontend
.env
- Fork the repository
- Create feature branch:
git checkout -b feature/amazing-feature - Make changes and test:
make test - Commit changes:
git commit -m 'Add amazing feature' - Push to branch:
git push origin feature/amazing-feature - Open Pull Request
- Python: Black formatting, type hints with MyPy
- JavaScript: ESLint, Prettier
- Tests: 90%+ coverage required
- Documentation: Docstrings for all functions
This project is licensed under the MIT License - see the LICENSE file for details.
Created By: Jan Francis Israel
Website: https://janisrael.com
HuggingFace: https://huggingface.co/swordfish7412
GitHub: https://github.com/janisrael/airepublic
Project: AI Republic Dashboard
Version: 2.0.0 (Development)
Status: In Development (Ongoing)
Last Updated: January 2025