# scrozza2007/numisroma architecture

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

- Interactive diagram: https://gitdiagram.com/scrozza2007/numisroma
- Repository: https://github.com/scrozza2007/numisroma

## Overview

##### Project type and purpose
- From the README and file tree, NumisRoma is a full-stack web application.
- Frontend: React single-page app for browsing/cataloging Roman coins.
- Backend: Node.js + Express REST API that supports public catalog endpoints plus authenticated “collection management” routes.
- Persistence: A document database accessed via model definitions (e.g., Mongoose/MongoDB).
- Auth: JWT-based stateless authentication.

##### File structure
- Top-level folders:
- backend/ – Express server (package.json, .env, src/)
- frontend/ – React app (inferred from README)
- backend/src follows an MVC style:
- routes/ – defines HTTP endpoints (auth.js, coins.js, collections.js)
- controllers/ – business logic (authController, coinController, collectionController)
- models/ – schema definitions (User, Coin, Collection)
- middlewares/ – e.g. authMiddleware validates JWTs
- index.js – server entry point, loads routes, middleware, DB connection
- Configuration: .env holds secrets (DB URL, JWT secret), .gitignore excludes node_modules, env files.

##### README insights
- Confirms tech stack (React, Node.js, JWT).
- Describes unauthenticated “open catalog” vs. authenticated “manage-your-collection” flows.
- Mentions future expandability (e.g., new coin categories).

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "Client (UI Layer)"
        React["React SPA"]:::ui
    end

    subgraph "Server (Node.js + Express)"
        API["API Gateway / Web Server"]:::api

        subgraph "API Layer (Routes)"
            AuthRoute["Auth Routes"]:::api
            CoinRoute["Coins Routes"]:::api
            CollectionRoute["Collections Routes"]:::api
        end

        subgraph "Auth Layer"
            AuthController["Auth Controller"]:::logic
            AuthMiddleware["Auth Middleware"]:::logic
        end

        subgraph "Business Logic (Controllers)"
            CoinController["Coin Controller"]:::logic
            CollectionController["Collection Controller"]:::logic
        end

        subgraph "Data Layer"
            UserModel["User Model"]:::data
            CoinModel["Coin Model"]:::data
            CollectionModel["Collection Model"]:::data
        end

        subgraph "Configuration"
            Env[".env"]:::config
            Package["package.json"]:::config
        end

        API --> AuthRoute
        API --> CoinRoute
        API --> CollectionRoute

        AuthRoute --> AuthController
        CoinRoute --> CoinController
        CollectionRoute --> CollectionController

        CollectionRoute --> AuthMiddleware

        AuthController --> UserModel
        CoinController --> CoinModel
        CollectionController --> CollectionModel

        UserModel --> DB[(MongoDB)]:::db
        CoinModel --> DB
        CollectionModel --> DB

        API --> Env
        API --> Package
    end

    React -->|HTTP/HTTPS JSON| API
    API -->|JSON Response| React

    click API "https://github.com/scrozza2007/numisroma/blob/main/backend/src/index.js"
    click AuthController "https://github.com/scrozza2007/numisroma/blob/main/backend/src/controllers/authController.js"
    click AuthMiddleware "https://github.com/scrozza2007/numisroma/blob/main/backend/src/middlewares/authMiddleware.js"
    click AuthRoute "https://github.com/scrozza2007/numisroma/blob/main/backend/src/routes/auth.js"
    click CoinRoute "https://github.com/scrozza2007/numisroma/blob/main/backend/src/routes/coins.js"
    click CoinController "https://github.com/scrozza2007/numisroma/blob/main/backend/src/controllers/coinController.js"
    click CollectionRoute "https://github.com/scrozza2007/numisroma/blob/main/backend/src/routes/collections.js"
    click CollectionController "https://github.com/scrozza2007/numisroma/blob/main/backend/src/controllers/collectionController.js"
    click UserModel "https://github.com/scrozza2007/numisroma/blob/main/backend/src/models/User.js"
    click CoinModel "https://github.com/scrozza2007/numisroma/blob/main/backend/src/models/Coin.js"
    click CollectionModel "https://github.com/scrozza2007/numisroma/blob/main/backend/src/models/Collection.js"
    click Env "https://github.com/scrozza2007/numisroma/blob/main/backend/.env"
    click Package "https://github.com/scrozza2007/numisroma/blob/main/backend/package.json"

    classDef ui fill:#ccf,stroke:#333,stroke-width:1px
    classDef api fill:#cfc,stroke:#333,stroke-width:1px
    classDef logic fill:#c9f,stroke:#333,stroke-width:1px
    classDef data fill:#fc9,stroke:#333,stroke-width:1px
    classDef db fill:#f99,stroke:#333,stroke-width:1px
    classDef config fill:#eee,stroke:#333,stroke-width:1px
```
