How biohazard786/billicious works
Main Components
• Frontend Client: This includes the Next.js “app” directory and the various React components in “components”. It is responsible for rendering UI pages such as group pages, bill forms, dashboards, and authentication screens.
• Backend API: Found under “app/api”, this set of APIs handles functionalities for bills, groups, invites, transactions, and users. These endpoints follow RESTful (or Next.js route-based) patterns.
• Authentication Module: Located in “app/auth” and “auth-utils”, this component includes pages for sign-in, sign-up, passkey registration, error handling, and middleware for secure routes.
• Database Layer: The “database” folder contains configuration and connection modules, integrating with Supabase. Also, schema definitions and Kafka utilities (for streaming, if applicable) can be represented here.
• State & Data Management: The “store” (for Zustand and its various slices), “providers”, and “lib” directories represent how application state and cross-component communication (via Tanstack Query and custom hooks) is managed.
• External Services: Include Supabase for the backend, real-time updates, and Hanko for authentication. Also, utility integrations like Kafka (if used beyond basic logging) and possibly Tailwind / Shadcn UI configurations are noted.
Relationships and Interactions
• The UI (Frontend React components) sends user actions to the Backend APIs via HTTP requests or fetch calls using Tanstack Query.
• API routes perform CRUD operations on the Supabase database and communicate with authentication systems.
• Real-time updates are pushed via Supabase Realtime to keep all connected clients informed about any changes (e.g., a new expense or group update).
• Global state is maintained using Zustand and provided across the component tree using various providers (e.g., NotificationStoreProvider, DashboardStoreProvider).
• Authentication and authorization are handled both on the client (via "app/auth" and "auth-utils") and on the server (middleware in “middleware.ts”) to secure endpoints.
Architectural Patterns & Design Principles
• Modular and Organized Structure: The project separate concerns into clearly defined directories (API, components, providers, store) which suggests a separation of concerns/MVC-like pattern.
• File-Based Routing: The “app” directory relies on Next.js file-based routing to organize pages and API endpoints.
• Declarative UI and State Management: Use of React with Zustand and Tanstack Query indicates a focus on reactive, data-driven UI updates.
• External Service Integration: Supabase and Hanko integration for real-time data updates and modern authentication reflects microservice integration.
Relevant Technologies
• Frontend: Next.js 14, React, Shadcn UI, Tailwind CSS, Framer Motion.
• Backend: Next.js API routes, Supabase for database & real-time, Kafka configuration.
• State Management: Zustand, Tanstack Query.
• Authentication: Passkey support using Hanko integrated via custom auth utilities.