# datdangiune/group-8-156730-itss architecture

> Architecture diagram of the GitHub repository datdangiune/group-8-156730-itss, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/datdangiune/group-8-156730-itss
- Repository: https://github.com/datdangiune/group-8-156730-itss

## Overview

##### Project Type & Purpose
- The project is a pet management system designed to support the management of tasks in a pet care center.
- It includes a backend API (built with Node.js, Express, Sequelize, and PostgreSQL) and three different frontends:
- “petpals-manager” – customer/user interface.
- “furry-admin-1” (referred in the README as “furry-system-manager”) – administrative management interface.
- “vetstaff-connect” – interface for veterinarians and support staff.
- The README clearly states the major components and the technology stack. This is a full-stack application with a separated backend API and multiple frontend applications connecting to the backend via RESTful endpoints.

##### Analyzing the File Structure
- The top-level file tree contains three major project folders (backend, petpals-manager, and vetstaff-connect) along with an additional “furry-admin-1” folder which represents the admin interface.
- In the backend folder:
- Components are organized into several subdirectories: controllers, models, routes, middleware, configuration, migrations, and utilities. This suggests a classical layered architecture using the MVC (Model-View-Controller) pattern, though obviously “Views” are not needed as this backend only serves APIs.
- Dedicated configuration files and migration scripts indicate database management and version control for schema changes.
- Each frontend folder (petpals-manager, furry-admin-1, vetstaff-connect) has a typical React structure with src, components, pages, hooks, and utility libraries. They use Tailwind CSS for styling and React Router for navigation.
- Notice that there are build/development configuration files like vite.config.ts, tsconfig, and package.json, which establish the development and build pipelines.

a. Main Components:
- Backend Server: Implements RESTful API endpoints, authentication (JWT), file uploads via Multer, image management via Cloudinary, and database management through Sequelize and PostgreSQL. Key modules: controllers, routes, models, and utilities.
- Frontend Clients:
- Customer Interface (“petpals-manager”): Handles customer interactions such as appointments, pet details, and user profile management.
- Administration Interface (“furry-admin-1”): Provides administrative tools and management dashboards.
- Vet & Staff Interface (“vetstaff-connect”): Offers modules for appointments, boarding, medical records, and service management tailored for clinic staff.
- Database: PostgreSQL serving as the central data repository, with Sequelize acting as the ORM.
- External Services:
- Cloudinary for image storage.
- Email services for notifications.
- JWT authentication for securing API endpoints.

b. Relationships and Interactions:
- That the Backend communicates with the PostgreSQL database.
- Integrations with external systems/services such as Cloudinary and Email providers.
- Inside the backend, you might break down components internally (e.g., client requests go through routing, are handled by controllers, interact with models, and data is stored/retrieved from the database).

c. Architectural Patterns & Design Principles:
- The backend follows an MVC-like separation of concerns.
- The services are decoupled: the frontend clients are separate projects that communicate through a unified API.
- Use of JWT for stateless authentication is a common security pattern.
- Modularity is evident based on separate folders for each major functional area (controllers, routes, models).
- On the frontend, component-based design in React is evident and routing is implemented via React Router.

d. Relevant Technologies:
- Backend: Node.js, Express, Sequelize, PostgreSQL, JWT, Multer, and Cloudinary.
- Frontend: React.js, React Router, Tailwind CSS, and Axios for API calls.
- Development tools: Vite, TypeScript (as evidenced by .ts and .tsx files), and ESLint.

##### Detailed Steps for the Principal Software Engineer
- Within the Frontends group, list out the three separate UI projects and highlight that they connect to the common backend API.
- Data flow:

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Frontend Clients"
        petpals["Customer Interface (petpals-manager)"]:::frontend
        furry["Administrative Interface (furry-admin-1)"]:::frontend
        vet["Vet & Staff Interface (vetstaff-connect)"]:::frontend
    end

    subgraph "Backend API Server"
        subgraph "Internal Components"
            routes["Routes"]:::backend
            middleware["Middleware (JWT)"]:::backend
            controllers["Controllers"]:::backend
            models["Models"]:::backend
            dbconn["Database Connection (Sequelize & PostgreSQL)"]:::backend
            util["Utility Functions (Email)"]:::backend
            upload["File Upload & Cloudinary"]:::backend
        end
    end

    db["PostgreSQL Database"]:::database
    cloud["Cloudinary Service"]:::external
    email["Email Service"]:::external

    %% Frontend to Backend interactions via REST API
    petpals -->|"REST_API"| routes
    furry -->|"REST_API"| routes
    vet -->|"REST_API"| routes

    %% Internal Backend Flow
    routes -->|"passThrough"| middleware
    middleware -->|"handleAuth"| controllers
    controllers -->|"invokeLogic"| models
    models -->|"dbInteraction"| dbconn
    dbconn -->|"connectsTo"| db

    %% External Services Integrations
    upload ---|"integrates"| cloud
    util ---|"triggers"| email

    %% Click Events for Backend Components
    click routes "https://github.com/datdangiune/group-8-156730-itss/tree/main/backend/src/routes"
    click controllers "https://github.com/datdangiune/group-8-156730-itss/tree/main/backend/src/controllers"
    click models "https://github.com/datdangiune/group-8-156730-itss/tree/main/backend/src/models"
    click middleware "https://github.com/datdangiune/group-8-156730-itss/tree/main/backend/src/middleware"
    click util "https://github.com/datdangiune/group-8-156730-itss/blob/main/backend/src/util/sendMail.js"
    click upload "https://github.com/datdangiune/group-8-156730-itss/blob/main/backend/src/config/uploadImage.js"
    click dbconn "https://github.com/datdangiune/group-8-156730-itss/blob/main/backend/src/database.js"

    %% Click Events for Frontend Projects
    click petpals "https://github.com/datdangiune/group-8-156730-itss/tree/main/petpals-manager"
    click furry "https://github.com/datdangiune/group-8-156730-itss/tree/main/furry-admin-1"
    click vet "https://github.com/datdangiune/group-8-156730-itss/tree/main/vetstaff-connect"

    %% Styles
    classDef frontend fill:#AED6F1,stroke:#1B4F72,stroke-width:2px;
    classDef backend fill:#F9E79F,stroke:#B7950B,stroke-width:2px;
    classDef database fill:#D5F5E3,stroke:#239B56,stroke-width:2px;
    classDef external fill:#F5CBA7,stroke:#CA6F1E,stroke-width:2px;
```
