# notshrirang/m2connex architecture

> Architecture diagram of the GitHub repository notshrirang/m2connex, 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/notshrirang/m2connex
- Repository: https://github.com/notshrirang/m2connex

## Overview

##### Project Overview and Core Architecture
- The M2ConneX project is a Django-powered backend designed to connect MMCOE alumni. It forms the backend for the alumni portal and exposes RESTful APIs for the frontend (hosted separately).
- The project is containerized via Docker and uses PostgreSQL as the database. It also integrates asynchronous processing (Celery) and leverages various external services (for emails, notifications, file storage, etc.) through utility modules.
- API Gateway/Endpoints (handled by Django views and URL configurations)
- Core project configuration and orchestration (alumniportal folder: settings, URLs, and celery configuration)
- A set of Django apps/modules (each one representing a specific feature area, described below)
- External services such as the database (PostgreSQL), email service, AWS S3, and potentially notification services.
- Container orchestration via Docker (Dockerfile and docker-compose)

##### Examining the File Structure and Main Components
- Top-Level Project Components:
- CODE: A utility module containing helper functions (for sending emails, notifications, NSFW filtering, handling One Time Passwords, recommendations, S3 integration, etc.).
- alumniportal: Contains project-level configurations, including settings, URL routing, and asynchronous task configuration with celery (alumniportal/celery.py).
- Multiple Django apps provide domain-specific functionality. They generally include subfolders for models, serializers, views, tests, and migrations.
- Docker and deployment files (Dockerfile, docker-compose-dev.yml, run.sh) to containerize and run the backend.

##### Short Explanations for Each Module
- CODE:
- Acts as a collection of utility functions and helper routines used across the project.
- Includes support for emails, notifications, NSFW processing, integration with AWS S3, generation and handling of OTPs, interfacing with a relational database service (RDS), and generating recommendations.

- alumniportal:
- Serves as the main Django project configuration module.
- Contains key settings, URL configurations, entry points (asgi.py, wsgi.py), and Celery task configurations.

- analytics:
- Manages analytics-related logic.
- Provides models and serializers to record and process user activities and interactions.

- blog:
- Handles blogging functionality for alumni to post articles or updates.
- Contains models, views, and serializers to manage blog posts, as well as admin configurations.

- club:
- Facilitates the creation and management of alumni clubs or groups.
- Contains models and filters to manage club membership, club information, and related admin functionalities.

- connection:
- Manages the social networking element by handling friendship or connection requests between alumni.
- Provides APIs (through views/serializers) and models to maintain these relationships.

- csc:
- Likely designed for managing geographic or related standardized data (e.g., country, state, city) given the migration files altering country names.
- Supports location or regional data that might assist in grouping or filtering alumni.

- donation:
- Enables alumni to make or manage donations.
- Includes models and endpoints to track donation transactions and related data.

- event:
- Provides event management functionality allowing alumni to create, join, and manage events like reunions, workshops, or networking sessions.
- Contains filters to customize event queries and manage event lifecycle.

- experience:
- Captures verifiable alumni experiences such as work history, projects, or expertise.
- Offers data structures and APIs to manage experience data and updates.

- feed:
- Manages the social media feed where alumni can post updates.
- Handles feed actions including posting, commenting, and sharing content.

- notification:
- Manages notifications sent to the alumni, such as alerts for connections, events, or other social updates.
- Integrates with the utility functions in the CODE module for dispatching messages.

- opportunity:
- Focused on job opportunities and professional enhancements.
- Contains capabilities to list, update, and archive career-related posts or opportunities related to the alumni network.

- otp:
- Manages the generation, validation, and lifecycle of one-time passwords used for authentication or sensitive operations.
- Ensures secure login and verification processes.

- skill:
- Allows alumni to share and manage their skills.
- Provides endpoints to list, modify, and validate skill-related data, and to match skills with opportunities.

- users:
- Handles user account management, profiles, and permissions.
- Includes detailed migrations to manage changes in user attributes (like bios, privileges, profile pictures, verification flags).

