# yasaswitha18/blogspott architecture

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

- Interactive diagram: https://gitdiagram.com/yasaswitha18/blogspott
- Repository: https://github.com/yasaswitha18/blogspott

## Overview

BlogSpot is a full-stack blogging application. Users register and verify accounts, log in, publish posts, browse public posts, and access user profiles and their posts; account recovery and profile updates are also supported. The sampled backend shows Express routing, authentication logic, PostgreSQL access, and email delivery. The tree contains a built React frontend but no frontend source, so its internal behavior and specific API calls cannot be traced here.

Main entry points: [`db/postgresql.js`](https://github.com/yasaswitha18/blogspott/blob/main/db/postgresql.js) (PostgreSQL data access), [`index.js`](https://github.com/yasaswitha18/blogspott/blob/main/index.js) (Express application), [`routes/authRoutes.js`](https://github.com/yasaswitha18/blogspott/blob/main/routes/authRoutes.js) (Authentication routes), [`utilities/auth.js`](https://github.com/yasaswitha18/blogspott/blob/main/utilities/auth.js) (Authentication logic)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Application runtime"]
  node_server["Express application<br/>[index.js]"]
  node_frontend["React frontend build"]
end

subgraph group_identity["Identity and email"]
  node_auth_routes["Authentication routes<br/>[authRoutes.js]"]
  node_auth_logic["Authentication logic<br/>[auth.js]"]
  node_mailer["Verification and reset mailer<br/>[mailer.js]"]
  node_email_service["Gmail email service"]
end

subgraph group_content["Blogs and users"]
  node_blog_routes["Blog routes<br/>[blogRoutes.js]"]
  node_user_routes["User routes<br/>[userRoutes.js]"]
end

subgraph group_data["Persistence and formatting"]
  node_postgres_adapter["PostgreSQL data access<br/>[postgresql.js]"]
  node_postgres_store[("PostgreSQL database")]
  node_date_time["Date formatting<br/>[dateTime.js]"]
end

node_visitor(("Visitor"))

node_visitor -->|"makes requests"| node_server
node_server -->|"mounts auth API"| node_auth_routes
node_server -->|"mounts blog API"| node_blog_routes
node_server -->|"mounts user API"| node_user_routes
node_server -->|"serves static app"| node_frontend
node_server -->|"connects at startup"| node_postgres_adapter
node_auth_routes -->|"delegates account actions"| node_auth_logic
node_auth_routes -->|"reads and updates accounts"| node_postgres_adapter
node_auth_routes -->|"sends reset email"| node_mailer
node_auth_logic -->|"checks and changes accounts"| node_postgres_adapter
node_auth_logic -->|"sends verification email"| node_mailer
node_mailer -->|"sends messages"| node_email_service
node_blog_routes -->|"creates and fetches blogs"| node_postgres_adapter
node_user_routes -->|"searches and fetches users"| node_postgres_adapter
node_postgres_adapter -->|"queries database"| node_postgres_store
node_postgres_adapter -->|"formats blog dates"| node_date_time

click node_server "https://github.com/yasaswitha18/blogspott/blob/main/index.js"
click node_frontend "https://github.com/yasaswitha18/blogspott/tree/main/build"
click node_auth_routes "https://github.com/yasaswitha18/blogspott/blob/main/routes/authRoutes.js"
click node_auth_logic "https://github.com/yasaswitha18/blogspott/blob/main/utilities/auth.js"
click node_mailer "https://github.com/yasaswitha18/blogspott/blob/main/utilities/mailer.js"
click node_blog_routes "https://github.com/yasaswitha18/blogspott/blob/main/routes/blogRoutes.js"
click node_user_routes "https://github.com/yasaswitha18/blogspott/blob/main/routes/userRoutes.js"
click node_postgres_adapter "https://github.com/yasaswitha18/blogspott/blob/main/db/postgresql.js"
click node_date_time "https://github.com/yasaswitha18/blogspott/blob/main/utilities/dateTime.js"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_server,node_frontend toneBlue
class node_auth_routes,node_auth_logic,node_mailer,node_email_service toneAmber
class node_blog_routes,node_user_routes toneMint
class node_postgres_adapter,node_postgres_store,node_date_time toneRose
class node_visitor toneIndigo
```

## Components

### Application runtime

- [Express application](https://github.com/yasaswitha18/blogspott/blob/main/index.js): `index.js`
- [React frontend build](https://github.com/yasaswitha18/blogspott/tree/main/build): `build`

### Identity and email

- [Authentication routes](https://github.com/yasaswitha18/blogspott/blob/main/routes/authRoutes.js): `routes/authRoutes.js`
- [Authentication logic](https://github.com/yasaswitha18/blogspott/blob/main/utilities/auth.js): `utilities/auth.js`
- [Verification and reset mailer](https://github.com/yasaswitha18/blogspott/blob/main/utilities/mailer.js): `utilities/mailer.js`
- **Gmail email service**

### Blogs and users

- [Blog routes](https://github.com/yasaswitha18/blogspott/blob/main/routes/blogRoutes.js): `routes/blogRoutes.js`
- [User routes](https://github.com/yasaswitha18/blogspott/blob/main/routes/userRoutes.js): `routes/userRoutes.js`

### Persistence and formatting

- [PostgreSQL data access](https://github.com/yasaswitha18/blogspott/blob/main/db/postgresql.js): `db/postgresql.js`
- **PostgreSQL database**
- [Date formatting](https://github.com/yasaswitha18/blogspott/blob/main/utilities/dateTime.js): `utilities/dateTime.js`

### Other components

- **Visitor**

## Connections

- Visitor → Express application: makes requests
- Express application → Authentication routes: mounts auth API (evidence: `index.js`)
- Express application → Blog routes: mounts blog API (evidence: `index.js`)
- Express application → User routes: mounts user API (evidence: `index.js`)
- Express application → React frontend build: serves static app (evidence: `index.js`)
- Express application → PostgreSQL data access: connects at startup (evidence: `index.js`)
- Authentication routes → Authentication logic: delegates account actions (evidence: `routes/authRoutes.js`)
- Authentication routes → PostgreSQL data access: reads and updates accounts (evidence: `routes/authRoutes.js`)
- Authentication routes → Verification and reset mailer: sends reset email (evidence: `routes/authRoutes.js`)
- Authentication logic → PostgreSQL data access: checks and changes accounts (evidence: `utilities/auth.js`)
- Authentication logic → Verification and reset mailer: sends verification email (evidence: `utilities/auth.js`)
- Verification and reset mailer → Gmail email service: sends messages (evidence: `utilities/mailer.js`)
- Blog routes → PostgreSQL data access: creates and fetches blogs (evidence: `routes/blogRoutes.js`)
- User routes → PostgreSQL data access: searches and fetches users (evidence: `routes/userRoutes.js`)
- PostgreSQL data access → PostgreSQL database: queries database (evidence: `db/postgresql.js`)
- PostgreSQL data access → Date formatting: formats blog dates (evidence: `db/postgresql.js`)
