From 2566f712a25b4d249da24007750e9c89d5a93d3c Mon Sep 17 00:00:00 2001 From: Luca Sacchi Ricciardi Date: Mon, 6 Apr 2026 11:29:38 +0200 Subject: [PATCH] docs: add comprehensive frontend development plan MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Added - frontend-plan.md: Complete React/Vite frontend development plan ## Contents - Project architecture and folder structure - Tech stack (React 18, Vite, TypeScript, Tailwind, shadcn/ui) - Design system with colors and components - Page-by-page feature specifications - API integration details - 8-phase implementation roadmap (3-4 weeks) - UI mockups for Dashboard and Chat - Acceptance criteria 🎨 Ready for frontend development --- frontend-plan.md | 386 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 386 insertions(+) create mode 100644 frontend-plan.md diff --git a/frontend-plan.md b/frontend-plan.md new file mode 100644 index 0000000..76e33d4 --- /dev/null +++ b/frontend-plan.md @@ -0,0 +1,386 @@ +# Piano di Sviluppo Frontend - AgenticRAG + +## πŸ“‹ Overview + +Sviluppo di un'interfaccia web moderna per AgenticRAG utilizzando **React 18 + Vite + TypeScript + Tailwind CSS + shadcn/ui**. + +--- + +## 🎯 Obiettivi + +1. **Dashboard Intuitiva** - Overview del sistema e statistiche +2. **Gestione Documenti** - Upload, preview, e organizzazione +3. **Chat Avanzata** - Interfaccia conversazionale con RAG +4. **Configurazione Provider** - Selezione e gestione LLM +5. **Responsive Design** - Mobile-first, tema chiaro/scuro + +--- + +## πŸ—οΈ Architettura + +``` +frontend/ +β”œβ”€β”€ public/ +β”‚ └── favicon.ico +β”œβ”€β”€ src/ +β”‚ β”œβ”€β”€ components/ # Componenti React +β”‚ β”‚ β”œβ”€β”€ layout/ # Layout components +β”‚ β”‚ β”‚ β”œβ”€β”€ Navbar.tsx +β”‚ β”‚ β”‚ β”œβ”€β”€ Sidebar.tsx +β”‚ β”‚ β”‚ └── Layout.tsx +β”‚ β”‚ β”œβ”€β”€ dashboard/ # Dashboard components +β”‚ β”‚ β”‚ β”œβ”€β”€ StatsCard.tsx +β”‚ β”‚ β”‚ β”œβ”€β”€ RecentDocuments.tsx +β”‚ β”‚ β”‚ └── ActivityFeed.tsx +β”‚ β”‚ β”œβ”€β”€ documents/ # Document management +β”‚ β”‚ β”‚ β”œβ”€β”€ UploadZone.tsx +β”‚ β”‚ β”‚ β”œβ”€β”€ DocumentList.tsx +β”‚ β”‚ β”‚ β”œβ”€β”€ DocumentPreview.tsx +β”‚ β”‚ β”‚ └── DocumentCard.tsx +β”‚ β”‚ β”œβ”€β”€ chat/ # Chat interface +β”‚ β”‚ β”‚ β”œβ”€β”€ ChatContainer.tsx +β”‚ β”‚ β”‚ β”œβ”€β”€ MessageList.tsx +β”‚ β”‚ β”‚ β”œβ”€β”€ MessageBubble.tsx +β”‚ β”‚ β”‚ β”œβ”€β”€ SourceCitations.tsx +β”‚ β”‚ β”‚ └── ChatInput.tsx +β”‚ β”‚ └── settings/ # Settings components +β”‚ β”‚ β”œβ”€β”€ ProviderSelector.tsx +β”‚ β”‚ β”œβ”€β”€ ModelSelector.tsx +β”‚ β”‚ └── ThemeToggle.tsx +β”‚ β”œβ”€β”€ hooks/ # Custom React hooks +β”‚ β”‚ β”œβ”€β”€ useAuth.ts +β”‚ β”‚ β”œβ”€β”€ useDocuments.ts +β”‚ β”‚ β”œβ”€β”€ useChat.ts +β”‚ β”‚ β”œβ”€β”€ useProviders.ts +β”‚ β”‚ └── useTheme.ts +β”‚ β”œβ”€β”€ api/ # API client +β”‚ β”‚ β”œβ”€β”€ client.ts +β”‚ β”‚ β”œβ”€β”€ documents.ts +β”‚ β”‚ β”œβ”€β”€ chat.ts +β”‚ β”‚ └── providers.ts +β”‚ β”œβ”€β”€ types/ # TypeScript types +β”‚ β”‚ β”œβ”€β”€ document.ts +β”‚ β”‚ β”œβ”€β”€ chat.ts +β”‚ β”‚ β”œβ”€β”€ provider.ts +β”‚ β”‚ └── auth.ts +β”‚ β”œβ”€β”€ stores/ # State management (Zustand) +β”‚ β”‚ β”œβ”€β”€ authStore.ts +β”‚ β”‚ β”œβ”€β”€ chatStore.ts +β”‚ β”‚ └── settingsStore.ts +β”‚ β”œβ”€β”€ lib/ # Utilities +β”‚ β”‚ β”œβ”€β”€ utils.ts +β”‚ β”‚ └── constants.ts +β”‚ β”œβ”€β”€ pages/ # Route pages +β”‚ β”‚ β”œβ”€β”€ Dashboard.tsx +β”‚ β”‚ β”œβ”€β”€ Documents.tsx +β”‚ β”‚ β”œβ”€β”€ Chat.tsx +β”‚ β”‚ β”œβ”€β”€ Settings.tsx +β”‚ β”‚ └── Login.tsx +β”‚ β”œβ”€β”€ App.tsx +β”‚ β”œβ”€β”€ main.tsx +β”‚ └── index.css +β”œβ”€β”€ index.html +β”œβ”€β”€ package.json +β”œβ”€β”€ tsconfig.json +β”œβ”€β”€ vite.config.ts +β”œβ”€β”€ tailwind.config.js +└── components.json # shadcn/ui config +``` + +--- + +## πŸ“¦ Stack Tecnologico + +| Categoria | Tecnologia | Versione | +|-----------|------------|----------| +| Framework | React | ^18.2.0 | +| Build Tool | Vite | ^5.0.0 | +| Language | TypeScript | ^5.0.0 | +| Styling | Tailwind CSS | ^3.4.0 | +| UI Components | shadcn/ui | latest | +| Icons | Lucide React | ^0.300.0 | +| State | Zustand | ^4.4.0 | +| HTTP Client | Axios | ^1.6.0 | +| Routing | React Router DOM | ^6.20.0 | +| Forms | React Hook Form | ^7.48.0 | +| Validation | Zod | ^3.22.0 | + +--- + +## 🎨 Design System + +### Colori +```css +/* Tema Chiaro */ +--background: 0 0% 100%; +--foreground: 222.2 84% 4.9%; +--primary: 221.2 83.2% 53.3%; +--secondary: 210 40% 96.1%; +--accent: 210 40% 96.1%; +--muted: 210 40% 96.1%; +--border: 214.3 31.8% 91.4%; + +/* Tema Scuro */ +--background: 222.2 84% 4.9%; +--foreground: 210 40% 98%; +--primary: 217.2 91.2% 59.8%; +--secondary: 217.2 32.6% 17.5%; +--accent: 217.2 32.6% 17.5%; +--muted: 217.2 32.6% 17.5%; +--border: 217.2 32.6% 17.5%; +``` + +### Componenti shadcn/ui da Installare +- `button` - Pulsanti +- `card` - Card contenitori +- `dialog` - Modali +- `dropdown-menu` - Menu a discesa +- `input` - Input testuali +- `label` - Etichette +- `select` - Select dropdown +- `separator` - Separatori +- `sheet` - Side panels +- `skeleton` - Loading states +- `tabs` - Tab navigation +- `textarea` - Area di testo +- `toast` - Notifiche +- `tooltip` - Tooltip + +--- + +## πŸ“± Pagine e FunzionalitΓ  + +### 1. Login Page (`/login`) +- Form di autenticazione +- Supporto API Key o JWT +- Redirect post-login + +### 2. Dashboard (`/`) +- **Stats Overview**: Documenti totali, query oggi, token usati +- **Recent Documents**: Ultimi 5 documenti caricati +- **Quick Actions**: Upload rapido, inizia chat +- **Activity Feed**: Log delle ultime attivitΓ  + +### 3. Documents (`/documents`) +- **Upload Zone**: Drag & drop multi-file +- **Document List**: Tabella con filtri e ricerca +- **Document Preview**: Modal con contenuto estratto +- **Actions**: Elimina, scarica, visualizza + +### 4. Chat (`/chat`) +- **Chat Interface**: Stile ChatGPT/Claude +- **Message Bubbles**: User (destra) / AI (sinistra) +- **Source Citations**: Link ai documenti fonte +- **Streaming**: Risposte in tempo reale (SSE) +- **History**: Lista conversazioni precedenti +- **New Chat**: Pulsante nuova conversazione + +### 5. Settings (`/settings`) +- **Provider Selection**: Dropdown provider LLM +- **Model Selection**: Lista modelli disponibili +- **Theme Toggle**: Chiaro/Scuro/Sistema +- **API Configuration**: Mostra provider configurati + +--- + +## πŸ”Œ API Integration + +### Endpoints Utilizzati + +```typescript +// Documents +GET /api/v1/documents // Lista documenti +POST /api/v1/documents // Upload documento +DELETE /api/v1/documents/{id} // Elimina documento +GET /api/v1/documents/{id}/content // Contenuto estratto + +// Query & Chat +POST /api/v1/query // Query RAG +POST /api/v1/chat // Chat endpoint + +// Providers +GET /api/v1/providers // Lista provider +GET /api/v1/providers/{id}/models // Lista modelli +GET /api/v1/config // Configurazione +PUT /api/v1/config/provider // Aggiorna provider +``` + +### Autenticazione +```typescript +// API Key +headers: { 'X-API-Key': 'your-api-key' } + +// JWT Token +headers: { 'Authorization': 'Bearer your-token' } +``` + +--- + +## πŸ“‹ Piano di Implementazione + +### Fase 1: Setup (2-3 giorni) +- [ ] Inizializzare progetto Vite + React + TypeScript +- [ ] Configurare Tailwind CSS +- [ ] Installare shadcn/ui +- [ ] Configurare struttura cartelle +- [ ] Setup routing con React Router +- [ ] Setup Zustand per state management +- [ ] Creare API client base + +### Fase 2: Layout & Navigazione (2 giorni) +- [ ] Implementare Layout component +- [ ] Creare Navbar con logo e user menu +- [ ] Implementare Sidebar navigation +- [ ] Aggiungere theme toggle +- [ ] Responsive design (mobile) + +### Fase 3: Autenticazione (1-2 giorni) +- [ ] Login page +- [ ] Auth hook (useAuth) +- [ ] Auth store (Zustand) +- [ ] Protected routes +- [ ] Logout functionality + +### Fase 4: Dashboard (2 giorni) +- [ ] Stats cards +- [ ] Recent documents list +- [ ] Activity feed +- [ ] Quick actions +- [ ] Real-time updates (optional) + +### Fase 5: Document Management (3 giorni) +- [ ] Upload zone (drag & drop) +- [ ] Document list table +- [ ] Search and filters +- [ ] Document preview modal +- [ ] Delete confirmation +- [ ] Progress indicators + +### Fase 6: Chat Interface (4-5 giorni) +- [ ] Chat container layout +- [ ] Message components +- [ ] Message input with submit +- [ ] Source citations display +- [ ] Streaming responses (SSE) +- [ ] Chat history sidebar +- [ ] Export conversation + +### Fase 7: Settings (2 giorni) +- [ ] Provider selector +- [ ] Model selector +- [ ] Theme settings +- [ ] Config display + +### Fase 8: Polish & Testing (2-3 giorni) +- [ ] Loading states +- [ ] Error handling +- [ ] Toast notifications +- [ ] E2E testing +- [ ] Performance optimization +- [ ] Accessibility audit + +--- + +## πŸš€ Comandi Utili + +```bash +# Setup iniziale +cd frontend +npm create vite@latest . -- --template react-ts +npm install + +# Install dependencies +npm install -D tailwindcss postcss autoprefixer +npx tailwindcss init -p + +# Install shadcn/ui +npx shadcn-ui@latest init + +# Install components +npx shadcn-ui@latest add button card dialog input label select tabs toast + +# Install additional packages +npm install zustand axios react-router-dom lucide-react + +# Development +npm run dev + +# Build +npm run build + +# Preview +npm run preview +``` + +--- + +## 🎨 Mockup UI + +### Dashboard +``` +β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” +β”‚ 🧠 AgenticRAG Dashboard Documents Chat Settingsβ”‚ +β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ +β”‚ β”‚ +β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ +β”‚ β”‚ πŸ“„ Documentsβ”‚ β”‚ πŸ’¬ Queries β”‚ β”‚ πŸ”€ Tokens β”‚ β”‚ +β”‚ β”‚ 1,234 β”‚ β”‚ 567 β”‚ β”‚ 1.2M β”‚ β”‚ +β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ +β”‚ β”‚ +β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ +β”‚ β”‚ πŸ“„ Recent Documents β”‚ β”‚ ⚑ Quick Actions β”‚ β”‚ +β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ +β”‚ β”‚ β€’ Documento 1.pdf β”‚ β”‚ [Upload Document] β”‚ β”‚ +β”‚ β”‚ β€’ Documento 2.docx β”‚ β”‚ [Start Chat] β”‚ β”‚ +β”‚ β”‚ β€’ Documento 3.txt β”‚ β”‚ β”‚ β”‚ +β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ +β”‚ β”‚ [View All β†’] β”‚ β”‚ β”‚ β”‚ +β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ +β”‚ β”‚ +β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ +``` + +### Chat Interface +``` +β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” +β”‚ 🧠 AgenticRAG [User β–Ό] β”‚ +β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ +β”‚ πŸ’¬ Chat 1 β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ +β”‚ πŸ’¬ Chat 2 β”‚ β”‚ β”‚ +β”‚ πŸ’¬ Chat 3 β”‚ πŸ‘€ Ciao! β”‚ β”‚ +β”‚ β”‚ β”‚ β”‚ +β”‚ [+ New Chat] β”‚ πŸ€– Ciao! Come β”‚ β”‚ +β”‚ β”‚ posso aiutarti? β”‚ β”‚ +β”‚ β”‚ [πŸ“„ Fonte 1] β”‚ β”‚ +β”‚ β”‚ β”‚ β”‚ +β”‚ β”‚ πŸ‘€ Domanda... β”‚ β”‚ +β”‚ β”‚ β”‚ β”‚ +β”‚ β”‚ πŸ€– Risposta... β”‚ β”‚ +β”‚ β”‚ β”‚ β”‚ +β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ +β”‚ β”‚ β”‚ Scrivi un β”‚ β”‚ β”‚ +β”‚ β”‚ β”‚ messaggio... β”‚ β”‚ β”‚ +β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ +β”‚ β”‚ [➀] β”‚ β”‚ +β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ +β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ +``` + +--- + +## βœ… Criteri di Accettazione + +- [ ] Setup progetto completato +- [ ] Tutte le pagine implementate +- [ ] Integrazione API funzionante +- [ ] Autenticazione funzionante +- [ ] Tema chiaro/scuro implementato +- [ ] Responsive design completato +- [ ] Error handling implementato +- [ ] Loading states aggiunti +- [ ] Test E2E passati +- [ ] Build di produzione funzionante + +--- + +**Stima Totale:** 3-4 settimane (1 sviluppatore full-time)