How sebas99032/lerm-antropometria-portal works
Project type and purpose
• This is a single-page web application (SPA) built with React and TypeScript.
• It serves as a role-based dashboard and form-submission tool (Admin, Assistant, Evaluator, Public) that interacts with an external API for authentication, data retrieval, and form storage.
• The app uses shadcn-ui (a Radix-based component library) and Tailwind CSS for styling, bundled by Vite.
File structure
• Top-level entries:
• package.json / bun.lockb / lock files – Node dependency management and lock versions
• vite.config.ts / tsconfig*.json / tailwind.config.ts – build, TypeScript, and CSS config
• public/index.html – HTML entry point and static assets (robots.txt)
• src/ contains everything in the running app:
• main.tsx & index.css – SPA entry point and global styles
• components/ – shared UI and layout components, including ProtectedRoute and Header
• components/ui/ – shadcn-ui wrappers for low-level UI primitives (buttons, dialogs, forms, etc.)
• contexts/AuthContext.tsx – holds user state & token, protects routes
• hooks/ – custom React hooks (mobile detection, toasts)
• lib/ – pure-TS modules (mockData, utils)
• pages/ – route/page components (dashboards, forms, login, 404)
README for additional insights
• It confirms the tech stack: Vite, TypeScript, React, shadcn-ui, Tailwind CSS.
• Deployment is handled through the Lovable platform; no in-repo backend.
• Development uses npm scripts: npm run dev, npm run build.
a. Main components
• Browser / User Agent (Chrome, Safari, etc.)
• React SPA (App shell)
• UI Component Library (shadcn-ui + Tailwind CSS)
• State Management & Routing (React Context + React Router via ProtectedRoute)
• Data Layer / API Client (fetch or axios calls in utils/hooks)
• External Services:
• Authentication/API server (hosted outside the repo via Lovable or custom backend)
• Analytics / Logging (optional)
• Build & Deployment Pipeline (Vite dev server, Node.js/npm, Lovable publish)
b. Relationships & data flow
1. User loads index.html → Vite dev server / static hosting → serves compiled JS/CSS
2. App initializes: main.tsx renders App.tsx, sets up AuthContext and Router
3. User navigates to a page → ProtectedRoute checks AuthContext → either redirects to Login or renders page component
4. Page components dispatch API calls (via utils or custom hooks) → requests go over HTTP to external API
5. Responses update Context or component state → UI components re-render with new data
6. User actions may trigger client-side state changes (toasts, local UI updates) before/after API calls
c. Architectural patterns & principles
• Component-based UI (React + shadcn-ui)
• Separation of concerns: UI components vs page/route logic vs data fetching vs state context
• Single Source of Truth for auth state via React Context
• Custom hooks for cross-cutting concerns (toasts, device detection)
• Unidirectional data flow (React state → props → UI)
d. Key technologies/frameworks
• React + TypeScript
• Vite (bundler, dev server)
• Tailwind CSS + shadcn-ui for styling and prebuilt components
• React Router (via ProtectedRoute) for client-side routing
• Node.js / npm for local development and build tasks
• Lovable platform for CI/CD and hosting
Detail without over-complication
• Logical tier (UI, routing, state, data access, external API).
• Where custom code lives (contexts, hooks, lib) vs. off-the-shelf frameworks.