How rgraffe/gema-frontend works
Project Type and Purpose
• This is a single‐page application (SPA) built with React, TypeScript, and Vite.
• Purpose: provide a frontend UI for managing “grupos de trabajo” (work groups), “técnicos” (technicians), and “ubicaciones técnicas” (technical locations), plus user authentication and access to a static PDF manual.
File Structure Analysis
• Top‐level directories and files
• public/ – static assets (PDF manual, favicon, index.html)
• src/ – application source
– components/ – reusable UI pieces (AppSidebar, forms, dialogs, custom UI primitives under ui/)
– pages/ – top‐level route components (Login, VistaGeneral, Canva, Técnicos, UbicacionesTecnicas)
– services/ – HTTP client wrappers for REST endpoints (auth, gruposDeTrabajo, técnicos, ubicacionesTécnicas)
– hooks/ – custom React hooks (e.g. use-mobile)
– validators/ – Zod or similar schemas for form validation
– lib/ – shared utility functions
– types/ – TypeScript type definitions for domain models
– main.tsx / App.tsx – React app entry and root component
• Configuration & build
• vite.config.ts – Vite build and dev‐server setup
• tsconfig*.json – TypeScript configurations
• eslint.config.js – linting rules
README Insights
• Minimal template instructions for React+TypeScript in Vite with HMR.
• Mentions two plugin options for React Fast Refresh (Babel or SWC).
• No backend code in repo; services indicate external REST API integration.
1. Developer Environment & Build Toolchain
• Git, ESLint, TypeScript, Vite (dev server, HMR), Build scripts
2. Frontend SPA (Browser)
• React components (pages & ui library), custom hooks, state management
3. HTTP Service Layer (src/services)
• AuthService, TécnicosService, GruposDeTrabajoService, UbicacionesTécnicasService
4. External Backend API
• RESTful endpoints for authentication and CRUD ops
5. Static Assets Server
• public/*.pdf, public/index.html served by Vite in dev or CDN in prod
• Developer → (Git push) → CI/CD pipeline (build) → Deployment
• Vite dev server ↔ Browser (HMR, asset serving)
• Browser → (HTTP requests) → External Backend API
• External Backend API → (JSON responses) → Service Layer → UI components
• UI interactions → form validators → services → API
• Browser → (GET) → static PDF/manual
c. Architectural Patterns & Principles
• Separation of Concerns:
• UI layer (components/pages) vs. data access layer (services) vs. validation layer (validators)
• Componentization & Reusability:
• Atomic design in src/components/ui
• Type Safety & Contracts:
• TypeScript types and Zod schemas ensure consistency
• Dev vs. Prod:
• Vite dev server with HMR vs. optimized build output
d. Key Technologies & Frameworks
• React + React Fast Refresh (Babel or SWC)
• Vite (bundler, dev server)
• TypeScript (types, interfaces)
• ESLint with custom React hooks/lint rules
• Zod or similar for form validation
• CSS (index.css) and possible CSS framework or custom styles