# siddharthjiyani/budget_management_system_odoo architecture

> Architecture diagram of the GitHub repository siddharthjiyani/budget_management_system_odoo, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-02-11). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/siddharthjiyani/budget_management_system_odoo
- Repository: https://github.com/siddharthjiyani/budget_management_system_odoo

## Overview

##### Project Type and Purpose
- This is a full-stack web application (“client” + “server” directories).
- Purpose: Manage master data (products, budgets, contacts, tags, categories), handle purchase orders, sales orders, invoices, payments (via Razorpay), file uploads (to Cloudinary), email notifications, and a customer portal. It also includes AI-driven recommendations.

##### File Structure
- Top level:
- client/ – React + Vite + Tailwind front end
- server/ – Node.js + Express REST API + MongoDB (implied by Mongoose models)
- client/src:
- components, pages, services, context → UI layer, state management, API calls
- server/:
- config/ – database, passport (authentication), Cloudinary, API settings
- controllers/ – request handling (MVC controller layer)
- routes/ – Express routing (REST endpoints)
- models/ – Mongoose schemas (data layer)
- services/ – business logic (AI recommendations, historical data, auto-analytical computations)
- middleware/ – authentication guard
- utils/ – file uploading, email sending
- scripts/ – seeding and testing
- External integrations:
- Razorpay (payment gateway)
- Cloudinary (file storage)
- Email service (SMTP or transactional via mailSender)

##### Extract Insights from README
- (Not provided; inferred from file tree.)

##### Main Components & Interactions
a. Components:
1. Browser / Client UI (React SPA)
2. API Gateway (Express server)
3. Authentication Service (Passport + JWT)
4. Business Services (AI Recommendation, AutoAnalytical, Historical Data)
5. Data Persistence (MongoDB collections via Mongoose)
6. External Services:
– Razorpay (Payment)
– Cloudinary (File Uploads)
– Email SMTP service (Verification, Password Reset)
b. Relationships & Data Flows:
– User interacts with React UI → calls REST endpoints in Express.
– Express middleware authenticates → controllers invoke service layer → models read/write MongoDB.
– File uploads → forwarded to Cloudinary via server/utils/imageUploader → returns URL.
– Payments → React triggers Razorpay widget → server/payment route confirms transaction.
– Emails → server/utils/mailSender dispatches via SMTP (emailVerificationTemplate, forgotPasswordTemplate).
– AI service → controller invokes AIRecommendationService → may read historical data, seed data, respond to front end.
c. Architectural Patterns & Principles:
– Layered (Presentation, Controller, Service, Data)
– MVC-inspired with clear separation of concerns
– RESTful APIs
– Context/Hook pattern in React for global auth/theme state
– Seed scripts for test data and AI training
d. Key Technologies & Frameworks:
– Front-end: React, Vite, Tailwind, React Router, Context API, Razorpay SDK
– Back-end: Node.js, Express, Mongoose, Passport.js, Cloudinary SDK, Nodemailer (or similar)

