feat(setup): T01 create project directory structure
- Create src/openrouter_monitor/ package structure - Create models/, routers/, services/, utils/ subpackages - Create tests/unit/ and tests/integration/ structure - Create alembic/, docs/, scripts/ directories - Add test_project_structure.py with 13 unit tests - All tests passing (13/13) Refs: T01
This commit is contained in:
242
export/kanban.md
Normal file
242
export/kanban.md
Normal file
@@ -0,0 +1,242 @@
|
||||
# Kanban Board
|
||||
|
||||
## OpenRouter API Key Monitor - Fase 1 (MVP)
|
||||
|
||||
---
|
||||
|
||||
## Legenda
|
||||
|
||||
- **Complessità**: S (Small < 1h) | M (Medium 1-2h) | L (Large 2-4h, deve essere scomposto)
|
||||
- **Priorità**: P0 (Bloccante) | P1 (Alta) | P2 (Media) | P3 (Bassa)
|
||||
- **Dipendenze**: Task che devono essere completati prima
|
||||
|
||||
---
|
||||
|
||||
## 📋 BACKLOG / TODO
|
||||
|
||||
### 🔧 Setup Progetto (Fondamentale)
|
||||
|
||||
| ID | Task | Compl. | Priorità | Dipendenze | Note |
|
||||
|----|------|--------|----------|------------|------|
|
||||
| T01 | Creare struttura cartelle progetto | S | P0 | - | `app/`, `tests/`, `alembic/` |
|
||||
| T02 | Inizializzare virtual environment | S | P0 | - | Python 3.11+ |
|
||||
| T03 | Creare requirements.txt con dipendenze | S | P0 | T02 | FastAPI, SQLAlchemy, etc. |
|
||||
| T04 | Setup file configurazione (.env, config.py) | S | P0 | T03 | Variabili d'ambiente |
|
||||
| T05 | Configurare pytest e struttura test | S | P0 | T02 | pytest.ini, conftest.py |
|
||||
|
||||
### 🗄️ Database & Models
|
||||
|
||||
| ID | Task | Compl. | Priorità | Dipendenze | Note |
|
||||
|----|------|--------|----------|------------|------|
|
||||
| T06 | Creare database.py (connection & session) | S | P0 | T04 | SQLAlchemy engine |
|
||||
| T07 | Creare model User (SQLAlchemy) | M | P0 | T06 | Tabella users |
|
||||
| T08 | Creare model ApiKey (SQLAlchemy) | M | P0 | T07 | Tabella api_keys |
|
||||
| T09 | Creare model UsageStats (SQLAlchemy) | M | P1 | T08 | Tabella usage_stats |
|
||||
| T10 | Creare model ApiToken (SQLAlchemy) | M | P1 | T07 | Tabella api_tokens |
|
||||
| T11 | Setup Alembic e creare migrazione iniziale | M | P0 | T07-T10 | `alembic init` + revision |
|
||||
|
||||
### 🔐 Servizi di Sicurezza
|
||||
|
||||
| ID | Task | Compl. | Priorità | Dipendenze | Note |
|
||||
|----|------|--------|----------|------------|------|
|
||||
| T12 | Implementare EncryptionService (AES-256) | M | P0 | - | cryptography library |
|
||||
| T13 | Implementare password hashing (bcrypt) | S | P0 | - | passlib |
|
||||
| T14 | Implementare JWT utilities | S | P0 | T12 | python-jose |
|
||||
| T15 | Implementare API token generation | S | P1 | T13 | SHA-256 hash |
|
||||
| T16 | Scrivere test per servizi di encryption | M | P1 | T12-T15 | Unit tests |
|
||||
|
||||
### 👤 Autenticazione Utenti
|
||||
|
||||
| ID | Task | Compl. | Priorità | Dipendenze | Note |
|
||||
|----|------|--------|----------|------------|------|
|
||||
| T17 | Creare Pydantic schemas auth (register/login) | S | P0 | T07 | Validazione input |
|
||||
| T18 | Implementare endpoint POST /api/auth/register | M | P0 | T13, T17 | Creazione utente |
|
||||
| T19 | Implementare endpoint POST /api/auth/login | M | P0 | T14, T18 | JWT generation |
|
||||
| T20 | Implementare endpoint POST /api/auth/logout | S | P0 | T19 | Token invalidation |
|
||||
| T21 | Creare dipendenza get_current_user | S | P0 | T19 | FastAPI dependency |
|
||||
| T22 | Scrivere test per auth endpoints | M | P0 | T18-T21 | pytest |
|
||||
|
||||
### 🔑 Gestione API Keys
|
||||
|
||||
| ID | Task | Compl. | Priorità | Dipendenze | Note |
|
||||
|----|------|--------|----------|------------|------|
|
||||
| T23 | Creare Pydantic schemas per API keys | S | P0 | T08 | CRUD schemas |
|
||||
| T24 | Implementare POST /api/keys (create) | M | P0 | T12, T21, T23 | Con cifratura |
|
||||
| T25 | Implementare GET /api/keys (list) | S | P0 | T21, T23 | Lista key utente |
|
||||
| T26 | Implementare PUT /api/keys/{id} (update) | S | P0 | T21, T24 | Modifica nome/stato |
|
||||
| T27 | Implementare DELETE /api/keys/{id} | S | P0 | T21 | Eliminazione |
|
||||
| T28 | Implementare servizio validazione key | M | P1 | T24 | Chiamata a OpenRouter |
|
||||
| T29 | Scrivere test per API keys CRUD | M | P0 | T24-T27 | pytest |
|
||||
|
||||
### 📊 Dashboard & Statistiche (Base)
|
||||
|
||||
| ID | Task | Compl. | Priorità | Dipendenze | Note |
|
||||
|----|------|--------|----------|------------|------|
|
||||
| T30 | Creare Pydantic schemas per stats | S | P1 | T09 | Response models |
|
||||
| T31 | Implementare servizio aggregazione stats | M | P1 | T09 | Query SQL |
|
||||
| T32 | Implementare endpoint GET /api/stats | M | P1 | T21, T31 | Stats aggregate |
|
||||
| T33 | Implementare endpoint GET /api/usage | M | P1 | T21, T31 | Dettaglio usage |
|
||||
| T34 | Scrivere test per stats endpoints | M | P1 | T32, T33 | pytest |
|
||||
|
||||
### 🌐 Public API v1 (Esterna)
|
||||
|
||||
| ID | Task | Compl. | Priorità | Dipendenze | Note |
|
||||
|----|------|--------|----------|------------|------|
|
||||
| T35 | Creare dipendenza verify_api_token | S | P0 | T15 | Bearer token auth |
|
||||
| T36 | Implementare POST /api/tokens (generate) | M | P0 | T15, T21 | API token management |
|
||||
| T37 | Implementare GET /api/tokens (list) | S | P0 | T21 | Lista token utente |
|
||||
| T38 | Implementare DELETE /api/tokens/{id} | S | P0 | T21 | Revoca token |
|
||||
| T39 | Implementare GET /api/v1/stats | M | P0 | T31, T35 | Public endpoint |
|
||||
| T40 | Implementare GET /api/v1/usage | M | P0 | T33, T35 | Public endpoint |
|
||||
| T41 | Implementare GET /api/v1/keys | M | P0 | T25, T35 | Public endpoint |
|
||||
| T42 | Implementare rate limiting su public API | M | P1 | T35-T41 | slowapi |
|
||||
| T43 | Scrivere test per public API | M | P1 | T36-T42 | pytest |
|
||||
|
||||
### 🎨 Frontend Web (HTMX)
|
||||
|
||||
| ID | Task | Compl. | Priorità | Dipendenze | Note |
|
||||
|----|------|--------|----------|------------|------|
|
||||
| T44 | Setup Jinja2 templates e static files | S | P0 | - | Configurazione FastAPI |
|
||||
| T45 | Creare base.html (layout principale) | S | P0 | T44 | Template base |
|
||||
| T46 | Creare login.html | S | P0 | T45 | Form login |
|
||||
| T47 | Creare register.html | S | P0 | T45 | Form registrazione |
|
||||
| T48 | Implementare router /login (GET/POST) | M | P0 | T46 | Web endpoint |
|
||||
| T49 | Implementare router /register (GET/POST) | M | P0 | T47 | Web endpoint |
|
||||
| T50 | Creare dashboard.html | M | P1 | T45 | Panoramica |
|
||||
| T51 | Implementare router /dashboard | S | P1 | T50, T21 | Web endpoint |
|
||||
| T52 | Creare keys.html | M | P1 | T45 | Gestione API keys |
|
||||
| T53 | Implementare router /keys | S | P1 | T52, T24 | Web endpoint |
|
||||
| T54 | Aggiungere HTMX per azioni CRUD | M | P2 | T52 | AJAX senza reload |
|
||||
|
||||
### ⚙️ Background Tasks
|
||||
|
||||
| ID | Task | Compl. | Priorità | Dipendenze | Note |
|
||||
|----|------|--------|----------|------------|------|
|
||||
| T55 | Configurare APScheduler | S | P2 | - | Setup scheduler |
|
||||
| T56 | Implementare task sync usage stats | M | P2 | T09, T28 | Ogni ora |
|
||||
| T57 | Implementare task validazione key | M | P2 | T28 | Ogni giorno |
|
||||
| T58 | Integrare scheduler in startup app | S | P2 | T55-T57 | Lifespan event |
|
||||
|
||||
### 🔒 Sicurezza & Hardening
|
||||
|
||||
| ID | Task | Compl. | Priorità | Dipendenze | Note |
|
||||
|----|------|--------|----------|------------|------|
|
||||
| T59 | Implementare security headers middleware | S | P1 | - | XSS, CSRF protection |
|
||||
| T60 | Implementare rate limiting auth endpoints | S | P1 | T18, T19 | slowapi |
|
||||
| T61 | Implementare CORS policy | S | P1 | - | Configurazione |
|
||||
| T62 | Audit: verificare cifratura API keys | S | P1 | T12 | Verifica sicurezza |
|
||||
| T63 | Audit: verificare SQL injection prevention | S | P1 | T06 | Parameterized queries |
|
||||
|
||||
### 🧪 Testing & QA
|
||||
|
||||
| ID | Task | Compl. | Priorità | Dipendenze | Note |
|
||||
|----|------|--------|----------|------------|------|
|
||||
| T64 | Scrivere test unitari per models | S | P1 | T07-T10 | pytest |
|
||||
| T65 | Scrivere test integrazione auth flow | M | P1 | T18-T22 | End-to-end |
|
||||
| T66 | Scrivere test integrazione API keys | M | P1 | T24-T29 | End-to-end |
|
||||
| T67 | Verificare coverage >= 90% | S | P1 | T64-T66 | pytest-cov |
|
||||
| T68 | Eseguire security scan dipendenze | S | P2 | - | safety, pip-audit |
|
||||
|
||||
### 📝 Documentazione
|
||||
|
||||
| ID | Task | Compl. | Priorità | Dipendenze | Note |
|
||||
|----|------|--------|----------|------------|------|
|
||||
| T69 | Scrivere README.md completo | M | P2 | - | Setup, usage |
|
||||
| T70 | Documentare API con OpenAPI | S | P2 | - | FastAPI auto-docs |
|
||||
| T71 | Creare esempi curl per API | S | P3 | T39-T41 | Usage examples |
|
||||
|
||||
### 🚀 Deployment
|
||||
|
||||
| ID | Task | Compl. | Priorità | Dipendenze | Note |
|
||||
|----|------|--------|----------|------------|------|
|
||||
| T72 | Creare Dockerfile | M | P2 | - | Containerization |
|
||||
| T73 | Creare docker-compose.yml | S | P2 | T72 | Stack completo |
|
||||
| T74 | Scrivere script avvio produzione | S | P2 | T72 | Entry point |
|
||||
|
||||
---
|
||||
|
||||
## 🚧 IN PROGRESS
|
||||
|
||||
*Task attualmente in lavorazione*
|
||||
|
||||
| ID | Task | Assegnato | Iniziato | Note |
|
||||
|----|------|-----------|----------|------|
|
||||
| - | - | - | - | - |
|
||||
|
||||
---
|
||||
|
||||
## 👀 REVIEW
|
||||
|
||||
*Task completati, in attesa di review*
|
||||
|
||||
| ID | Task | Assegnato | Completato | Reviewer | Note |
|
||||
|----|------|-----------|------------|----------|------|
|
||||
| - | - | - | - | - | - |
|
||||
|
||||
---
|
||||
|
||||
## ✅ DONE
|
||||
|
||||
*Task completati e verificati*
|
||||
|
||||
| ID | Task | Assegnato | Completato | Note |
|
||||
|----|------|-----------|------------|------|
|
||||
| - | - | - | - | - |
|
||||
|
||||
---
|
||||
|
||||
## 📊 Statistiche
|
||||
|
||||
| Stato | Conteggio | Percentuale |
|
||||
|-------|-----------|-------------|
|
||||
| TODO | 74 | 100% |
|
||||
| IN PROGRESS | 0 | 0% |
|
||||
| REVIEW | 0 | 0% |
|
||||
| DONE | 0 | 0% |
|
||||
| **Totale** | **74** | **0%** |
|
||||
|
||||
---
|
||||
|
||||
## 🎯 Milestone Fase 1 (MVP)
|
||||
|
||||
### Blocker Tasks (Devono essere completati prima)
|
||||
- T01-T05: Setup progetto
|
||||
- T06-T11: Database setup
|
||||
- T12-T16: Servizi sicurezza
|
||||
|
||||
### Core Features MVP
|
||||
- ✅ Autenticazione utenti (registrazione/login/logout JWT)
|
||||
- ✅ CRUD API key (cifrate AES-256)
|
||||
- ✅ Dashboard statistiche base (aggregazione)
|
||||
- ✅ API pubblica autenticata (sola lettura)
|
||||
|
||||
### Definition of Done (DoD)
|
||||
- [ ] Tutti i test passano (`pytest`)
|
||||
- [ ] Coverage >= 90% (`pytest --cov`)
|
||||
- [ ] Security headers implementati
|
||||
- [ ] Rate limiting attivo
|
||||
- [ ] API documentate (OpenAPI)
|
||||
- [ ] README completo
|
||||
- [ ] Nessun errore linting (`ruff check`)
|
||||
|
||||
---
|
||||
|
||||
## 🔗 Dipendenze Chiave
|
||||
|
||||
```
|
||||
T01-T05 (Setup)
|
||||
└── T06-T11 (Database)
|
||||
├── T12-T16 (Security)
|
||||
│ ├── T17-T22 (Auth)
|
||||
│ ├── T23-T29 (API Keys)
|
||||
│ │ └── T28 (Validation)
|
||||
│ │ └── T55-T58 (Background Tasks)
|
||||
│ └── T30-T34 (Stats)
|
||||
│ └── T35-T43 (Public API)
|
||||
└── T44-T54 (Frontend)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
*Ultimo aggiornamento: 2024-01-15*
|
||||
*Versione: 1.0*
|
||||
Reference in New Issue
Block a user