# shalvirajpura2/sahyogi architecture

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

- Interactive diagram: https://gitdiagram.com/shalvirajpura2/sahyogi
- Repository: https://github.com/shalvirajpura2/sahyogi

## Overview

##### Project Type and Purpose
- This is a full-stack Django web application (“Sahyogi”) that connects volunteers, recruiters, and administrators in a social-impact platform.
- Backend: Django 4.2 (MTV pattern), SQLite3 database, Django’s authentication system.

##### File Structure
- Top level:
- manage.py (Django CLI entry point)
- volunteer_system/ (project settings, URLs, WSGI)
- accounts/ (Django app containing models, views, forms, migrations, admin)
- templates/ (HTML templates partitioned by role: admin, recruiter, volunteer, registration, plus base.html and shared layouts)
- Database schema evolves via accounts/migrations.
- URL routing: volunteer_system/urls.py delegates to accounts.views and built-in auth.

##### Extract Insights from README
- Three distinct user roles with role-specific dashboards and UIs.
- Core features: event creation & management, volunteer application workflows, impact tracking, community governance.
- Emphasis on MVC-like separation (models, templates, views/forms).

a. Main Components
1. Client Browser (Volunteer, Recruiter, Admin interfaces)
2. Web Server / WSGI Layer (Gunicorn or built-in dev server)
3. Django Application
- Presentation Layer: Templates + Bootstrap UI
- Logic Layer: accounts.views, forms, admin site
- Data Layer: accounts.models + Django ORM
4. SQLite Database
5. External Services (None in core; optionally SMTP for email, third-party analytics)
b. Relationships & Data Flow
- Browser ↔ HTTP requests/responses → Web Server ↔ WSGI → Django URL Router → View Functions
- Views ↔ ORM → SQLite
- Views → Render Templates → Browser
- Authentication subsystem intercepts login/signup routes
c. Architectural Patterns & Principles
- MTV (Model–Template–View) architecture
- Role-based access control (Volunteer/Recruiter/Admin) enforced via Django’s auth and view decorators
- Separation of concerns: accounts app handles all business logic, templates handle presentation
d. Key Technologies & Frameworks
- Django 4.2 (MTV, ORM, Authentication, Admin)
- Bootstrap 5 + HTML5/CSS3 (Responsive UI)
- SQLite3 (lightweight relational DB)

- Break the system into client, server, and data tiers.
- Drill into the server tier: show URL routing → views/forms → models → migrations → admin.
- Role-based modules and templates.
- Frameworks (Django, Bootstrap, ORM).

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Client Tier"
        Browser["Client Browser"]:::frontend
    end

    Browser -->|HTTP Request| WebServer["Web Server / WSGI Layer"]:::backend
    click WebServer "https://github.com/shalvirajpura2/sahyogi/blob/main/./volunteer_system/wsgi.py"

    subgraph "Application Tier (Django Application)"
        Settings["Project Settings"]:::backend
        click Settings "https://github.com/shalvirajpura2/sahyogi/blob/main/./volunteer_system/settings.py"

        URLDispatcher["URL Dispatcher"]:::backend
        click URLDispatcher "https://github.com/shalvirajpura2/sahyogi/blob/main/./volunteer_system/urls.py"

        Auth["Authentication Subsystem"]:::backend

        Views["accounts.views"]:::backend
        click Views "https://github.com/shalvirajpura2/sahyogi/blob/main/./accounts/views.py"

        Forms["accounts.forms"]:::backend
        click Forms "https://github.com/shalvirajpura2/sahyogi/blob/main/./accounts/forms.py"

        Models["accounts.models"]:::backend
        click Models "https://github.com/shalvirajpura2/sahyogi/blob/main/./accounts/models.py"

        Admin["Admin Interface"]:::backend
        click Admin "https://github.com/shalvirajpura2/sahyogi/blob/main/./accounts/admin.py"

        Migrations["Database Migrations"]:::backend
        click Migrations "https://github.com/shalvirajpura2/sahyogi/tree/main/./accounts/migrations/"

        Templates["Template Engine"]:::frontend
        subgraph "Templates"
            Base["Base & Shared Templates"]:::frontend
            click Base "https://github.com/shalvirajpura2/sahyogi/blob/main/./templates/base.html"
            click Base "https://github.com/shalvirajpura2/sahyogi/blob/main/./templates/home.html"
            click Base "https://github.com/shalvirajpura2/sahyogi/blob/main/./templates/403.html"
            click Base "https://github.com/shalvirajpura2/sahyogi/blob/main/./templates/accounts/dashboard.html"

            subgraph "Volunteer Templates"
                V1["opportunities.html"]:::frontend
                click V1 "https://github.com/shalvirajpura2/sahyogi/blob/main/./templates/volunteer/opportunities.html"
            end

            subgraph "Recruiter Templates"
                R1["create_event.html"]:::frontend
                click R1 "https://github.com/shalvirajpura2/sahyogi/blob/main/./templates/recruiter/create_event.html"
                R2["manage_events.html"]:::frontend
                click R2 "https://github.com/shalvirajpura2/sahyogi/blob/main/./templates/recruiter/manage_events.html"
                R3["event_applications.html"]:::frontend
                click R3 "https://github.com/shalvirajpura2/sahyogi/blob/main/./templates/recruiter/event_applications.html"
            end

            subgraph "Admin Templates"
                A1["dashboard.html"]:::frontend
                click A1 "https://github.com/shalvirajpura2/sahyogi/blob/main/./templates/admin/dashboard.html"
                A2["user_management.html"]:::frontend
                click A2 "https://github.com/shalvirajpura2/sahyogi/blob/main/./templates/admin/user_management.html"
            end

            subgraph "Auth Templates"
                AU1["signup.html"]:::frontend
                click AU1 "https://github.com/shalvirajpura2/sahyogi/blob/main/./templates/registration/signup.html"
                AU2["login.html"]:::frontend
                click AU2 "https://github.com/shalvirajpura2/sahyogi/blob/main/./templates/registration/login.html"
            end
        end
    end

    subgraph "Data Tier"
        DB["SQLite Database"]:::db
    end

    subgraph "External Services"
        SMTP["SMTP Email Service"]:::external
    end

    WebServer --> Settings
    WebServer --> URLDispatcher
    URLDispatcher --> Auth
    URLDispatcher --> Views

    Views -->|uses Forms| Forms
    Views -->|queries ORM| Models
    Views -->|renders via| Templates

    Admin -->|manages via| Templates
    Models -->|migrations| Migrations
    Models -->|reads/writes| DB

    Templates -->|HTML Response| Browser
    Auth -->|sends email| SMTP

    classDef frontend fill:#9f6,stroke:#333,stroke-width:1px
    classDef backend fill:#6cf,stroke:#333,stroke-width:1px
    classDef db fill:#f96,stroke:#333,stroke-width:1px
    classDef external fill:#ccc,stroke:#333,stroke-width:1px
```
