# mpcgt/saguenay architecture

> Architecture diagram of the GitHub repository mpcgt/saguenay, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mpcgt/saguenay
- Repository: https://github.com/mpcgt/saguenay

## Overview

##### Project Type and Purpose
- The project is a social networking platform – Saguenay – designed for users to join groups around shared interests (like sports, art, environment, etc.) and interact via posts, discussions, and profiles.
- It is a modern, full-stack web application primarily focused on the front-end with a React/TypeScript base, using TailwindCSS for styling and integrating with Supabase as its backend (database and authentication) service. There’s also a Node.js/Vite component mentioned for back-end development and API integration, as well as an external AI integration (MistralAI) for possible future enhancements.

##### Analyzing the File Structure
- Key Directories:
- The “public” directory and “index.html” are entry points for serving the front-end assets.
- The “src” folder is where most of the application lives. It holds:
∙ “pages” under src/components/pages – providing different views like Home, Groups, Profile, Help, etc.
∙ “features” inside src/components/features – encapsulating modules such as login, hero (landing page visuals), banners, navigation, etc.
∙ “api” and “utils” folders – which include integration modules for Supabase (the backend) and general utility functions.
∙ “assets” for static images, fonts, and media.
∙ “locales” for internationalization, indicating multi-language support.
- Configuration files (e.g., vite.config.ts, tsconfig.*, package.json, etc.) indicate that the project uses modern tooling with Vite and TypeScript.
- Architectural Implications:
- The clear separation of pages and components hints at component-based design (typical in React).
- The presence of “api/supabase.tsx” suggests that the app directly communicates with Supabase for operations like data fetching, user authentication, etc.
- The layout and naming of features (discovery, groups, login, mode, etc.) indicate a modular design aimed at separating concerns and reusing UI pieces.

- Main Components to Include:
- Front-end Client:
∙ Browser-based client rendering the React application: This includes the overall UI (navigation, pages, components) as structured in the “src” folder.
- API Layer / External Services:
∙ Node.js/Vite Build Process: Indicate that development and bundling of the application is handled through Vite, with Node.js running scripts and serving build assets.
- Supporting Services:
∙ AI Service: MistralAI (if applicable) – indicate its role as an external AI component that could provide additional features such as content suggestions or moderation.
- Third-party Hosting/Deployment:
∙ Vercel: Highlight that the front-end is hosted on Vercel, providing continuous deployment and global CDN functionality.
- Relationships/Interactions:
- The React front-end sends API calls (via modules in “src/api”) to Supabase.
- User interactions (such as signing in, posting, or joining groups) are managed by designated components (like login, profile, and navbar).
- Assets (images, fonts) and multi-language resources are loaded as part of the UI rendering.
- The build/development process (managed by Vite and Node.js) compiles the React/TypeScript code into static assets served by Vercel.

##### Architectural Patterns and Principles
- Modular Component-based Architecture:
- Separation of concerns with small, reusable components (e.g., navigation, hero section, login components).
- Clear Separation of Front-end and Back-end:
- Even though much of the logic resides on the client side, external service calls to Supabase clearly delineate database operations.
- Internationalization:
- The locales directories indicate proper support for multi-language content.
- Modern Tooling and Configuration:

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client Layer
    subgraph "Client Layer"
        FE["React Front-End (UI Components)"]:::frontend
        PV["Page Views (Various sections)"]:::frontend
        FM["Feature Modules (Login, Hero, etc.)"]:::frontend
        SA["Static Assets (Images, Fonts, Media)"]:::frontend
        IT["Internationalization (Locales)"]:::frontend
    end

    %% API & External Services
    subgraph "API & External Services"
        API["API Integration with Supabase"]:::api
        SUP["Supabase (Database & Auth)"]:::external
        AI["External AI Service (MistralAI)"]:::external
    end

    %% Build & Deployment Layer
    subgraph "Build & Deployment"
        Vite["Vite Build Process (Node.js)"]:::tooling
        Vercel["Vercel Hosting"]:::external
        ViteConfig["vite.config.ts"]:::tooling
        TSConfig["tsconfig.json"]:::tooling
        Package["package.json"]:::tooling
    end

    %% Connections within Client Layer
    FE -->|"contains"| PV
    FE -->|"contains"| FM
    FE -->|"loads"| SA
    FE -->|"loads"| IT

    %% Client to API interaction
    FE -->|"APIcalls"| API
    API -->|"CRUD_ops"| SUP
    API -->|"optionalAI"| AI

    %% Build Process connections
    ViteConfig -->|"configures"| Vite
    TSConfig -->|"configures"| Vite
    Package -->|"configures"| Vite
    Vite -->|"bundles"| FE
    Vite -->|"deploys_to"| Vercel

    %% Click Events
    click FE "https://github.com/mpcgt/saguenay/tree/main/src/components"
    click PV "https://github.com/mpcgt/saguenay/tree/main/src/components/pages"
    click FM "https://github.com/mpcgt/saguenay/tree/main/src/components/features"
    click API "https://github.com/mpcgt/saguenay/blob/main/src/api/supabase.tsx"
    click SA "https://github.com/mpcgt/saguenay/tree/main/src/assets"
    click IT "https://github.com/mpcgt/saguenay/tree/main/src/locales"
    click ViteConfig "https://github.com/mpcgt/saguenay/blob/main/vite.config.ts"
    click TSConfig "https://github.com/mpcgt/saguenay/blob/main/tsconfig.json"
    click Package "https://github.com/mpcgt/saguenay/blob/main/package.json"

    %% Styles
    classDef frontend fill:#AED6F1,stroke:#1B4F72,stroke-width:2px;
    classDef api fill:#A9DFBF,stroke:#145A32,stroke-width:2px;
    classDef external fill:#F9E79F,stroke:#B7950B,stroke-width:2px;
    classDef tooling fill:#F5CBA7,stroke:#AF601A,stroke-width:2px;
```
