# stillstream-ink/fintech-api-test architecture

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

- Interactive diagram: https://gitdiagram.com/stillstream-ink/fintech-api-test
- Repository: https://github.com/stillstream-ink/fintech-api-test

## Overview

This repository combines a Flask mock lending service with an API-testing framework. The main user-to-result workflow is to register a customer, check eligibility, create a loan, and exercise or inspect its state through repayment; the service persists customers, loans, and repayment flows. The test framework calls the service through a layered HTTP client and covers functional, boundary, contract, consistency, and state-machine behavior. Locust provides a separate performance-testing branch. Some test and rule implementations were not sampled, so those components are represented at their documented directory or data-file paths; edges reflect README statements or shown calls.

Main entry points: [`api/credit_api.py`](https://github.com/stillstream-ink/fintech-api-test/blob/main/api/credit_api.py) (Credit API client), [`app.py`](https://github.com/stillstream-ink/fintech-api-test/blob/main/app.py) (Flask API), [`conftest.py`](https://github.com/stillstream-ink/fintech-api-test/blob/main/conftest.py) (Service test fixtures), [`tests/test_boundary.py`](https://github.com/stillstream-ink/fintech-api-test/blob/main/tests/test_boundary.py) (Boundary scenarios)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_service["Mock lending service"]
  node_service_app["Flask API<br/>[app.py]"]
  node_eligibility["Eligibility rules<br/>[app.py]"]
  node_loan_lifecycle["Loan lifecycle<br/>[app.py]"]
  node_persistence["SQLAlchemy persistence<br/>[app.py]"]
  node_loan_db[("SQLite database<br/>[app.py]")]
end

subgraph group_client["API client and contracts"]
  node_base_client["HTTP base client<br/>[base_api.py]"]
  node_credit_client["Credit API client<br/>[credit_api.py]"]
  node_compat_client["Legacy client import<br/>[credit_api.py]"]
  node_response_contracts["Response contracts<br/>[credit_schemas.py]"]
end

subgraph group_validation["Test coverage"]
  node_test_setup["Service test fixtures<br/>[conftest.py]"]
  node_functional_tests["Functional and security<br/>[test_credit.py]"]
  node_boundary_tests["Boundary scenarios<br/>[test_boundary.py]"]
  node_eligibility_data["Eligibility test data"]
  node_contract_tests["Contract validation<br/>[test_contract.py]"]
  node_consistency_tests["Database consistency"]
  node_db_helper["Direct DB checks<br/>[db_helper.py]"]
  node_state_tests["State-machine tests"]
end

subgraph group_performance["Performance testing"]
  node_load_user["Locust user<br/>[locustfile.py]"]
  node_load_runner["Load-test runner<br/>[run_load_test.py]"]
  node_load_summary["Performance summary<br/>[summarize_perf.py]"]
end

node_tester(("Engineer / tester"))
node_mock_service(("Mock service"))

node_tester -->|"runs tests"| node_test_setup
node_test_setup -->|"imports client"| node_compat_client
node_compat_client -->|"re-exports"| node_credit_client
node_credit_client -->|"inherits"| node_base_client
node_test_setup -->|"starts service"| node_mock_service
node_credit_client -->|"calls HTTP API"| node_mock_service
node_mock_service -.->|"routes requests"| node_service_app
node_service_app -->|"checks rules"| node_eligibility
node_service_app -->|"handles transitions"| node_loan_lifecycle
node_service_app -->|"uses ORM"| node_persistence
node_persistence -->|"reads and writes"| node_loan_db
node_test_setup -->|"provides fixture"| node_credit_client
node_functional_tests -->|"tests endpoints"| node_credit_client
node_boundary_tests -.->|"loads scenarios"| node_eligibility_data
node_boundary_tests -.->|"tests boundaries"| node_credit_client
node_contract_tests -.->|"validates responses"| node_response_contracts
node_contract_tests -.->|"checks API results"| node_credit_client
node_consistency_tests -.->|"checks API data"| node_credit_client
node_consistency_tests -.->|"checks database"| node_db_helper
node_state_tests -.->|"tests state path"| node_credit_client
node_load_runner -.->|"runs load tasks"| node_load_user
node_load_user -->|"sends load traffic"| node_mock_service
node_load_summary -.->|"summarizes results"| node_load_runner

click node_service_app "https://github.com/stillstream-ink/fintech-api-test/blob/main/app.py"
click node_eligibility "https://github.com/stillstream-ink/fintech-api-test/blob/main/app.py"
click node_loan_lifecycle "https://github.com/stillstream-ink/fintech-api-test/blob/main/app.py"
click node_persistence "https://github.com/stillstream-ink/fintech-api-test/blob/main/app.py"
click node_loan_db "https://github.com/stillstream-ink/fintech-api-test/blob/main/app.py"
click node_base_client "https://github.com/stillstream-ink/fintech-api-test/blob/main/api/base_api.py"
click node_credit_client "https://github.com/stillstream-ink/fintech-api-test/blob/main/api/credit_api.py"
click node_compat_client "https://github.com/stillstream-ink/fintech-api-test/blob/main/credit_api.py"
click node_response_contracts "https://github.com/stillstream-ink/fintech-api-test/blob/main/schemas/credit_schemas.py"
click node_test_setup "https://github.com/stillstream-ink/fintech-api-test/blob/main/conftest.py"
click node_functional_tests "https://github.com/stillstream-ink/fintech-api-test/blob/main/tests/test_credit.py"
click node_boundary_tests "https://github.com/stillstream-ink/fintech-api-test/blob/main/tests/test_boundary.py"
click node_eligibility_data "https://github.com/stillstream-ink/fintech-api-test/blob/main/data/eligibility_age.yaml"
click node_contract_tests "https://github.com/stillstream-ink/fintech-api-test/blob/main/tests/test_contract.py"
click node_consistency_tests "https://github.com/stillstream-ink/fintech-api-test/blob/main/tests/test_db_consistency.py"
click node_db_helper "https://github.com/stillstream-ink/fintech-api-test/blob/main/tests/db_helper.py"
click node_state_tests "https://github.com/stillstream-ink/fintech-api-test/blob/main/tests/test_loan_state_machine.py"
click node_load_user "https://github.com/stillstream-ink/fintech-api-test/blob/main/locustfile.py"
click node_load_runner "https://github.com/stillstream-ink/fintech-api-test/blob/main/scripts/run_load_test.py"
click node_load_summary "https://github.com/stillstream-ink/fintech-api-test/blob/main/scripts/summarize_perf.py"

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_service_app,node_eligibility,node_loan_lifecycle,node_persistence,node_loan_db toneBlue
class node_base_client,node_credit_client,node_compat_client,node_response_contracts toneAmber
class node_test_setup,node_functional_tests,node_boundary_tests,node_eligibility_data,node_contract_tests,node_consistency_tests,node_db_helper,node_state_tests toneMint
class node_load_user,node_load_runner,node_load_summary toneRose
class node_tester,node_mock_service toneIndigo
```

## Components

### Mock lending service

- [Flask API](https://github.com/stillstream-ink/fintech-api-test/blob/main/app.py): `app.py`
- [Eligibility rules](https://github.com/stillstream-ink/fintech-api-test/blob/main/app.py): `app.py`
- [Loan lifecycle](https://github.com/stillstream-ink/fintech-api-test/blob/main/app.py): `app.py`
- [SQLAlchemy persistence](https://github.com/stillstream-ink/fintech-api-test/blob/main/app.py): `app.py`
- [SQLite database](https://github.com/stillstream-ink/fintech-api-test/blob/main/app.py): `app.py`

### API client and contracts

- [HTTP base client](https://github.com/stillstream-ink/fintech-api-test/blob/main/api/base_api.py): `api/base_api.py`
- [Credit API client](https://github.com/stillstream-ink/fintech-api-test/blob/main/api/credit_api.py): `api/credit_api.py`
- [Legacy client import](https://github.com/stillstream-ink/fintech-api-test/blob/main/credit_api.py): `credit_api.py`
- [Response contracts](https://github.com/stillstream-ink/fintech-api-test/blob/main/schemas/credit_schemas.py): `schemas/credit_schemas.py`

### Test coverage

- [Service test fixtures](https://github.com/stillstream-ink/fintech-api-test/blob/main/conftest.py): `conftest.py`
- [Functional and security](https://github.com/stillstream-ink/fintech-api-test/blob/main/tests/test_credit.py): `tests/test_credit.py`
- [Boundary scenarios](https://github.com/stillstream-ink/fintech-api-test/blob/main/tests/test_boundary.py): `tests/test_boundary.py`
- [Eligibility test data](https://github.com/stillstream-ink/fintech-api-test/blob/main/data/eligibility_age.yaml): `data/eligibility_age.yaml`
- [Contract validation](https://github.com/stillstream-ink/fintech-api-test/blob/main/tests/test_contract.py): `tests/test_contract.py`
- [Database consistency](https://github.com/stillstream-ink/fintech-api-test/blob/main/tests/test_db_consistency.py): `tests/test_db_consistency.py`
- [Direct DB checks](https://github.com/stillstream-ink/fintech-api-test/blob/main/tests/db_helper.py): `tests/db_helper.py`
- [State-machine tests](https://github.com/stillstream-ink/fintech-api-test/blob/main/tests/test_loan_state_machine.py): `tests/test_loan_state_machine.py`

### Performance testing

- [Locust user](https://github.com/stillstream-ink/fintech-api-test/blob/main/locustfile.py): `locustfile.py`
- [Load-test runner](https://github.com/stillstream-ink/fintech-api-test/blob/main/scripts/run_load_test.py): `scripts/run_load_test.py`
- [Performance summary](https://github.com/stillstream-ink/fintech-api-test/blob/main/scripts/summarize_perf.py): `scripts/summarize_perf.py`

### Other components

- **Engineer / tester**
- **Mock service**

## Connections

- Engineer / tester → Service test fixtures: runs tests (evidence: `README.md`)
- Service test fixtures → Legacy client import: imports client (evidence: `conftest.py`)
- Legacy client import → Credit API client: re-exports (evidence: `credit_api.py`)
- Credit API client → HTTP base client: inherits (evidence: `api/credit_api.py`)
- Service test fixtures → Mock service: starts service (evidence: `conftest.py`)
- Credit API client → Mock service: calls HTTP API (evidence: `api/credit_api.py`)
- Mock service → Flask API: routes requests (evidence: `README.md`)
- Flask API → Eligibility rules: checks rules (evidence: `app.py`)
- Flask API → Loan lifecycle: handles transitions (evidence: `app.py`)
- Flask API → SQLAlchemy persistence: uses ORM (evidence: `app.py`)
- SQLAlchemy persistence → SQLite database: reads and writes (evidence: `app.py`)
- Service test fixtures → Credit API client: provides fixture (evidence: `conftest.py`)
- Functional and security → Credit API client: tests endpoints (evidence: `README.md`)
- Boundary scenarios → Eligibility test data: loads scenarios (evidence: `README.md`)
- Boundary scenarios → Credit API client: tests boundaries (evidence: `README.md`)
- Contract validation → Response contracts: validates responses (evidence: `README.md`)
- Contract validation → Credit API client: checks API results (evidence: `README.md`)
- Database consistency → Credit API client: checks API data (evidence: `README.md`)
- Database consistency → Direct DB checks: checks database (evidence: `README.md`)
- State-machine tests → Credit API client: tests state path (evidence: `README.md`)
- Load-test runner → Locust user: runs load tasks (evidence: `README.md`)
- Locust user → Mock service: sends load traffic (evidence: `locustfile.py`)
- Performance summary → Load-test runner: summarizes results (evidence: `README.md`)
