How faizm10/hackcanada works
Main Components
• Frontend UI: This is built using Next.js, Tailwind CSS, and React components. It includes pages for authentication, chat, case builder, cases dashboard, legal document generation, etc.
• Backend/API Server: A Node.js based server that handles API endpoints. Although the file tree only has a single backend file (e.g., testChatBot.js), it implies that API endpoints (for chat or legal document generation) delegate AI interactions.
• AI Integration: Incorporate the integration with Google’s Gemini API, used by the chatbot and document generator.
• Authentication Service: Firebase Authentication for secure user login/sign-up.
• Database: Supabase serves as the storage backend for tenant cases, chat history, and other essential data.
• External Integrations: Link to Firebase for auth and possibly Firestore (as mentioned in the README for storing chat history) as well as Supabase for case data storage.
Out Interactions and Relationships
• The User starts at the Frontend UI where they log in (Firebase Auth is used behind the scenes) and access the dashboard.
• Once logged in, users interact with various pages:
– The Chatbot page will send user legal questions to an API endpoint (within the Next.js app, under the “/api/chat” route). That API then interacts with the Google Gemini API to fetch province-specific legal advice.
– The Case Builder and Dispute Tracker pages allow the user to document disputes (including evidence upload) and monitor their progress. This data is then stored in the Supabase database.
– The Legal Document Generator page uses AI to auto-fill legal language for documents which are generated and can be previewed/downloaded as PDFs.
• The Backend API (or functions within the Next.js application) acts as an intermediary that manages and secures the data flow between the frontend, AI service, and databases.
• Additional integrations such as Firebase, Supabase, and potentially Firestore (for chat history) are connected to ensure proper authentication and data availability.
Architectural Patterns and Design Principles
• Separation of Concerns: Clearly separate the frontend client (UI, pages, and React components) from backend API logic and external services.
• API-Driven Design: The Next.js app contains several API routes (like /api/chat and /api/legal-document) that act as middle layers for external integrations.
• External Service Integration: Clearly mark Firebase for authentication, Supabase for your database, and Google Gemini for AI-powered functions.
Relevant Technologies and Frameworks
• Tailwind CSS for styling.
• Node.js backend components, even if minimal.
• Denote Firebase Auth for login mechanisms.
• Specify Supabase (and potentially Firestore if applicable) for the database tier.
• Google Gemini API as the AI service that powers legal advice and document generation.
Essential Elements
• Each component should have a clear, descriptive label (e.g., “User Interface (Next.js)”, “Chat API Endpoint”, “AI Integration (Google Gemini)”, “Authentication (Firebase)”, “Database (Supabase)”).