# saravanaworkspaces/cognivphotostic architecture

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

- Interactive diagram: https://gitdiagram.com/saravanaworkspaces/cognivphotostic
- Repository: https://github.com/saravanaworkspaces/cognivphotostic

## Overview

CognivPhotostic pairs a Strapi CMS with a Next.js site for publishing categorized content and affiliate product recommendations. Visitors browse posts and products; product clicks resolve an affiliate URL, log tracking data, then redirect. Creators authenticate in the admin, manage drafts and media through frontend routes that proxy Strapi, and publish content. The README also documents rich content blocks, taxonomy, and SEO/performance goals. Sampled code verifies bootstrap taxonomy and permissions plus several proxy and tracking routes; unsampled page-to-API wiring is represented only where documented, so some frontend edges are omitted.

Main entry points: [`backend/src/api`](https://github.com/saravanaworkspaces/cognivphotostic/tree/main/backend/src/api) (Strapi CMS), [`frontend/src/app/blog`](https://github.com/saravanaworkspaces/cognivphotostic/tree/main/frontend/src/app/blog) (Blog pages), [`frontend/src/app/api/admin/posts`](https://github.com/saravanaworkspaces/cognivphotostic/tree/main/frontend/src/app/api/admin/posts) (Admin post routes), [`frontend/src/app/api/affiliate/[id]/route.ts`](https://github.com/saravanaworkspaces/cognivphotostic/blob/main/frontend/src/app/api/affiliate/%5Bid%5D/route.ts) (Affiliate redirect)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Reader website"]
  node_browse["Browse content<br/>[page.tsx]"]
  node_blog["Blog pages"]
  node_category["Category pages<br/>[page.tsx]"]
  node_products["Products page<br/>[page.tsx]"]
  node_blocks["Rich content blocks"]
  node_api["Content API client<br/>[api.ts]"]
end

subgraph group_manage["Creator tools"]
  node_admin["Admin workspace"]
  node_postform["Post editor<br/>[PostForm.tsx]"]
  node_adminroutes["Admin post routes"]
  node_auth["Authentication<br/>[auth.ts]"]
  node_upload["Media upload proxy<br/>[route.ts]"]
end

subgraph group_cms["CMS content"]
  node_cms["Strapi CMS"]
  node_posts["Posts"]
  node_catalog["Products"]
  node_taxonomy["Category and tag data<br/>[taxonomy.js]"]
  node_bootstrap["CMS bootstrap<br/>[index.js]"]
  node_database[("CMS database<br/>[database.js]")]
end

subgraph group_track["Affiliate commerce"]
  node_clickroute["Affiliate redirect<br/>[route.ts]"]
  node_clickapi["Click tracking API<br/>[api.ts]"]
  node_clicks["Affiliate click records"]
end

node_visitor(("Reader"))
node_merchant(("Merchant site"))

node_visitor -->|"visits"| node_browse
node_visitor -->|"reads"| node_blog
node_visitor -->|"browses"| node_category
node_visitor -->|"browses"| node_products
node_blog -->|"renders"| node_blocks
node_blog -.->|"fetches content"| node_api
node_category -.->|"fetches content"| node_api
node_products -.->|"fetches products"| node_api
node_admin -.->|"edits posts"| node_postform
node_postform -.->|"submits posts"| node_adminroutes
node_adminroutes -->|"checks session"| node_auth
node_adminroutes -->|"calls posts API"| node_cms
node_upload -->|"checks session"| node_auth
node_upload -->|"uploads media"| node_cms
node_cms -.->|"serves content"| node_posts
node_cms -.->|"serves products"| node_catalog
node_cms -->|"seeds from"| node_taxonomy
node_bootstrap -->|"imports taxonomy"| node_taxonomy
node_cms -.->|"persists data"| node_database
node_visitor -->|"clicks product"| node_clickroute
node_clickroute -->|"tracks click"| node_clickapi
node_clickroute -->|"redirects"| node_merchant
node_clickapi -.->|"records click"| node_clicks

click node_browse "https://github.com/saravanaworkspaces/cognivphotostic/blob/main/frontend/src/app/page.tsx"
click node_blog "https://github.com/saravanaworkspaces/cognivphotostic/tree/main/frontend/src/app/blog"
click node_category "https://github.com/saravanaworkspaces/cognivphotostic/blob/main/frontend/src/app/category/%5Bslug%5D/page.tsx"
click node_products "https://github.com/saravanaworkspaces/cognivphotostic/blob/main/frontend/src/app/products/page.tsx"
click node_blocks "https://github.com/saravanaworkspaces/cognivphotostic/tree/main/frontend/src/components/blog/blocks"
click node_api "https://github.com/saravanaworkspaces/cognivphotostic/blob/main/frontend/src/lib/api.ts"
click node_admin "https://github.com/saravanaworkspaces/cognivphotostic/tree/main/frontend/src/app/admin/(panel)"
click node_postform "https://github.com/saravanaworkspaces/cognivphotostic/blob/main/frontend/src/components/admin/PostForm.tsx"
click node_adminroutes "https://github.com/saravanaworkspaces/cognivphotostic/tree/main/frontend/src/app/api/admin/posts"
click node_auth "https://github.com/saravanaworkspaces/cognivphotostic/blob/main/frontend/src/auth.ts"
click node_upload "https://github.com/saravanaworkspaces/cognivphotostic/blob/main/frontend/src/app/api/upload/route.ts"
click node_cms "https://github.com/saravanaworkspaces/cognivphotostic/tree/main/backend/src/api"
click node_posts "https://github.com/saravanaworkspaces/cognivphotostic/tree/main/backend/src/api/post"
click node_catalog "https://github.com/saravanaworkspaces/cognivphotostic/tree/main/backend/src/api/product"
click node_taxonomy "https://github.com/saravanaworkspaces/cognivphotostic/blob/main/backend/src/data/taxonomy.js"
click node_bootstrap "https://github.com/saravanaworkspaces/cognivphotostic/blob/main/backend/src/index.js"
click node_database "https://github.com/saravanaworkspaces/cognivphotostic/blob/main/backend/config/database.js"
click node_clickroute "https://github.com/saravanaworkspaces/cognivphotostic/blob/main/frontend/src/app/api/affiliate/%5Bid%5D/route.ts"
click node_clickapi "https://github.com/saravanaworkspaces/cognivphotostic/blob/main/frontend/src/lib/api.ts"
click node_clicks "https://github.com/saravanaworkspaces/cognivphotostic/tree/main/backend/src/api/affiliate-click"

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_browse,node_blog,node_category,node_products,node_blocks,node_api toneBlue
class node_admin,node_postform,node_adminroutes,node_auth,node_upload toneAmber
class node_cms,node_posts,node_catalog,node_taxonomy,node_bootstrap,node_database toneMint
class node_clickroute,node_clickapi,node_clicks toneRose
class node_visitor,node_merchant toneIndigo
```

## Components

### Reader website

- [Browse content](https://github.com/saravanaworkspaces/cognivphotostic/blob/main/frontend/src/app/page.tsx): `frontend/src/app/page.tsx`
- [Blog pages](https://github.com/saravanaworkspaces/cognivphotostic/tree/main/frontend/src/app/blog): `frontend/src/app/blog`
- [Category pages](https://github.com/saravanaworkspaces/cognivphotostic/blob/main/frontend/src/app/category/%5Bslug%5D/page.tsx): `frontend/src/app/category/[slug]/page.tsx`
- [Products page](https://github.com/saravanaworkspaces/cognivphotostic/blob/main/frontend/src/app/products/page.tsx): `frontend/src/app/products/page.tsx`
- [Rich content blocks](https://github.com/saravanaworkspaces/cognivphotostic/tree/main/frontend/src/components/blog/blocks): `frontend/src/components/blog/blocks`
- [Content API client](https://github.com/saravanaworkspaces/cognivphotostic/blob/main/frontend/src/lib/api.ts): `frontend/src/lib/api.ts`

### Creator tools

- [Admin workspace](https://github.com/saravanaworkspaces/cognivphotostic/tree/main/frontend/src/app/admin/(panel)): `frontend/src/app/admin/(panel)`
- [Post editor](https://github.com/saravanaworkspaces/cognivphotostic/blob/main/frontend/src/components/admin/PostForm.tsx): `frontend/src/components/admin/PostForm.tsx`
- [Admin post routes](https://github.com/saravanaworkspaces/cognivphotostic/tree/main/frontend/src/app/api/admin/posts): `frontend/src/app/api/admin/posts`
- [Authentication](https://github.com/saravanaworkspaces/cognivphotostic/blob/main/frontend/src/auth.ts): `frontend/src/auth.ts`
- [Media upload proxy](https://github.com/saravanaworkspaces/cognivphotostic/blob/main/frontend/src/app/api/upload/route.ts): `frontend/src/app/api/upload/route.ts`

### CMS content

- [Strapi CMS](https://github.com/saravanaworkspaces/cognivphotostic/tree/main/backend/src/api): `backend/src/api`
- [Posts](https://github.com/saravanaworkspaces/cognivphotostic/tree/main/backend/src/api/post): `backend/src/api/post`
- [Products](https://github.com/saravanaworkspaces/cognivphotostic/tree/main/backend/src/api/product): `backend/src/api/product`
- [Category and tag data](https://github.com/saravanaworkspaces/cognivphotostic/blob/main/backend/src/data/taxonomy.js): `backend/src/data/taxonomy.js`
- [CMS bootstrap](https://github.com/saravanaworkspaces/cognivphotostic/blob/main/backend/src/index.js): `backend/src/index.js`
- [CMS database](https://github.com/saravanaworkspaces/cognivphotostic/blob/main/backend/config/database.js): `backend/config/database.js`

### Affiliate commerce

- [Affiliate redirect](https://github.com/saravanaworkspaces/cognivphotostic/blob/main/frontend/src/app/api/affiliate/%5Bid%5D/route.ts): `frontend/src/app/api/affiliate/[id]/route.ts`
- [Click tracking API](https://github.com/saravanaworkspaces/cognivphotostic/blob/main/frontend/src/lib/api.ts): `frontend/src/lib/api.ts`
- [Affiliate click records](https://github.com/saravanaworkspaces/cognivphotostic/tree/main/backend/src/api/affiliate-click): `backend/src/api/affiliate-click`

### Other components

- **Reader**
- **Merchant site**

## Connections

- Reader → Browse content: visits
- Reader → Blog pages: reads
- Reader → Category pages: browses
- Reader → Products page: browses
- Blog pages → Rich content blocks: renders
- Blog pages → Content API client: fetches content
- Category pages → Content API client: fetches content
- Products page → Content API client: fetches products
- Admin workspace → Post editor: edits posts
- Post editor → Admin post routes: submits posts
- Admin post routes → Authentication: checks session (evidence: `frontend/src/app/api/admin/posts/route.ts`)
- Admin post routes → Strapi CMS: calls posts API (evidence: `frontend/src/app/api/admin/posts/route.ts`)
- Media upload proxy → Authentication: checks session (evidence: `frontend/src/app/api/upload/route.ts`)
- Media upload proxy → Strapi CMS: uploads media (evidence: `frontend/src/app/api/upload/route.ts`)
- Strapi CMS → Posts: serves content
- Strapi CMS → Products: serves products
- Strapi CMS → Category and tag data: seeds from
- CMS bootstrap → Category and tag data: imports taxonomy (evidence: `backend/src/index.js`)
- Strapi CMS → CMS database: persists data
- Reader → Affiliate redirect: clicks product
- Affiliate redirect → Click tracking API: tracks click (evidence: `frontend/src/app/api/affiliate/[id]/route.ts`)
- Affiliate redirect → Merchant site: redirects (evidence: `frontend/src/app/api/affiliate/[id]/route.ts`)
- Click tracking API → Affiliate click records: records click
