# flickleafy/perfinper-api architecture

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

- Interactive diagram: https://gitdiagram.com/flickleafy/perfinper-api
- Repository: https://github.com/flickleafy/perfinper-api

## Overview

##### Project type and purpose
- From the README (“perfinper-api: Personal Finance Helper API”) and the presence of an `src/index.js`, `routes/`, `services/`, `models/` directories, we can tell this is a backend RESTful API built with Node.js (likely using Express).
- Its job is to expose endpoints around personal-finance operations (e.g., transactions) and persist data in a database.

##### File structure
- Top‐level files:
- `package.json` / `package-lock.json` → lists dependencies (Express, any ORM, etc.)
- `db_installer.sh` → bootstraps the database or schema
- `.github/workflows/…` → CI/CD security and quality scanning
- `src/` directory structure:
- `config/logger.js` → logging configuration
- `index.js` → application entry point (sets up Express app, middleware, routes)
- `routes/routes.js` → defines HTTP routes and mounts controllers or service handlers
- `services/transactionService.js` → business-logic layer for transaction operations
- `models/TransactionModel.js` → data-access layer or ORM model for transactions

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "Client Layer"
        Client["API Clients"]:::external
    end
    Client -->|"HTTP Request"| Gateway["API Gateway / Load Balancer"]:::external

    subgraph "Express Application"
        Config["Logger / Config Module"]:::config
        Routes["Router Layer"]:::routes
        Service["TransactionService"]:::service
        Model["TransactionModel"]:::model
    end

    Gateway -->|"Routes Request"| Routes
    Routes -->|"calls Business Logic"| Service
    Service -->|"invokes Data Access"| Model
    Model -->|"SQL/NoSQL Query"| Database["Database"]:::database
    Database -->|"Query Response"| Model
    Model -->|"returns Data"| Service
    Service -->|"response"| Routes
    Routes -->|"HTTP Response"| Gateway
    Gateway -->|"HTTP Response"| Client

    DatabaseInstaller["DB Installer Script"]:::tooling
    CI["CI/CD & Security Scanning"]:::tooling

    CI -.->|"runs on commit"| Config
    CI -.->|"runs on commit"| Routes
    CI -.->|"runs on commit"| Service
    CI -.->|"runs on commit"| Model
    CI -.->|"runs on commit"| DatabaseInstaller

    click Config "https://github.com/flickleafy/perfinper-api/blob/master/src/config/logger.js"
    click Routes "https://github.com/flickleafy/perfinper-api/blob/master/src/routes/routes.js"
    click Service "https://github.com/flickleafy/perfinper-api/blob/master/src/services/transactionService.js"
    click Model "https://github.com/flickleafy/perfinper-api/blob/master/src/models/TransactionModel.js"
    click DatabaseInstaller "https://github.com/flickleafy/perfinper-api/blob/master/db_installer.sh"
    click CI "https://github.com/flickleafy/perfinper-api/tree/master/.github/workflows/"

    classDef external fill:#8dd3c7,stroke:#333,stroke-width:1px
    classDef config fill:#b3cde3,stroke:#333,stroke-width:1px
    classDef routes fill:#b3cde3,stroke:#333,stroke-width:1px
    classDef service fill:#b3cde3,stroke:#333,stroke-width:1px
    classDef model fill:#b3cde3,stroke:#333,stroke-width:1px
    classDef database fill:#ccebc5,stroke:#333,stroke-width:1px
    classDef tooling fill:#d9d9d9,stroke:#333,stroke-width:1px
```
