How faroog25/construction-management-app works
Project type and purpose
• This is a single-page application (SPA) front-end only, built with React 18, TypeScript, and Vite.
• It consumes one or more RESTful APIs (via the services/ layer) to power a Construction Management Assistant UI (clients, projects, tasks, equipment, documents, team).
• It uses React Router for navigation, React Query for data fetching/caching, React Hook Form + Zod for form validation, Tailwind CSS + shadcn/ui for styling and components, plus contexts for theming and i18n.
File structure
• Top-level “src” divides into:
• pages/: route components (e.g. Projects.tsx, ClientProfile.tsx)
• components/: reusable UI and domain widgets (GanttChart, Navbar, Modals, ui/ primitives)
• services/: functions that wrap HTTP calls to backend endpoints
• hooks/: custom React hooks (use-mobile, use-toast, useTaskWorkers)
• contexts/: global React contexts for Theme and Language
• lib/ & utils/: pure utilities and Zod validation schemas
• data/: mock or static JSON (e.g. API docs)
• entrypoints & configs: main.tsx, App.tsx, vite.config.ts, Tailwind, ESLint, TS configs.
README insights
• Confirms technology choices and high-level features (React Query, shadcn/ui, Tailwind, Zod).
• Mentions routing and data-fetching stacks, responsive design, dark mode, type safety.
Main components & interactions (
a. Presentation Layer
• Pages (React Router routes)
• UI Components (shadcn/ui primitives + domain components under components/)
b. State & Context
• React Query cache & QueryClient (data caching)
• ThemeContext & LanguageContext (global state)
c. Service Layer
• services/*.ts modules → HTTP client (in services/api.ts) → backend REST API
d. Utilities & Validation
• Zod schemas in lib/validations used in form components via React Hook Form
• Helper functions in lib/utils.ts & utils/
e. Build & Tooling
• Vite dev server & bundler
• Tailwind PostCSS pipeline
• ESLint / TS checks
Flow example:
User clicks “New Project” → Page component opens <NewProjectModal> → React Hook Form + Zod validate inputs → onSubmit calls projectService.create(...) → api.ts issues HTTP POST → server responds → React Query invalidates project list query → UI updates.
Architectural patterns & design principles
• Component-based UI (shadcn/ui + custom)
• Layered separation: Presentation ↔ State/Context ↔ Services ↔ API
• Unidirectional data flow (React Query & hooks)
• Type safety end-to-end (TypeScript + Zod + typed service responses)
• Theming & Localization via Context