# naresh2060/fb-page-automation architecture

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

- Interactive diagram: https://gitdiagram.com/naresh2060/fb-page-automation
- Repository: https://github.com/naresh2060/fb-page-automation

## Overview

This is a social-media content management application: users sign in, create or refine AI-assisted posts, manage drafts and schedules, connect Facebook or Instagram, and review publishing and audience data. The client routes users through dashboards and content tools; the server exposes authenticated APIs backed by MongoDB models and platform services. The README is empty, and several important client modules were not excerpted, so their detailed interactions are not asserted; dashed links mark the client-to-server boundary as unverified.

Main entry points: [`client/src/App.jsx`](https://github.com/naresh2060/fb-page-automation/blob/main/client/src/App.jsx) (App routing), [`server/controllers/postController.js`](https://github.com/naresh2060/fb-page-automation/blob/main/server/controllers/postController.js) (Post operations), [`server/middlewares/authenticate.js`](https://github.com/naresh2060/fb-page-automation/blob/main/server/middlewares/authenticate.js) (Authentication guard), [`server/controllers/facebookController.js`](https://github.com/naresh2060/fb-page-automation/blob/main/server/controllers/facebookController.js) (Facebook operations)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Client experience"]
  node_app["App routing<br/>[App.jsx]"]
  node_protected["Protected layout"]
  node_login["Login and signup<br/>[Login.jsx]"]
  node_dashboard["Dashboard<br/>[Dashboard.jsx]"]
  node_calendar["Calendar<br/>[Calendar.jsx]"]
  node_axios["HTTP client<br/>[axiosInstance.js]"]
end

subgraph group_auth["Identity"]
  node_authui["Auth state<br/>[useAuthStore.js]"]
  node_authapi["Auth endpoints<br/>[auth.js]"]
  node_authenticate["Authentication guard<br/>[authenticate.js]"]
  node_authservice["Token service<br/>[authService.js]"]
  node_usermodel[("User records<br/>[User.js]")]
end

subgraph group_content["Content workflow"]
  node_contentui["Content manager<br/>[ContentManager.jsx]"]
  node_poststore["Post state<br/>[usePostStore.js]"]
  node_postapi["Post API<br/>[postApi.js]"]
  node_createpost["Post generation<br/>[postController.js]"]
  node_postservice["Post services<br/>[postServices.js]"]
  node_imagegen["Image generation"]
  node_cloudinary["Image hosting"]
  node_postmodel[("Post records<br/>[Post.js]")]
  node_postcontroller["Post operations<br/>[postController.js]"]
end

subgraph group_channels["Social channels"]
  node_fbui["Facebook dashboard"]
  node_igui["Instagram dashboard"]
  node_platformmodel[("Platform connections<br/>[Platform.js]")]
  node_fbroutes["Facebook routes<br/>[facebook.routes.js]"]
  node_fbcontroller["Facebook operations"]
  node_fbservice["Facebook integration"]
  node_igcontroller["Instagram operations"]
  node_igservice["Instagram integration"]
end

subgraph group_server["Server foundation"]
  node_serverroutes["API route registry<br/>[index.js]"]
  node_postroutes["Post routes<br/>[post.routes.js]"]
  node_serverstart["Server startup<br/>[server.js]"]
  node_database[("MongoDB connection<br/>[db.js]")]
end

node_user(("User"))

node_user -->|"uses"| node_app
node_app -->|"routes through"| node_protected
node_app -->|"routes to"| node_login
node_app -->|"routes to"| node_dashboard
node_app -->|"routes to"| node_calendar
node_app -->|"routes to"| node_contentui
node_app -->|"routes to"| node_fbui
node_app -->|"routes to"| node_igui
node_app -->|"checks session"| node_authui
node_authui -->|"sends requests"| node_axios
node_authapi -->|"uses tokens"| node_authservice
node_authapi -->|"uses guard"| node_authenticate
node_authenticate -->|"verifies token"| node_authservice
node_authenticate -->|"loads user"| node_usermodel
node_contentui -->|"manages posts"| node_poststore
node_poststore -->|"calls API"| node_postapi
node_postapi -->|"uses client"| node_axios
node_postcontroller -->|"generates content"| node_postservice
node_postcontroller -->|"generates image"| node_imagegen
node_postcontroller -->|"uploads image"| node_cloudinary
node_postcontroller -->|"updates records"| node_postmodel
node_postservice -->|"reads and writes"| node_postmodel
node_serverstart -->|"connects database"| node_database
node_serverstart -->|"mounts routes"| node_serverroutes
node_serverroutes -->|"registers auth"| node_authapi
node_serverroutes -->|"registers posts"| node_postroutes
node_serverroutes -->|"registers Facebook"| node_fbroutes
node_postroutes -->|"protects routes"| node_authenticate
node_postroutes -->|"dispatches posts"| node_postcontroller
node_fbroutes -->|"protects routes"| node_authenticate
node_fbroutes -->|"dispatches actions"| node_fbcontroller
node_fbcontroller -->|"calls platform API"| node_fbservice
node_fbcontroller -->|"reads and writes"| node_postmodel
node_fbcontroller -->|"uses connection"| node_platformmodel
node_igcontroller -->|"calls platform API"| node_igservice
node_igcontroller -->|"uses connection"| node_platformmodel
node_fbui -->|"uses post state"| node_poststore
node_postapi -.->|"HTTP integration"| node_postroutes
node_authui -.->|"HTTP integration"| node_authapi

click node_app "https://github.com/naresh2060/fb-page-automation/blob/main/client/src/App.jsx"
click node_protected "https://github.com/naresh2060/fb-page-automation/blob/main/client/src/layout/ProtectedLayout.jsx"
click node_login "https://github.com/naresh2060/fb-page-automation/blob/main/client/src/pages/Login/Login.jsx"
click node_dashboard "https://github.com/naresh2060/fb-page-automation/blob/main/client/src/pages/Dashboard/Dashboard.jsx"
click node_calendar "https://github.com/naresh2060/fb-page-automation/blob/main/client/src/components/Calendar/Calendar.jsx"
click node_contentui "https://github.com/naresh2060/fb-page-automation/blob/main/client/src/pages/Content/ContentManager.jsx"
click node_poststore "https://github.com/naresh2060/fb-page-automation/blob/main/client/src/store/usePostStore.js"
click node_postapi "https://github.com/naresh2060/fb-page-automation/blob/main/client/src/api/postApi.js"
click node_createpost "https://github.com/naresh2060/fb-page-automation/blob/main/server/controllers/postController.js"
click node_postservice "https://github.com/naresh2060/fb-page-automation/blob/main/server/services/postServices.js"
click node_imagegen "https://github.com/naresh2060/fb-page-automation/blob/main/server/services/huggingfaceService.js"
click node_cloudinary "https://github.com/naresh2060/fb-page-automation/blob/main/server/services/cloudinaryService.js"
click node_postmodel "https://github.com/naresh2060/fb-page-automation/blob/main/server/models/Post.js"
click node_authui "https://github.com/naresh2060/fb-page-automation/blob/main/client/src/store/useAuthStore.js"
click node_authapi "https://github.com/naresh2060/fb-page-automation/blob/main/server/api/v1/auth/auth.js"
click node_authenticate "https://github.com/naresh2060/fb-page-automation/blob/main/server/middlewares/authenticate.js"
click node_authservice "https://github.com/naresh2060/fb-page-automation/blob/main/server/services/authService.js"
click node_usermodel "https://github.com/naresh2060/fb-page-automation/blob/main/server/models/User.js"
click node_fbui "https://github.com/naresh2060/fb-page-automation/blob/main/client/src/pages/FacebookDashboard/FacebookDashboard.jsx"
click node_igui "https://github.com/naresh2060/fb-page-automation/blob/main/client/src/pages/InstagramDashboard/InstagramDashboard.jsx"
click node_platformmodel "https://github.com/naresh2060/fb-page-automation/blob/main/server/models/Platform.js"
click node_fbroutes "https://github.com/naresh2060/fb-page-automation/blob/main/server/routes/facebook.routes.js"
click node_fbcontroller "https://github.com/naresh2060/fb-page-automation/blob/main/server/controllers/facebookController.js"
click node_fbservice "https://github.com/naresh2060/fb-page-automation/blob/main/server/services/facebookServices.js"
click node_igcontroller "https://github.com/naresh2060/fb-page-automation/blob/main/server/controllers/instagramController.js"
click node_igservice "https://github.com/naresh2060/fb-page-automation/blob/main/server/services/instagramService.js"
click node_serverroutes "https://github.com/naresh2060/fb-page-automation/blob/main/server/routes/index.js"
click node_postroutes "https://github.com/naresh2060/fb-page-automation/blob/main/server/routes/post.routes.js"
click node_postcontroller "https://github.com/naresh2060/fb-page-automation/blob/main/server/controllers/postController.js"
click node_serverstart "https://github.com/naresh2060/fb-page-automation/blob/main/server/server.js"
click node_database "https://github.com/naresh2060/fb-page-automation/blob/main/server/config/db.js"
click node_axios "https://github.com/naresh2060/fb-page-automation/blob/main/client/src/api/axiosInstance.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_app,node_protected,node_login,node_dashboard,node_calendar,node_axios,node_user toneBlue
class node_authui,node_authapi,node_authenticate,node_authservice,node_usermodel toneAmber
class node_contentui,node_poststore,node_postapi,node_createpost,node_postservice,node_imagegen,node_cloudinary,node_postmodel,node_postcontroller toneMint
class node_fbui,node_igui,node_platformmodel,node_fbroutes,node_fbcontroller,node_fbservice,node_igcontroller,node_igservice toneRose
class node_serverroutes,node_postroutes,node_serverstart,node_database toneIndigo
```

## Components

### Client experience

- [App routing](https://github.com/naresh2060/fb-page-automation/blob/main/client/src/App.jsx): `client/src/App.jsx`
- [Protected layout](https://github.com/naresh2060/fb-page-automation/blob/main/client/src/layout/ProtectedLayout.jsx): `client/src/layout/ProtectedLayout.jsx`
- [Login and signup](https://github.com/naresh2060/fb-page-automation/blob/main/client/src/pages/Login/Login.jsx): `client/src/pages/Login/Login.jsx`
- [Dashboard](https://github.com/naresh2060/fb-page-automation/blob/main/client/src/pages/Dashboard/Dashboard.jsx): `client/src/pages/Dashboard/Dashboard.jsx`
- [Calendar](https://github.com/naresh2060/fb-page-automation/blob/main/client/src/components/Calendar/Calendar.jsx): `client/src/components/Calendar/Calendar.jsx`
- [HTTP client](https://github.com/naresh2060/fb-page-automation/blob/main/client/src/api/axiosInstance.js): `client/src/api/axiosInstance.js`

### Identity

- [Auth state](https://github.com/naresh2060/fb-page-automation/blob/main/client/src/store/useAuthStore.js): `client/src/store/useAuthStore.js`
- [Auth endpoints](https://github.com/naresh2060/fb-page-automation/blob/main/server/api/v1/auth/auth.js): `server/api/v1/auth/auth.js`
- [Authentication guard](https://github.com/naresh2060/fb-page-automation/blob/main/server/middlewares/authenticate.js): `server/middlewares/authenticate.js`
- [Token service](https://github.com/naresh2060/fb-page-automation/blob/main/server/services/authService.js): `server/services/authService.js`
- [User records](https://github.com/naresh2060/fb-page-automation/blob/main/server/models/User.js): `server/models/User.js`

### Content workflow

- [Content manager](https://github.com/naresh2060/fb-page-automation/blob/main/client/src/pages/Content/ContentManager.jsx): `client/src/pages/Content/ContentManager.jsx`
- [Post state](https://github.com/naresh2060/fb-page-automation/blob/main/client/src/store/usePostStore.js): `client/src/store/usePostStore.js`
- [Post API](https://github.com/naresh2060/fb-page-automation/blob/main/client/src/api/postApi.js): `client/src/api/postApi.js`
- [Post generation](https://github.com/naresh2060/fb-page-automation/blob/main/server/controllers/postController.js): `server/controllers/postController.js`
- [Post services](https://github.com/naresh2060/fb-page-automation/blob/main/server/services/postServices.js): `server/services/postServices.js`
- [Image generation](https://github.com/naresh2060/fb-page-automation/blob/main/server/services/huggingfaceService.js): `server/services/huggingfaceService.js`
- [Image hosting](https://github.com/naresh2060/fb-page-automation/blob/main/server/services/cloudinaryService.js): `server/services/cloudinaryService.js`
- [Post records](https://github.com/naresh2060/fb-page-automation/blob/main/server/models/Post.js): `server/models/Post.js`
- [Post operations](https://github.com/naresh2060/fb-page-automation/blob/main/server/controllers/postController.js): `server/controllers/postController.js`

### Social channels

- [Facebook dashboard](https://github.com/naresh2060/fb-page-automation/blob/main/client/src/pages/FacebookDashboard/FacebookDashboard.jsx): `client/src/pages/FacebookDashboard/FacebookDashboard.jsx`
- [Instagram dashboard](https://github.com/naresh2060/fb-page-automation/blob/main/client/src/pages/InstagramDashboard/InstagramDashboard.jsx): `client/src/pages/InstagramDashboard/InstagramDashboard.jsx`
- [Platform connections](https://github.com/naresh2060/fb-page-automation/blob/main/server/models/Platform.js): `server/models/Platform.js`
- [Facebook routes](https://github.com/naresh2060/fb-page-automation/blob/main/server/routes/facebook.routes.js): `server/routes/facebook.routes.js`
- [Facebook operations](https://github.com/naresh2060/fb-page-automation/blob/main/server/controllers/facebookController.js): `server/controllers/facebookController.js`
- [Facebook integration](https://github.com/naresh2060/fb-page-automation/blob/main/server/services/facebookServices.js): `server/services/facebookServices.js`
- [Instagram operations](https://github.com/naresh2060/fb-page-automation/blob/main/server/controllers/instagramController.js): `server/controllers/instagramController.js`
- [Instagram integration](https://github.com/naresh2060/fb-page-automation/blob/main/server/services/instagramService.js): `server/services/instagramService.js`

### Server foundation

- [API route registry](https://github.com/naresh2060/fb-page-automation/blob/main/server/routes/index.js): `server/routes/index.js`
- [Post routes](https://github.com/naresh2060/fb-page-automation/blob/main/server/routes/post.routes.js): `server/routes/post.routes.js`
- [Server startup](https://github.com/naresh2060/fb-page-automation/blob/main/server/server.js): `server/server.js`
- [MongoDB connection](https://github.com/naresh2060/fb-page-automation/blob/main/server/config/db.js): `server/config/db.js`

### Other components

- **User**

## Connections

- User → App routing: uses (evidence: `client/src/App.jsx`)
- App routing → Protected layout: routes through (evidence: `client/src/App.jsx`)
- App routing → Login and signup: routes to (evidence: `client/src/App.jsx`)
- App routing → Dashboard: routes to (evidence: `client/src/App.jsx`)
- App routing → Calendar: routes to (evidence: `client/src/App.jsx`)
- App routing → Content manager: routes to (evidence: `client/src/App.jsx`)
- App routing → Facebook dashboard: routes to (evidence: `client/src/App.jsx`)
- App routing → Instagram dashboard: routes to (evidence: `client/src/App.jsx`)
- App routing → Auth state: checks session (evidence: `client/src/App.jsx`)
- Auth state → HTTP client: sends requests (evidence: `client/src/store/useAuthStore.js`)
- Auth endpoints → Token service: uses tokens (evidence: `server/api/v1/auth/auth.js`)
- Auth endpoints → Authentication guard: uses guard (evidence: `server/api/v1/auth/auth.js`)
- Authentication guard → Token service: verifies token (evidence: `server/middlewares/authenticate.js`)
- Authentication guard → User records: loads user (evidence: `server/middlewares/authenticate.js`)
- Content manager → Post state: manages posts (evidence: `client/src/pages/Content/ContentManager.jsx`)
- Post state → Post API: calls API (evidence: `client/src/store/usePostStore.js`)
- Post API → HTTP client: uses client (evidence: `client/src/api/postApi.js`)
- Post operations → Post services: generates content (evidence: `server/controllers/postController.js`)
- Post operations → Image generation: generates image (evidence: `server/controllers/postController.js`)
- Post operations → Image hosting: uploads image (evidence: `server/controllers/postController.js`)
- Post operations → Post records: updates records (evidence: `server/controllers/postController.js`)
- Post services → Post records: reads and writes (evidence: `server/services/postServices.js`)
- Server startup → MongoDB connection: connects database (evidence: `server/server.js`)
- Server startup → API route registry: mounts routes (evidence: `server/server.js`)
- API route registry → Auth endpoints: registers auth (evidence: `server/routes/index.js`)
- API route registry → Post routes: registers posts (evidence: `server/routes/index.js`)
- API route registry → Facebook routes: registers Facebook (evidence: `server/routes/index.js`)
- Post routes → Authentication guard: protects routes (evidence: `server/routes/post.routes.js`)
- Post routes → Post operations: dispatches posts (evidence: `server/routes/post.routes.js`)
- Facebook routes → Authentication guard: protects routes (evidence: `server/routes/facebook.routes.js`)
- Facebook routes → Facebook operations: dispatches actions (evidence: `server/routes/facebook.routes.js`)
- Facebook operations → Facebook integration: calls platform API (evidence: `server/controllers/facebookController.js`)
- Facebook operations → Post records: reads and writes (evidence: `server/controllers/facebookController.js`)
- Facebook operations → Platform connections: uses connection (evidence: `server/controllers/facebookController.js`)
- Instagram operations → Instagram integration: calls platform API (evidence: `server/controllers/instagramController.js`)
- Instagram operations → Platform connections: uses connection (evidence: `server/controllers/instagramController.js`)
- Facebook dashboard → Post state: uses post state (evidence: `client/src/pages/FacebookDashboard/FacebookDashboard.jsx`)
- Post API → Post routes: HTTP integration
- Auth state → Auth endpoints: HTTP integration