##### Capturing Essential Architectural Elements
- Authentication flow: Login/Signup → Passport → JWT issuance → Protected routes
- Customer Portal as a sub-module of the Frontend, calling restricted “/portal” endpoints
- Master Data management flows separately from Purchase/Sales/Invoice flows for clarity

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Layer
    subgraph "Frontend Layer"
        direction TB
        UI["React SPA"]:::frontend
        RazorComp["RazorpayPayment.jsx"]:::frontend
        RazorHook["useRazorpayPayment.js"]:::frontend
        FileUploadFE["FileUpload.jsx"]:::frontend
        UI -->|"uses"| RazorComp
        RazorComp -->|"hook"| RazorHook
        UI -->|"uploads"| FileUploadFE
        UI -->|"calls API"| API
    end

    %% Backend Service
    subgraph "Backend Service"
        direction TB
        API["Express API Gateway"]:::backend

        %% Authentication
        AuthRT["User Routes"]:::service
        AuthCT["Auth Controller"]:::service
        AuthMW["Auth Middleware"]:::service
        AuthPC["Passport Config"]:::service

        API -->|"routes to"| AuthRT
        AuthRT -->|"invokes"| AuthCT
        AuthRT -->|"uses"| AuthMW
        AuthCT -->|"config via"| AuthPC

        %% Business Services
        BS["Business Services"]:::service

        API -->|"calls"| BS

        %% AI Recommendation
        AI["AI Recommendation Service"]:::service
        BS --> AI

        %% Auto Analytical
        AA_R["AutoAnalytical Routes"]:::service
        AA_C["AutoAnalytical Controller"]:::service
        AA_S["AutoAnalytical Service"]:::service
        BS --> AA_R
        AA_R --> AA_C
        AA_C --> AA_S

        %% Historical Data
        HD["Historical Data Service"]:::service
        BS --> HD

        %% Payment
        PayRT["Payment Routes"]:::service
        PayCT["Payment Controller"]:::service
        API -->|"payment endpoint"| PayRT
        PayRT --> PayCT

        %% File Upload
        FU_RT["FileUpload Routes"]:::service
        FU_CT["FileUpload Controller"]:::service
        FU_UTIL["Image Uploader"]:::service
        API -->|"file upload endpoint"| FU_RT
        FU_RT --> FU_CT
        FU_CT --> FU_UTIL

        %% Email Notifications
        EM_UTIL["Mail Sender"]:::service
        EM_T1["EmailVerificationTemplate"]:::service
        EM_T2["ForgotPasswordTemplate"]:::service
        API -->|"sends email via"| EM_UTIL
        EM_UTIL --> EM_T1
        EM_UTIL --> EM_T2

        %% Data Persistence
        DB["MongoDB Models"]:::db
        API -->|"reads/writes"| DB
    end

    %% External Integrations
    subgraph "External Integrations"
        direction TB
        PAY["Razorpay"]:::external
        CLOUD["Cloudinary"]:::external
        SMTP["Email Service (SMTP)"]:::external

        PayCT -->|"verifies"| PAY
        FU_UTIL -->|"uploads to"| CLOUD
        EM_UTIL -->|"dispatches via"| SMTP
    end

    %% Click Events
    click UI "https://github.com/siddharthjiyani/budget_management_system_odoo/tree/main/client/src"
    click API "https://github.com/siddharthjiyani/budget_management_system_odoo/blob/main/server/index.js"
    click AuthPC "https://github.com/siddharthjiyani/budget_management_system_odoo/blob/main/server/config/passport.js"
    click AuthMW "https://github.com/siddharthjiyani/budget_management_system_odoo/blob/main/server/middleware/auth.js"
    click AuthCT "https://github.com/siddharthjiyani/budget_management_system_odoo/blob/main/server/controllers/Auth.js"
    click AuthRT "https://github.com/siddharthjiyani/budget_management_system_odoo/blob/main/server/routes/user.js"
    click AI "https://github.com/siddharthjiyani/budget_management_system_odoo/blob/main/server/services/AIRecommendationService.js"
    click AA_S "https://github.com/siddharthjiyani/budget_management_system_odoo/blob/main/server/services/AutoAnalyticalService.js"
    click AA_C "https://github.com/siddharthjiyani/budget_management_system_odoo/blob/main/server/controllers/AutoAnalyticalModel.js"
    click AA_R "https://github.com/siddharthjiyani/budget_management_system_odoo/blob/main/server/routes/autoAnalyticalModel.js"
    click HD "https://github.com/siddharthjiyani/budget_management_system_odoo/blob/main/server/services/HistoricalDataService.js"
    click DB "https://github.com/siddharthjiyani/budget_management_system_odoo/blob/main/server/models/*.js"
    click RazorComp "https://github.com/siddharthjiyani/budget_management_system_odoo/blob/main/client/src/components/RazorpayPayment.jsx"
    click RazorHook "https://github.com/siddharthjiyani/budget_management_system_odoo/blob/main/client/src/hooks/useRazorpayPayment.js"
    click PayCT "https://github.com/siddharthjiyani/budget_management_system_odoo/blob/main/server/controllers/Payment.js"
    click PayRT "https://github.com/siddharthjiyani/budget_management_system_odoo/blob/main/server/routes/payment.js"
    click FU_CT "https://github.com/siddharthjiyani/budget_management_system_odoo/blob/main/server/controllers/FileUpload.js"
    click FU_RT "https://github.com/siddharthjiyani/budget_management_system_odoo/blob/main/server/routes/fileUpload.js"
    click FU_UTIL "https://github.com/siddharthjiyani/budget_management_system_odoo/blob/main/server/utils/imageUploader.js"
    click FileUploadFE "https://github.com/siddharthjiyani/budget_management_system_odoo/blob/main/client/src/components/FileUpload.jsx"
    click EM_UTIL "https://github.com/siddharthjiyani/budget_management_system_odoo/blob/main/server/utils/mailSender.js"
    click EM_T1 "https://github.com/siddharthjiyani/budget_management_system_odoo/blob/main/server/mail/templates/emailVerificationTemplate.js"
    click EM_T2 "https://github.com/siddharthjiyani/budget_management_system_odoo/blob/main/server/mail/templates/forgotPasswordTemplate.js"

    %% Styles
    classDef frontend fill:#D6E9FF,stroke:#3B7DD8,color:#0B2F52
    classDef backend fill:#E3F9E5,stroke:#34A853,color:#0B3D1D
    classDef service fill:#FFF4E5,stroke:#FB8C00,color:#663C00
    classDef db fill:#FFE5B4,stroke:#FF8C00,color:#663C00
    classDef external fill:#F3E5F5,stroke:#9C27B0,color:#4A0072
```
