# srish-ty/project-dates architecture

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

- Interactive diagram: https://gitdiagram.com/srish-ty/project-dates
- Repository: https://github.com/srish-ty/project-dates

## Overview

##### Project Overview and Purpose
- Recognize that this repository is the backend API for a campus guide application (Project Dates) designed by DSC NIT Rourkela.
- The backend focuses on managing users, events, team details, and other campus-related functionalities while interacting with a mobile application (Avenue).

##### Main Components
- API Interface Layers:
- GraphQL/API (Apollo): Under the api/src/apollo folder, you have resolvers, queries, mutations, and type definitions for various domains such as DeveloperInfo, Event, Institute, Location, Org, etc.
- REST API: Under the api/src/rest folder, you have controllers, routes, and models handling REST endpoints (like auth controllers, payment integrations with Instamojo, health checks, etc.).
- Configuration and Infrastructure:
- Configuration modules in api/src/config for integrating with services like Firebase, Mongoose (MongoDB connection), Nexus setup for GraphQL schema, and winston for logging.
- Environment configuration (using .env files and constants under api/src/constants).
- Database and Persistence:
- Mongoose configuration files indicate the use of MongoDB.
- There is also a prisma schema (though its role might be supplementary) representing data modeling.
- Helpers, Utilities, and Error Handling:
- Helpers in api/src/helpers manage authentication (permission checks, verification), and there are modules for custom error handling.
- Containerization & CI/CD:
- Dockerfile and docker-compose configuration are present, indicating deployment via containerized environments.
- Reference to GitHub workflows (build, deploy, lint) shows continuous integration efforts.
- External Services:
- Integration with third-party services like Instamojo for payment processing (from the instamojo controller in the REST APIs).
- Firebase configuration likely supports parts of the auth or push notifications.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% External CI/CD
    CI_CD["GitHub Workflows"]:::ci

    %% External Services
    Instamojo["Instamojo Integration"]:::external
    Firebase["Firebase Integration"]:::external

    %% API Server Container
    subgraph "API Server (Dockerized)"
        A_Gateway["API Gateway"]:::front
        GraphQL["GraphQL API (Apollo)"]:::api
        REST["REST API Controllers"]:::api

        subgraph "Shared Services"
            Config["Configuration & Infrastructure"]:::config
            Env["Environment & Constants"]:::config
            Helpers["Helpers & Utilities"]:::config
        end

        subgraph "Database"
            Mongoose["MongoDB (Mongoose Config)"]:::db
            Prisma["Prisma Schema"]:::db
        end

        Dockerfile["Dockerfile (Containerization)"]:::container
    end

    %% CI/CD builds the Docker container
    CI_CD -->|"builds"| Dockerfile
    Dockerfile -->|"deploys"| A_Gateway

    %% API Gateway distributes requests to API layers
    A_Gateway -->|"routes"| GraphQL
    A_Gateway -->|"routes"| REST

    %% Both API layers use shared configuration
    GraphQL -->|"uses"| Config
    REST -->|"uses"| Config
    Config -->|"defines"| Env
    Config -->|"assists"| Helpers

    %% Both API layers interact with Database
    GraphQL -->|"reads/writes"| Mongoose
    GraphQL -->|"reads/writes"| Prisma
    REST -->|"reads/writes"| Mongoose
    REST -->|"reads/writes"| Prisma

    %% REST layer integrates with external payment service
    REST -->|"integrates"| Instamojo

    %% Shared configuration integrates with external service (Firebase)
    Config -->|"integrates"| Firebase

    %% Click Events
    click GraphQL "https://github.com/srish-ty/project-dates/tree/main/api/src/apollo"
    click REST "https://github.com/srish-ty/project-dates/tree/main/api/src/rest"
    click Config "https://github.com/srish-ty/project-dates/tree/main/api/src/config"
    click Env "https://github.com/srish-ty/project-dates/tree/main/api/src/constants"
    click Helpers "https://github.com/srish-ty/project-dates/tree/main/api/src/helpers"
    click Mongoose "https://github.com/srish-ty/project-dates/blob/main/api/src/config/mongoose.ts"
    click Prisma "https://github.com/srish-ty/project-dates/blob/main/api/src/prisma/schema.prisma"
    click Instamojo "https://github.com/srish-ty/project-dates/tree/main/api/src/rest/controller/instamojo"
    click Firebase "https://github.com/srish-ty/project-dates/blob/main/api/src/config/firebase.ts"
    click Dockerfile "https://github.com/srish-ty/project-dates/tree/main/api/Dockerfile"
    click CI_CD "https://github.com/srish-ty/project-dates/tree/main/.github/workflows"

    %% Styles
    classDef front fill:#a2d2ff,stroke:#084c61,stroke-width:2px;
    classDef api fill:#cdb4db,stroke:#6c757d,stroke-width:2px;
    classDef config fill:#ffdfba,stroke:#d471a5,stroke-width:2px;
    classDef db fill:#ffadad,stroke:#d00000,stroke-width:2px;
    classDef external fill:#fdffb6,stroke:#ff8c00,stroke-width:2px;
    classDef container fill:#d0f0c0,stroke:#008080,stroke-width:2px;
    classDef ci fill:#ffb6c1,stroke:#d10000,stroke-width:2px;
```
