turash/docs/concept/15_front-end_architecture.md
Damir Mukimov 000eab4740
Major repository reorganization and missing backend endpoints implementation
Repository Structure:
- Move files from cluttered root directory into organized structure
- Create archive/ for archived data and scraper results
- Create bugulma/ for the complete application (frontend + backend)
- Create data/ for sample datasets and reference materials
- Create docs/ for comprehensive documentation structure
- Create scripts/ for utility scripts and API tools

Backend Implementation:
- Implement 3 missing backend endpoints identified in gap analysis:
  * GET /api/v1/organizations/{id}/matching/direct - Direct symbiosis matches
  * GET /api/v1/users/me/organizations - User organizations
  * POST /api/v1/proposals/{id}/status - Update proposal status
- Add complete proposal domain model, repository, and service layers
- Create database migration for proposals table
- Fix CLI server command registration issue

API Documentation:
- Add comprehensive proposals.md API documentation
- Update README.md with Users and Proposals API sections
- Document all request/response formats, error codes, and business rules

Code Quality:
- Follow existing Go backend architecture patterns
- Add proper error handling and validation
- Match frontend expected response schemas
- Maintain clean separation of concerns (handler -> service -> repository)
2025-11-25 06:01:16 +01:00

71 lines
2.7 KiB
Markdown

## 13. Front-End Architecture
### Stack
**Core Stack**: React + Mapbox GL / Deck.GL for visualization.
**Performance Targets**:
- **Load Time**: <2 seconds first contentful paint
- **Interactivity**: <3 seconds time to interactive
- **Bundle Size**: <200KB initial JavaScript payload
- **Lighthouse Score**: >90 on performance, accessibility, best practices
- **Mobile Performance**: >85 Lighthouse score on 3G networks
**Framework Options**:
- **Next.js 14+** with App Router (recommended for SEO and performance)
- Server Components for initial load performance (60% faster page loads)
- Client Components only where interactivity needed (reduces bundle size by 40%)
- SSR/SSG for public pages (better SEO, 50% faster perceived load times)
### State Management
- **Server State**: React Query/TanStack Query for API data
- **Client State**: Zustand or Jotai for UI state
- **Form State**: React Hook Form + Zod validation
### Data Visualization
**Performance Requirements**:
- **Map Rendering**: 10,000+ points with <100ms interaction response
- **Data Loading**: Progressive loading for large datasets (<5s initial render)
- **Real-time Updates**: <500ms for live data updates
- **Mobile Optimization**: Touch-friendly interactions, optimized for small screens
**Implementation Details**:
- **Mapbox GL JS**: Primary map rendering (50k loads/month free tier, 200/month for production)
- **Deck.gl**: Advanced 3D visualizations for 100k+ data points with WebGL acceleration
- **Observable Plot**: Declarative charting for economic dashboards (40% less code than D3)
- **Recharts**: React-native charts for embedded analytics (60% faster rendering)
- **D3.js**: Custom Sankey diagrams for resource flow visualization (shows 50M+ potential exchanges)
### Real-Time Updates
- **WebSockets**: Socket.io or native WebSocket API
- **Server-Sent Events (SSE)**: For one-way updates
- **GraphQL Subscriptions**: If using GraphQL
### UI Component Library
- **shadcn/ui**: Modern, customizable components
- **Radix UI**: Accessible primitives
- **Tailwind CSS 4**: Latest version with better performance
### Views
1. **Map Layer:** colored dots by resource type (heat, water, etc.), connecting lines for possible exchanges.
2. **Facility Profile:** shows inputs/outputs, economics, ESG metrics.
3. **Matching Dashboard:** ranked list of viable pairings.
4. **Scenario Simulator:** drag two nodes together, see pipe length, payback, CO avoided.
### Mobile Application
**Recommendation**: Start with **Progressive Web App (PWA)**, consider native app later if needed.
**Use Cases**:
- Field technicians logging resource flows
- On-site quality verification
- Push notifications for new matches
- Mobile map interface
---