How nemliprog/rental-tracking-front works
Project type and purpose
• This is a single-page application (SPA) built with React, TypeScript and Vite.
• It implements a dashboard for managing customers, products and rentals, with reusable UI components and state management.
• It consumes a backend REST API (via axios) to fetch and mutate data.
File structure
• Top-level files: configuration (vite.config.ts, .env, ESLint), index.html, package.json.
• src/main.tsx bootstraps the React app and injects it into index.html.
• src/app/ holds global application setup: the router (routes.tsx), Redux-style store (store.ts), and typed hooks.
• src/common/ contains shared UI components (buttons, tables, inputs, layout containers), layout wrappers (DashboardLayout, MainLayout), and type definitions.
• src/features/ is organized by domain: customers/, products/, rental/, dashboard/. Each feature folder has:
· React components (e.g. add/edit forms, cards, charts)
· Data-access logic (queries, hooks that wrap axios calls)
· Local types and validation logic
• src/pages/ maps each feature to a URL route component.
• Assets (SVGs, fonts) under src/assets/.
README
• Confirms React+TS+Vite template with HMR and ESLint.
Main components
a. Client Browser
– Runs the compiled SPA, served by a static web host or dev server (Vite).
b. React Application
– Entry Point (main.tsx → App.tsx)
– Routing Layer (routes.tsx)
– State Management (store.ts + hooks.ts)
– Common UI Library (common/components, common/layouts)
– Feature Modules (features/customers, features/products, features/rental, features/dashboard)
c. External REST API
– Base URL configured in src/config/axios.config.ts
– customersQueries, productsQueries, rentalQueries, dashboardQueries define endpoints
d. Build & Tooling
– Vite dev server / build pipeline (vite.config.ts)
– ESLint config (eslint.config.js)
– TypeScript config files (tsconfig.json, etc.)
Relationships and interactions
• Browser requests index.html and loads the SPA.
• main.tsx initializes the store and router, then renders <App />.
• User navigates → routes.tsx selects a page in src/pages/.
• Page composes feature components (e.g. <CustomersPage /> uses useCustomers() hook).
• Hooks dispatch actions to the store and call axios via config/axios.config.ts.
• Axios sends HTTP requests to the external API and returns data.
• Feature components read state from the store, render UI via common components.
Architectural patterns and design principles
• Modular “feature-folder” pattern for domain separation
• Centralized state (Redux style) with typed hooks (useAppDispatch, useAppSelector)
• Container/Presentation split: queries and business logic in hooks + separate UI⁄layout components
• Reusable common library for consistency (tables, forms, layouts)
• Vite’s plugin system for fast refresh and minimal build config
Elements
· User → Routing
· Routing → Pages → Feature Components → Hooks → API
· API → Hooks → Store → Components
· Blue for UI components
· Green for state & hooks
· Orange for data-access
· Gray for external API
• Annotations for major config files:
· vite.config.ts (build)
· eslint.config.js (lint)
· tsconfig*.json (type system)