# tarun0648/skill-buddy-backend-og architecture

> Architecture diagram of the GitHub repository tarun0648/skill-buddy-backend-og, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-07-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/tarun0648/skill-buddy-backend-og
- Repository: https://github.com/tarun0648/skill-buddy-backend-og

## Overview

##### Project Type and Purpose
- This is the backend API of a full-stack career-development platform (“Skill Buddy”), built with Flask.
- It supports user authentication (email/password, OTP, GitHub/LinkedIn SSO), resume parsing, profile/portfolio analysis, community features, task tracking, and an AI-powered interview system (role-based & JD-based).

##### File Structure Analysis
- app.py – application entry point, Flask app initialization and blueprint registration.
- config/ – environment and Firebase settings.
- routes/ – Flask blueprints grouped by feature (auth, user, resume, profile, portfolio, community, tasks, interview, JD interviews).
- services/ – business logic layer interfacing with OpenAI, Firebase, email, OTP, GitHub/LinkedIn analysis, resume extraction, interview flows, task management.
- models/ – domain models mapping to Firebase documents (user, resume, interview, community posts, tasks).
- data/ – static JSON files for pre-defined interview questions.
- utils/ – helper functions (authentication, validation, encryption, file I/O).
- uploads/ – file storage for user resumes and videos.
- logs/ – application log files.
- requirements.txt, Procfile, runtime.txt – deployment/build scripts and dependencies.

##### README Insights
- Confirms layered MVC-style architecture: Frontend ↔ Flask API ↔ Services ↔ Firebase.
- External integrations: OpenAI GPT, Twilio SMS, Firebase Auth/Firestore, OAuth providers.

##### Components
a. Client Layer
– Web/Mobile Frontend (React/Vue or any SPA)
– HTTP(S) or WebSocket calls to API
b. API Layer (Flask App)
– app.py: Blueprint registration (auth_routes, resume_routes, interview_routes, etc.)
– Request handling, input validation, error handling
c. Services Layer
– InterviewService & JdInterviewService (OpenAI GPT integration via assistant_client)
– ResumeProcessingService & ResumeExtractor
– ProfileAnalyzer & PortfolioAnalyzer (LinkedIn/GitHub analyzers)
– AuthService (email/password, OTPService, SSOService)
– EmailService, FirebaseService, TaskManager
d. Data Layer
– Firestore (Firebase) as primary document database
– Storage (Firebase Storage or local uploads directory) for resumes and video recordings
– Static data: interview_questions.json, jd-predefined.json
e. External Services
– OpenAI API (GPT question generation)
– Twilio/SMS provider (OTP)
– OAuth Providers (GitHub, LinkedIn)
– Email provider (SMTP/SendGrid)
f. Infrastructure
– Logging (logs/app.log)
– Deployment targets (Heroku, GCP App Engine, Docker, AWS Lambda)
– Background job execution (TaskManager scripts or scheduler)

##### Relationships & Data Flow
- Frontend sends HTTP requests → Flask API (app.py)
- Flask routes invoke Services → Services read/write to Firestore or file storage
- Interview flows call assistant_client → OpenAI → return questions to Services → API → Frontend
- OTPService ↔ Twilio SMS
- SSOService ↔ GitHub/LinkedIn OAuth endpoints
- All database operations via FirebaseService → Firestore
- TaskManager handles asynchronous tasks (migrations, background processing)

##### Architectural Patterns & Design Principles
- Modular monolith with clear layer separation: Controllers (routes) → Services → Data access
- Blueprint pattern in Flask for feature isolation
- Dependency injection via config/settings and environment variables
- Single responsibility: each service handles one domain
- External API wrappers (assistant_client, firebase_service) abstract third-party calls

