How lofadev/react-shadcn-tailwind-boilerplate works
Primary components
• Entry / Bootstrapping: Recognize that the application starts at index.html and src/index.tsx, which renders the root component (src/App.tsx).
• Component Layer: Include the shared UI components (in src/components and its subdirectories) that comprise the building blocks of the UI. This also includes the shadcn-inspired components and additional UI utilities.
• Pages and Layouts: The src/pages and src/layouts directories represent the different screens/views and how they are structured (e.g., public, auth, home, not-found).
• Routing: The src/routes folder (with files like app-route.tsx, global.tsx, private.tsx, public.tsx) encapsulates the routing logic using React Router.
• State Management: The src/store directory (with files for auth, loading, toast) uses zustand for global state management.
• API and Configurations: The src/configs (axios, env) and src/services directories handle external API calls and configurations.
• Utilities & Helpers: Include src/lib, src/utils, and src/validations (such as auth.schema) that provide helper functions, validation logic, and generic libraries.
• Constants & Types: src/constants and src/types define key data like endpoints, routing constants, and type definitions.
Interactions and relationships
• App to the Layout components. Show that specific pages (from the pages directory) are rendered within these layouts.
• Routing mechanism: illustrate how React Router (from the routes directory) navigates between pages (public, private, auth).
• State management: indicate how various components (and pages) interact with the global state via zustand (src/store).
• API interactions: show the flow from UI components to API calls via services (axios calls in src/services) with configuration support from src/configs.
Architectural patterns and design principles
• Component Reusability: The structure emphasizes modular components in src/components, reusable layouts, and the separation between UI and business logic.
• Separation of Concerns: Distinct directories (\pages for view logic, \components for UI, \store for state, \services for API interactions) support maintainability.
• Consistency and Extensibility: The integrated linting, formatting, and state management systems enable a consistent code style and serve as hooks for future extensions.
• Layered Architecture: Present a layered view with presentation (UI components and pages), logic (routes and state management), data (services and configurations), and utility layers.