Files
vela-platform/README.md

116 lines
3.8 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Vela Platform 🏔️
**Self-hosted P&L tracking for C2C server/storage businesses.**
Track revenue, costs, and margins across multiple service offers with granular component-level pricing. No SaaS fees, no subscriptions — just Python + SQLite.
---
## 🚀 First Run
When you visit for the **first time**, you'll be greeted by a setup wizard that asks you to:
1. **Choose your admin username and password**
2. A **guest account** (`viewer`) is automatically created with a random password
No hardcoded credentials — you set them yourself.
## 📸 Overview
| Page | What it does |
|------|-------------|
| **Dashboard** `/` | P&L cards (revenue/cost/margin), 12-month trend chart, active offers |
| **Transactions** `/transactions` | Log monthly revenue per client, filter by month, auto-summary |
| **Offers** `/services` | View/edit component pricing (HDD, RAM, CPU, Support, Transport...), auto-computed totals |
## 🏔️ Offers
| Offer | Description | Sell | Cost | Margin | Components |
|-------|------------|------|------|--------|-----------|
| **Atlas** | 1TB Storage | 4,000 MAD | 2,000 MAD | 2,000 MAD | 7 |
| **Atlas+** | 1TB + Sauvegarde | 5,000 MAD | 2,800 MAD | 2,200 MAD | 9 |
| **Rif** | 500GB Server | 3,500 MAD | 1,700 MAD | 1,800 MAD | 7 |
| **Rif+** | 500GB + Sauvegarde | 4,500 MAD | 2,200 MAD | 2,300 MAD | 9 |
## 🔧 Component-Level Pricing
Each offer has a granular breakdown of costs and sell prices. Edit any component independently — totals auto-recompute:
```
HDD (1TB) cost: 600 MAD ×1 sell: 1,000 MAD → margin: 400 MAD
RAM (16GB) cost: 300 MAD ×1 sell: 500 MAD → margin: 200 MAD
CPU alloc cost: 200 MAD ×1 sell: 400 MAD → margin: 200 MAD
Bandwidth cost: 200 MAD ×1 sell: 500 MAD → margin: 300 MAD
Support cost: 200 MAD ×1 sell: 700 MAD → margin: 500 MAD
────────────────────────────────────────────────────────────
Total cost: 2,000 MAD sell: 4,000 MAD margin: 2,000 MAD
```
## 🚀 Quick Start
### Prerequisites
- Python 3.11+
- pip or uv
### Install
```bash
git clone http://192.168.1.160:3000/fedora-heremes/vela-platform.git
cd vela-platform/backend
pip install -r requirements.txt
uvicorn main:app --host 0.0.0.0 --port 8788
```
On first visit, the setup wizard will guide you through creating your admin account.
### systemd (auto-start)
```ini
[Unit]
Description=Vela Platform — P&L Tracking App
[Service]
Type=simple
User=root
WorkingDirectory=/opt/vela-platform/backend
ExecStart=/usr/bin/python3 -m uvicorn main:app --host 0.0.0.0 --port 80
Restart=always
[Install]
WantedBy=multi-user.target
```
## 🔌 API
All CRUD operations available via REST API. Authenticate with Bearer token.
| Method | Endpoint | Description |
|--------|----------|-------------|
| POST | `/api/setup` | First-time setup (creates admin + guest accounts) |
| POST | `/api/auth/login` | Login |
| GET | `/api/services` | List offers + components |
| POST | `/api/services/{id}/components` | Add component |
| PUT | `/api/components/{id}` | Update component |
| DELETE | `/api/components/{id}` | Delete component |
| GET | `/api/transactions?month=YYYY-MM` | List transactions |
| POST | `/api/transactions` | Add transaction |
| GET | `/api/pnl?month=YYYY-MM` | P&L report |
| GET | `/api/dashboard` | Overview + trend |
## 🤖 MCP Integration
Use with AI agents via MCP (Model Context Protocol).
## 🧱 Tech Stack
- **Python 3** + **FastAPI** — API & web server
- **SQLite** + **SQLAlchemy** — Database (zero config)
- **Jinja2** + **Bootstrap 5** — Web UI (dark mode)
- **Chart.js** — Trend charts
- **JWT** — Auth (cookie + Bearer)
- **MCP** — AI agent integration
## 📄 License
MIT