# pramodpots/bulb architecture

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

- Interactive diagram: https://gitdiagram.com/pramodpots/bulb
- Repository: https://github.com/pramodpots/bulb

## Overview

##### Project type and purpose
- From the README (“Personal Portfolio(Resume) maker”) and the file tree (Express entrypoint `index.js`, Jade views, Mongoose-like schema files, `config/auth.js`/`passport.js`), we see this is a full-stack Node.js/Express application.
- Purpose: allow users to log in via Google OAuth, fill out a form with project details/photos, and instantly generate a personal portfolio site.

##### File structure
Top-level:
- `.env`, `.gitignore`, `Procfile` – configuration and Heroku deployment
- `index.js` – Express server bootstrap
- `package.json` – dependencies (Express, Passport, Mongoose, Jade, etc.)
- `config/` – auth and passport setup
- `bulbschema.js` & `userschema.js` – MongoDB models (Mongoose schemas)
- `public/` – client-side assets (JS, CSS, JSON)
- `views/` – Jade templates for SSR

Patterns:
- MVC-style separation:
– Models: `userschema.js`, `bulbschema.js`
– Views: `.jade` under `views/`
– Controllers/Routes: in `index.js` (mounting auth routes, form routes, static serve)
- External Service: Google OAuth via Passport
- Deployment: Heroku (`Procfile`)

##### Key insights from README
- OAuth login via Google
- Single-form entry → portfolio “builds” itself
- Hosted on Heroku, MongoDB likely used (no SQL files visible)

##### Putting it all together
- Break Express into sub-components:
- Auth module (`config/passport.js`)
- Routes/controllers (`index.js`)
- Views (`views/*.jade`)
- Static assets (`public/`)
- Form POST to server → DB write
- Portfolio GET → DB read → Jade render → HTML

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client Layer
    Browser["Client Browser"]:::client

    subgraph "Static Assets"
        Public["public/"]:::static
        JS1["index.js"]:::static
        JS2["proj.js"]:::static
        CSS1["main.css"]:::static
        CSS2["style.css"]:::static
        JSON["profile.json"]:::static
    end

    Browser -->|"Serves static assets"| Public
    Public --> JS1
    Public --> JS2
    Public --> CSS1
    Public --> CSS2
    Public --> JSON
    Public --> Browser

    %% Server Layer
    subgraph "Express Server" 
        Index["index.js"]:::backend
        subgraph "Config"
            AuthConf["config/auth.js"]:::config
            Passport["config/passport.js"]:::config
        end
        subgraph "Models"
            UserModel["userschema.js"]:::model
            BulbModel["bulbschema.js"]:::model
        end
        subgraph "Views (Jade Templates)"
            V1["views/index.jade"]:::view
            V2["views/form.jade"]:::view
            V3["views/main.jade"]:::view
            V4["views/projects.jade"]:::view
        end
        Package["package.json"]:::config
        Env[".env / Procfile"]:::config
        Readme["README.md"]:::config
    end

    Browser -->|"HTTP GET /"| Index
    Index -->|"Serves static from public/"| Public
    Browser -->|"HTTP GET /auth/google"| Passport
    Passport -->|"redirect"| GoogleOAuth
    GoogleOAuth -->|"callback /auth/google/callback"| Passport
    Passport -->|"User lookup/create"| UserModel
    Browser -->|"HTTP POST /form"| Index
    Index -->|"Mongoose save()"| BulbModel
    Browser -->|"HTTP GET /projects"| Index
    Index -->|"Mongoose find()"| UserModel
    Index -->|"Mongoose find()"| BulbModel
    Index -->|"Render Jade"| V4
    V4 --> Browser

    %% Database and External
    MongoDB["MongoDB"]:::db
    GoogleOAuth["Google OAuth 2.0"]:::external

    UserModel -->|"read/write"| MongoDB
    BulbModel -->|"read/write"| MongoDB

    Passport --> AuthConf
    Passport --> Index
    Index --> Package
    Index --> Env
    Index --> Readme

    %% Click Events
    click Public "https://github.com/pramodpots/bulb/tree/master/public/"
    click JS1 "https://github.com/pramodpots/bulb/blob/master/public/index.js"
    click JS2 "https://github.com/pramodpots/bulb/blob/master/public/proj.js"
    click CSS1 "https://github.com/pramodpots/bulb/blob/master/public/main.css"
    click CSS2 "https://github.com/pramodpots/bulb/blob/master/public/style.css"
    click JSON "https://github.com/pramodpots/bulb/blob/master/public/profile.json"
    click Index "https://github.com/pramodpots/bulb/blob/master/index.js"
    click AuthConf "https://github.com/pramodpots/bulb/blob/master/config/auth.js"
    click Passport "https://github.com/pramodpots/bulb/blob/master/config/passport.js"
    click UserModel "https://github.com/pramodpots/bulb/blob/master/userschema.js"
    click BulbModel "https://github.com/pramodpots/bulb/blob/master/bulbschema.js"
    click V1 "https://github.com/pramodpots/bulb/blob/master/views/index.jade"
    click V2 "https://github.com/pramodpots/bulb/blob/master/views/form.jade"
    click V3 "https://github.com/pramodpots/bulb/blob/master/views/main.jade"
    click V4 "https://github.com/pramodpots/bulb/blob/master/views/projects.jade"
    click Package "https://github.com/pramodpots/bulb/blob/master/package.json"
    click Env "https://github.com/pramodpots/bulb/blob/master/.env"
    click Env "https://github.com/pramodpots/bulb/tree/master/Procfile"
    click Readme "https://github.com/pramodpots/bulb/blob/master/README.md"

    %% Styles
    classDef client fill:#f9f,stroke:#333;
    classDef static fill:#efe,stroke:#333;
    classDef backend fill:#bbf,stroke:#333;
    classDef config fill:#ddf,stroke:#333;
    classDef model fill:#acf,stroke:#333;
    classDef view fill:#fca,stroke:#333;
    classDef db fill:#f96,stroke:#333,stroke-width:2px;
    classDef external fill:#6f6,stroke:#333,stroke-width:2px;
```
