How tbarondar/furry-agents-of-chaos works
Project type and purpose
• This is a single‐page frontend application (SPA) built with React, TypeScript, Vite, Redux and Material-UI.
• Its purpose is to browse cat data: view breeds, individual cats, manage favorites (persisted in local storage), and display modals for details. Data comes from an external Cats API, validated with Zod.
File structure
• Top-level config & tooling:
• pre‐commit hooks (scripts/)
• ESLint, Prettier, Vite config, tsconfig, package.json
• public/index.html and assets
• Entry point: src/main.tsx → App.tsx → routing (create-router.tsx)
• src/config: axios instance, router factory, Redux store, MUI theme
• src/modules: feature modules (about, breeds, cats, favorites) each with page, components & hooks
• src/shared:
• components (layout, app bar, loading spinner, error handler, modals)
• dto definitions for API payloads
• Redux reducers, services (query wrapper, Zod validation), utility functions
• Deployment config: vercel.json, .env support
README for extra context
• Confirms tech stack: React Router, Redux store, Axios, Zod, MUI.
• Routes for “about”, “breeds”, “cats”, “favorites”.
• Goals: loading states, error handling, storing favorites in localStorage, CI/CD on Vercel.
a. Main components:
• UI Layer (React + MUI)
• Feature modules: BreedsPage, CatsPage, FavoritesPage, AboutPage
• Shared layout: AppBar, MainLayout, LoadingSpinner, GlobalErrorHandler, Modals (CatDetails)
• Routing Layer (React Router)
• State Management (Redux Store + Reducers)
• Service Layer (AxiosInstance + Query API + Zod Validation)
• Persistence: LocalStorage (guest user, favorites)
• External Service: Cats REST API
• Build/Dev Tools (Vite, ESLint, Prettier, pre-commit hooks)
• Deployment Platform: Vercel
b. Relationships & interactions:
• User interacts with UI components → dispatches Redux actions
• Redux middleware (thunks) invoke Service Layer
• AxiosInstance sends HTTP requests → external Cats API → JSON response
• Response flows through Zod validators → normalized DTOs → Redux reducers update store
• UI (subscribed to store) re-renders updated views
• Favorites actions also read/write to LocalStorage
• React Router switches pages & handles fallback errors via Shared ErrorHandler
• Build chain (Vite) bundles code; pre-commit hooks enforce lint/format rules; Vercel handles CI/CD
c. Architectural patterns & design principles:
• Feature-based modularization (each domain in its own folder)
• Unidirectional data flow (Redux)
• Separation of concerns: UI, routing, state, services, validation
• DTOs + Zod for safe API contracts
• Shared components for consistent look & feel
d. Key technologies/frameworks:
• React + React Router
• Redux Toolkit (store, reducers)
• Axios with custom instance & interceptors
• Zod for runtime schema validation
• Material-UI for UI
• Vite for development & bundling
• ESLint/Prettier for code quality
• Vercel for deployment
Diagramming recommendations
• UI components (blue)
• State/Routing (green)
• Services/Validation (purple)
• External systems (orange)
• Rectangles for modules/services
• Cloud symbol for external API