How victorvinh04/shadcn-admin works
Main Components
a. UI & Presentation Layer:
• Layout Components: Represent the overall page structure (e.g., app-sidebar, header, top-nav, main content, and side navigations).
• UI Components: Capture the reusable visual components provided under src/components/ui (buttons, alerts, dialogs, modals, tables, etc.).
• Custom Components: Highlight components like password-input, command-menu, profile-dropdown, and theme-switch.
b. Feature Modules:
• Authentication: Include sub-modules like sign-in, sign-up, OTP, and forgot-password located under src/features/auth.
• Dashboard & Analytics: Shown under src/features/dashboard, representing components like overview and recent-sales.
• Communication & Interaction: Modules like Chats (src/features/chats) and Tasks (src/features/tasks) that contain dedicated UI and logic.
• User Management: Under src/features/users for user tables, dialogs, invites, and deletion functionalities.
• Settings: All settings-related features for account, appearance, display, notifications, and profile that reside in src/features/settings.
c. Routing & Navigation:
• Router Setup: Based on TanStack Router as declared in the README, the src/routes directory structure serves as the backbone for page routing and authentication versus error pages.
• Route Groups: Different folders for authenticated routes, auth pages, and error pages indicate a segregated routing strategy.
d. State & Context Providers:
• Contexts for theme, fonts, and search (in src/context) providing global state management.
• Stores, e.g. authStore in src/stores, provide the state layer to support authentication and UI state.
e. Utilities & Configuration:
• Build Tool: Vite (vite.config.ts) drives the build and development process.
• TypeScript Configurations: Multiple tsconfig files to maintain type safety.
• Linting and Formatting: Eslint (eslint.config.js) and Prettier (prettierrc and prettierignore) ensure code consistency.
• Tailwind and PostCSS setup: Tailwind config and postcss.config.js manage styling.
Relationships and Interactions
• The Layout and UI components form the visual framework and are used across all pages.
• Each feature module (auth, dashboard, tasks, etc.) uses its own folder structure with associated sub-components for both UI and business logic.
• Global context and stores are shared across the modules providing state management (e.g., theme and authentication information).
• The routing system (src/routes) ties together public pages (auth and error routes) with protected/authenticated screens.
Architectural Patterns and Design Principles
• Modular Structure: The project follows a feature-based module organization making components, hooks, and contexts highly modular.
• Component Reusability: With a distinct UI library in src/components/ui, the design emphasizes reusable building blocks that can be applied in various contexts.
• Separation of Concerns: The file organization clearly separates layout, business logic (features), routing, and utilities.
• Responsive and Accessible Design: As noted in the README, components are designed with responsiveness and accessibility in mind, which might influence how components interact (e.g., state-sensitive UI updates).