How hitbox38/the-grimoire works
Main components
• Frontend Views & Pages – All client-facing UI resides mostly under the “app” directory. This includes the landing page (app/page.tsx), login (app/login), sign-up, confirmation pages (app/auth/confirm), error handling (app/error/page.tsx) and additional reference pages (for example, within app/references such as bestiary, items, spells).
• API Endpoints – Under the “app/api” folder (with subdirectories like login and signup), you have server-side logic handling requests, which are likely responsible for authentication and data uploads.
• UI Components Library – The “components” directory holds reusable UI parts (e.g., Dashboard, StatsTable, and various UI elements inside components/ui). This represents the view layer that both pages and references use.
• Utility & Library Modules – The “lib” folder contains utility functions (like calculateStatModifier.ts) and “utils” holds modules for integrating external services (Firebase in utils/firebase and Supabase in utils/supabase).
• Configuration & Build Tools – Files like next.config.ts, tailwind.config.ts, tsconfig.json, and others manage build, configuration, and styling.
Relationships and interactions
• Frontend and API: The pages and actions within “app” (for login, signup, reference views) interact with API endpoints to process data. For example, app/api/login/route.ts handles login requests, while actions in app/login invoke these endpoints.
• Component Integration: The UI components from the “components” folder are composed within pages to render interactive elements. They likely receive data fetched from API endpoints or processed by libraries in “lib”.
• External Services: Utility modules in “utils/firebase” and “utils/supabase” represent the layers that abstract backend integrations. These modules are used within API endpoints or server-side logic to communicate with external databases or authentication services.
• Global Providers: Under “app/providers”, such as QueryProvider.tsx, global state or caching mechanisms (potentially using React Query or similar libraries) are set up to manage data across the application.
• Routing & Layout: The “app/layout.tsx” file sets up the common layout for pages, leveraging Next.js’s built-in routing and file-based code splitting.
Architectural patterns and design principles
• Separation of Concerns: The project clearly separates UI, API logic, external integrations, and utility functions.
• Component Reusability: With a dedicated UI component folder, the design emphasizes reusability for consistency across views.
• Modularization: Distinct directories for API endpoints, authentication flows, references, and configuration illustrate modular design.
• Full-stack Integration: By combining server-side API routes with client-side page rendering in Next.js, the project maintains a robust full-stack separation.