##### Relationships and Interactions
- Each module (Django app) exposes its endpoints through the overall URL routing (typically included in alumniportal/urls.py and further delegated to each app’s urls.py).
- The CODE module is imported by many apps to handle cross-cutting concerns.
- The alumniportal module acts as the orchestrator by maintaining the main settings and routing for the apps.
- Many modules interact with the database through Django ORM models, and serializers mediate data to/from client requests.
- Celery (configured in alumniportal/celery.py) manages background jobs such as sending emails and notifications.
- Docker/Docker Compose is used to containerize the entire backend for development and production purposes.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Level 1: Client
    Client("Frontend (Client Application)"):::client

    %% Level 2: API Gateway/Endpoints
    API("API Gateway/Endpoints"):::coretext

    %% Level 3: Core Project Configuration
    Project("alumniportal (Django Project)"):::coretext
    Celery("Celery (Asynchronous Task Manager)"):::coretext

    %% Level 4: Django Apps Subgraph
    subgraph "Django Apps"
        Analytics("analytics: Tracks user activities and analytics"):::apptext
        Blog("blog: Manages blog posts and articles"):::apptext
        Club("club: Handles alumni clubs and memberships"):::apptext
        Connection("connection: Manages alumni connections and friendships"):::apptext
        CSC("csc: Manages geographic and regional data"):::apptext
        Donation("donation: Handles donation transactions"):::apptext
        Event("event: Manages event creation and participation"):::apptext
        Experience("experience: Captures professional experiences"):::apptext
        Feed("feed: Maintains the social media feed"):::apptext
        Notification("notification: Dispatches notifications and alerts"):::apptext
        Opportunity("opportunity: Lists and manages job opportunities"):::apptext
        OTP("otp: Generates and verifies one-time passwords"):::apptext
        Skill("skill: Manages alumni skills and matching"):::apptext
        Users("users: Handles user accounts and profiles"):::apptext
    end

    %% Level 5: Shared Utilities
    Utilities("CODE (Shared Utilities)"):::utiltext

    %% Level 6: External Services
    DB["PostgreSQL Database"]:::external
    Email("Email Service"):::external
    S3("AWS S3 Storage"):::external
    ExternalAPI("External API Services"):::external

    %% Level 7: Deployment Files Subgraph
    subgraph Deployment
        Dockerfile("Dockerfile"):::deployment
        DockerCompose("docker-compose-dev.yml"):::deployment
        RunScript("run.sh"):::deployment
    end

    %% Connections (Vertical Layout)
    Client -->|"REST_API"| API
    API -->|"routes_to"| Project
    Project -->|"configures"| Celery

    %% Project routes to each Django App
    Project --> Analytics
    Project --> Blog
    Project --> Club
    Project --> Connection
    Project --> CSC
    Project --> Donation
    Project --> Event
    Project --> Experience
    Project --> Feed
    Project --> Notification
    Project --> Opportunity
    Project --> OTP
    Project --> Skill
    Project --> Users

    %% Each Django App uses Shared Utilities
    Analytics -->|"uses"| Utilities
    Blog -->|"uses"| Utilities
    Club -->|"uses"| Utilities
    Connection -->|"uses"| Utilities
    CSC -->|"uses"| Utilities
    Donation -->|"uses"| Utilities
    Event -->|"uses"| Utilities
    Experience -->|"uses"| Utilities
    Feed -->|"uses"| Utilities
    Notification -->|"uses"| Utilities
    Opportunity -->|"uses"| Utilities
    OTP -->|"uses"| Utilities
    Skill -->|"uses"| Utilities
    Users -->|"uses"| Utilities

    %% Project interacts with external services
    Project -->|"DB_access"| DB
    Project -->|"sends_mail"| Email
    Project -->|"stores_files"| S3
    Project -->|"calls"| ExternalAPI

    %% Deployment files containerize the project
    Dockerfile -->|"builds"| Project
    DockerCompose -->|"orchestrates"| Project
    RunScript -->|"starts"| Project

    %% Click Events
    click API "https://github.com/notshrirang/m2connex/blob/main/alumniportal/urls.py"
    click Project "https://github.com/notshrirang/m2connex/tree/main/alumniportal/"
    click Celery "https://github.com/notshrirang/m2connex/blob/main/alumniportal/celery.py"
    click Utilities "https://github.com/notshrirang/m2connex/tree/main/CODE"
    
    click Analytics "https://github.com/notshrirang/m2connex/tree/main/analytics/"
    click Blog "https://github.com/notshrirang/m2connex/tree/main/blog/"
    click Club "https://github.com/notshrirang/m2connex/tree/main/club/"
    click Connection "https://github.com/notshrirang/m2connex/tree/main/connection/"
    click CSC "https://github.com/notshrirang/m2connex/tree/main/csc/"
    click Donation "https://github.com/notshrirang/m2connex/tree/main/donation/"
    click Event "https://github.com/notshrirang/m2connex/tree/main/event/"
    click Experience "https://github.com/notshrirang/m2connex/tree/main/experience/"
    click Feed "https://github.com/notshrirang/m2connex/tree/main/feed/"
    click Notification "https://github.com/notshrirang/m2connex/tree/main/notification/"
    click Opportunity "https://github.com/notshrirang/m2connex/tree/main/opportunity/"
    click OTP "https://github.com/notshrirang/m2connex/tree/main/otp/"
    click Skill "https://github.com/notshrirang/m2connex/tree/main/skill/"
    click Users "https://github.com/notshrirang/m2connex/tree/main/users/"
    
    click Dockerfile "https://github.com/notshrirang/m2connex/tree/main/Dockerfile"
    click DockerCompose "https://github.com/notshrirang/m2connex/blob/main/docker-compose-dev.yml"
    click RunScript "https://github.com/notshrirang/m2connex/blob/main/run.sh"

    %% Styles
    classDef client fill:#f4c2c2,stroke:#333,stroke-width:2px;
    classDef coretext fill:#cce5ff,stroke:#004085,stroke-width:2px;
    classDef apptext fill:#d4edda,stroke:#155724,stroke-width:2px;
    classDef utiltext fill:#fff3cd,stroke:#856404,stroke-width:2px;
    classDef external fill:#d1ecf1,stroke:#0c5460,stroke-width:2px;
    classDef deployment fill:#f8d7da,stroke:#721c24,stroke-width:2px;
```
