# nahankar/shatika architecture

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

- Interactive diagram: https://gitdiagram.com/nahankar/shatika
- Repository: https://github.com/nahankar/shatika

## Overview

##### Project Type and Purpose
- This is a full-stack e-commerce application (“Shatika”) for traditional Indian art and crafts.
- Frontend: React + TypeScript (with Redux, Vite, components/pages)
- Backend: Node.js + Express (TypeScript, MVC-style controllers/models/routes)
- Database: MongoDB (with Mongoose)
- Media storage: Cloudinary
- Deployment: Docker Compose (with nginx reverse proxy), GitHub Actions for Docker image publishing.

##### File Structure Analysis
- Top-level:
- client/ – React application (src/, components, pages, redux store, Vite config, Dockerfile, nginx.conf)
- server/ – Express API (src/app.ts, controllers/, models/, routes/, middleware/, utils/, scripts/, Dockerfile)
- docker-compose.yml – orchestrates client, server, MongoDB services
- nginx.conf – reverse proxy configuration
- .github/workflows/docker-publish.yml – CI pipeline
- Patterns: MVC on the server, component/page and container splits on the client, Redux for state, Vite as bundler, Docker Compose network.

##### README Insights
- Features: authentication, product catalog, cart, orders, admin dashboard
- Tech stack confirms MERN-like architecture

a. Main Components
- User’s browser (UI layer)
- React App (Vite bundle)
- nginx (reverse proxy, static file hosting)
- Express API server (controllers, business logic)
- MongoDB database
- Cloudinary (image/media storage)
- GitHub Actions (CI/CD)
b. Relationships and Interactions
1. Browser ‹—HTTPS—› nginx serves React assets or proxies API calls
2. nginx › HTTP › Express API
3. Express › Mongoose driver › MongoDB
4. Express › Cloudinary SDK › Cloudinary
5. CI/CD › Docker registry › Deploy updated Docker images
c. Architectural Patterns
- Frontend: Component-based with Redux for global state
- Backend: MVC style (routes → controllers → models)
- Infrastructure: Containerized services orchestrated by Docker Compose, reverse proxy for routing and SSL termination
d. Key Technologies
- React, TypeScript, Redux, Vite
- Node.js, Express, TypeScript, Mongoose
- Docker, Docker Compose, nginx
- MongoDB, Cloudinary
- GitHub Actions

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Docker Compose Group
    subgraph "Docker Compose"
        DC["docker-compose.yml"]:::infra
        subgraph "Frontend Service"
            nginx_client["nginx (client)"]:::infra
            subgraph "React Application"
                ReactApp["React App"]:::frontend
                Vite["Vite Configuration"]:::frontend
                ReduxStore["Redux Store"]:::frontend
                ReduxSlices["Redux Slices"]:::frontend
                Components["React Components"]:::frontend
                Pages["React Pages"]:::frontend
            end
        end
        subgraph "Backend Service"
            ExpressAPI["Express API"]:::backend
            subgraph "API Components"
                APIEntry["Entry Point"]:::backend
                Controllers["MVC Controllers"]:::backend
                Models["Mongoose Models"]:::database
                Routes["API Routes"]:::backend
                Middleware["Express Middleware"]:::backend
                Utils["Utility Functions"]:::backend
                ConfigDB["DB Configuration"]:::backend
                ConfigCloud["Cloudinary Configuration"]:::backend
                Scripts["Server-side Scripts"]:::backend
            end
        end
        mongoDB["MongoDB"]:::database
        nginx_global["nginx Reverse Proxy"]:::infra
    end

    %% External and CI/CD
    Browser["User Browser"]:::external
    Cloudinary["Cloudinary"]:::external
    CI["GitHub Actions"]:::external
    Registry["Docker Registry"]:::external

    %% Connections
    Browser -->|"HTTPS"| nginx_global
    nginx_global -->|"serve static"| nginx_client
    nginx_client -->|"serves bundle"| ReactApp
    nginx_global -->|"proxy API calls"| ExpressAPI
    ExpressAPI -->|"connects to"| Models
    ExpressAPI -->|"routes via"| Routes
    ExpressAPI -->|"executes"| Controllers
    ExpressAPI -->|"applies"| Middleware
    ExpressAPI -->|"uses"| Utils
    ExpressAPI -->|"loads config"| ConfigDB
    ExpressAPI -->|"loads config"| ConfigCloud
    ExpressAPI -->|"runs"| Scripts
    ExpressAPI -->|"stores data in"| mongoDB
    ExpressAPI -->|"uploads media to"| Cloudinary

    CI -->|"build & push"| Registry
    Registry -->|"pull images"| nginx_global
    Registry -->|"pull images"| nginx_client
    Registry -->|"pull images"| ExpressAPI

    %% Click Events
    click ReactApp "https://github.com/nahankar/shatika/tree/main/client/client/src"
    click Vite "https://github.com/nahankar/shatika/blob/main/client/client/vite.config.ts"
    click ReduxStore "https://github.com/nahankar/shatika/blob/main/client/client/src/redux/store.ts"
    click ReduxSlices "https://github.com/nahankar/shatika/blob/main/client/client/src/redux/slices/*.ts"
    click Components "https://github.com/nahankar/shatika/tree/main/client/client/src/components"
    click Pages "https://github.com/nahankar/shatika/tree/main/client/client/src/pages"
    click nginx_client "https://github.com/nahankar/shatika/blob/main/client/client/nginx.conf"
    click APIEntry "https://github.com/nahankar/shatika/blob/main/server/src/index.ts"
    click APIEntry "https://github.com/nahankar/shatika/blob/main/server/src/app.ts"
    click Controllers "https://github.com/nahankar/shatika/blob/main/server/src/controllers/*.ts"
    click Models "https://github.com/nahankar/shatika/blob/main/server/src/models/*.ts"
    click Routes "https://github.com/nahankar/shatika/blob/main/server/src/routes/*.ts"
    click Middleware "https://github.com/nahankar/shatika/blob/main/server/src/middleware/*.ts"
    click Utils "https://github.com/nahankar/shatika/blob/main/server/src/utils/*.ts"
    click ConfigCloud "https://github.com/nahankar/shatika/blob/main/server/src/config/cloudinary.ts"
    click ConfigDB "https://github.com/nahankar/shatika/blob/main/server/src/config/db.ts"
    click Scripts "https://github.com/nahankar/shatika/blob/main/server/src/scripts/*.ts"
    click DC "https://github.com/nahankar/shatika/blob/main/docker-compose.yml"
    click nginx_global "https://github.com/nahankar/shatika/blob/main/nginx.conf"
    click CI "https://github.com/nahankar/shatika/blob/main/.github/workflows/docker-publish.yml"

    %% Styles
    classDef frontend fill:#ADD8E6,stroke:#000,color:#000
    classDef backend fill:#90EE90,stroke:#000,color:#000
    classDef database fill:#FFA500,stroke:#000,color:#000
    classDef external fill:#D3D3D3,stroke:#000,color:#000
    classDef infra fill:#D3D3D3,stroke:#000,color:#000
```