##### Technology Stack Highlights
- Python 3.10+, Flask 2.3+
- Firestore (Firebase) for NoSQL data, Firebase Auth for user identity
- OpenAI GPT for AI interview features
- Twilio for SMS OTP
- GitHub and LinkedIn OAuth
- Local file storage for uploads (or Firebase Storage in production)
- Gunicorn or Docker for production hosting

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Client Layer
    subgraph "Client Layer"
        FE["Web/Mobile Frontend"]:::external
    end

    %% API Layer
    subgraph "API Layer"
        App["Flask App (app.py)"]:::internal
        subgraph "Controllers / Routes"
            AR["Auth Routes"]:::internal
            UR["User Routes"]:::internal
            RR["Resume Routes"]:::internal
            PR["Profile Analysis Routes"]:::internal
            POR["Portfolio Analysis Routes"]:::internal
            CR["Community Routes"]:::internal
            TR["Task Routes"]:::internal
            IR["Interview Routes"]:::internal
            JR["JD Interview Routes"]:::internal
            SR["Status Routes"]:::internal
        end
    end

    %% Services Layer
    subgraph "Services Layer"
        IS["Interview Service"]:::internal
        JS["JD Interview Service"]:::internal
        AC["Assistant Client"]:::internal
        RPS["Resume Processing Service"]:::internal
        RE["Resume Extractor"]:::internal
        RQ["Resume Questions"]:::internal
        RS["Resume Summarizer"]:::internal
        GA["GitHub Analyzer"]:::internal
        LA["LinkedIn Analyzer"]:::internal
        PA["Portfolio Analyzer"]:::internal
        OS["OTP Service"]:::internal
        SS["SSO Service"]:::internal
        ES["Email Service"]:::internal
        FS["Firebase Service"]:::internal
        TM["Task Manager"]:::internal
    end

    %% Data Layer
    subgraph "Data Layer"
        DB["Firestore (Firebase)"]:::data
        FSStorage["File Storage (uploads/)"]:::data
        IJ["Interview Questions JSON"]:::data
        DJ["JD Questions JSON"]:::data
    end

    %% External Services
    subgraph "External Services"
        OA["OpenAI API"]:::external
        TW["Twilio SMS"]:::external
        GH["GitHub OAuth"]:::external
        LI["LinkedIn OAuth"]:::external
        EP["Email Provider"]:::external
    end

    %% Infrastructure
    subgraph "Infrastructure"
        LOG["Logging (logs/app.log)"]:::internal
        PROC["Procfile"]:::internal
        RUNTIME["runtime.txt"]:::internal
        APPY["app.yaml"]:::internal
        REQ["requirements.txt"]:::internal
        POSTMAN["POSTMAN.md"]:::internal
    end

    %% Connections
    FE -->|HTTP/JSON| App
    App -->|invokes| AR
    App --> UR
    App --> RR
    App --> PR
    App --> POR
    App --> CR
    App --> TR
    App --> IR
    App --> JR
    App --> SR

    AR -->|calls| OS
    AR --> SS
    UR --> FS
    RR --> RPS
    RR --> RE
    RR --> RS
    PR --> GA
    PR --> FS
    POR --> LA
    POR --> PA
    CR --> FS
    TR --> TM
    IR --> IS
    IR --> AC
    JR --> JS
    JS --> AC

    IS --> OA
    OS --> TW
    SS --> GH
    SS --> LI
    ES --> EP
    FS --> DB
    RR --> FSStorage
    RPS --> IJ
    JS --> DJ

    TM --> LOG

    %% Click Events for Component Mapping
    click App "https://github.com/tarun0648/skill-buddy-backend-og/blob/interview_integrated/app.py"
    click AR "https://github.com/tarun0648/skill-buddy-backend-og/blob/interview_integrated/routes/auth_routes.py"
    click UR "https://github.com/tarun0648/skill-buddy-backend-og/blob/interview_integrated/routes/user_routes.py"
    click RR "https://github.com/tarun0648/skill-buddy-backend-og/blob/interview_integrated/routes/resume_routes.py"
    click PR "https://github.com/tarun0648/skill-buddy-backend-og/blob/interview_integrated/routes/profile_analysis_routes.py"
    click POR "https://github.com/tarun0648/skill-buddy-backend-og/blob/interview_integrated/routes/portfolio_analysis_routes.py"
    click CR "https://github.com/tarun0648/skill-buddy-backend-og/blob/interview_integrated/routes/community_routes.py"
    click TR "https://github.com/tarun0648/skill-buddy-backend-og/blob/interview_integrated/routes/task_routes.py"
    click IR "https://github.com/tarun0648/skill-buddy-backend-og/blob/interview_integrated/routes/interview_routes.py"
    click JR "https://github.com/tarun0648/skill-buddy-backend-og/blob/interview_integrated/routes/jd_interview_routes.py"
    click SR "https://github.com/tarun0648/skill-buddy-backend-og/blob/interview_integrated/routes/status_routes.py"
    click IS "https://github.com/tarun0648/skill-buddy-backend-og/blob/interview_integrated/services/interview_service.py"
    click JS "https://github.com/tarun0648/skill-buddy-backend-og/blob/interview_integrated/services/jd_interview_service.py"
    click AC "https://github.com/tarun0648/skill-buddy-backend-og/blob/interview_integrated/services/assistant_client.py"
    click RPS "https://github.com/tarun0648/skill-buddy-backend-og/blob/interview_integrated/services/resume_processing_service.py"
    click RE "https://github.com/tarun0648/skill-buddy-backend-og/blob/interview_integrated/services/resume_extractor_cl.py"
    click RQ "https://github.com/tarun0648/skill-buddy-backend-og/blob/interview_integrated/services/resume_questions.py"
    click RS "https://github.com/tarun0648/skill-buddy-backend-og/blob/interview_integrated/services/resume_summarizer.py"
    click GA "https://github.com/tarun0648/skill-buddy-backend-og/blob/interview_integrated/services/github_analyzer.py"
    click LA "https://github.com/tarun0648/skill-buddy-backend-og/blob/interview_integrated/services/linkedin_analyzer.py"
    click PA "https://github.com/tarun0648/skill-buddy-backend-og/blob/interview_integrated/services/portfolio_analyzer.py"
    click OS "https://github.com/tarun0648/skill-buddy-backend-og/blob/interview_integrated/services/otp_service.py"
    click SS "https://github.com/tarun0648/skill-buddy-backend-og/blob/interview_integrated/services/sso_service.py"
    click ES "https://github.com/tarun0648/skill-buddy-backend-og/blob/interview_integrated/services/email_service.py"
    click FS "https://github.com/tarun0648/skill-buddy-backend-og/blob/interview_integrated/services/firebase_service.py"
    click TM "https://github.com/tarun0648/skill-buddy-backend-og/blob/interview_integrated/services/task_manager.py"

    %% Styles
    classDef internal fill:#E3F2FD,stroke:#2196F3
    classDef data fill:#E8F5E9,stroke:#4CAF50
    classDef external fill:#FFF3E0,stroke:#FF9800
```
