# maksim-volosh/found-core-app architecture

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

- Interactive diagram: https://gitdiagram.com/maksim-volosh/found-core-app
- Repository: https://github.com/maksim-volosh/found-core-app

## Overview

FoundCore is a FastAPI backend for a Telegram mini app. The clearest documented workflow is Telegram init-data authentication: the API delegates to an authentication use case, which validates the Telegram payload, finds or creates a user, commits, issues a JWT, and returns user profiles. The tree and composition container also identify profile-management and taxonomy capabilities. Those branches are represented, but their router and use-case interactions are not asserted because their source was not excerpted. Evidence is limited to the provided excerpts and SOURCE INDEX.

Main entry points: [`app/core/composition/container.py`](https://github.com/maksim-volosh/found-core-app/blob/main/app/core/composition/container.py) (Dependency container), [`app/application/use_cases/auth.py`](https://github.com/maksim-volosh/found-core-app/blob/main/app/application/use_cases/auth.py) (Telegram authentication), [`app/main.py`](https://github.com/maksim-volosh/found-core-app/blob/main/app/main.py) (FastAPI app), [`app/api/v1/routers/auth.py`](https://github.com/maksim-volosh/found-core-app/blob/main/app/api/v1/routers/auth.py) (Telegram auth route)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API surface"]
  node_fastapi["FastAPI app<br/>[main.py]"]
  node_api_router["API v1 router<br/>[__init__.py]"]
  node_auth_router["Telegram auth route<br/>[auth.py]"]
  node_profile_routes["Profile routes<br/>[profiles.py]"]
  node_taxonomy_routes["Taxonomy routes<br/>[taxonomy.py]"]
  node_auth_mapper["Auth response mapper<br/>[auth.py]"]
end

subgraph group_application["Application workflows"]
  node_auth_usecase["Telegram authentication<br/>[auth.py]"]
  node_profile_usecases["Profile workflows<br/>[profile.py]"]
  node_taxonomy_usecases["Taxonomy workflows<br/>[taxonomy.py]"]
  node_jwt["JWT service<br/>[jwt_service.py]"]
  node_initdata["Init-data validator"]
  node_content_validator["Profile content validator"]
  node_timezone["Timezone catalog"]
end

subgraph group_domain["Domain rules"]
end

subgraph group_infrastructure["Persistence and runtime"]
  node_container["Dependency container<br/>[container.py]"]
  node_config["Application settings<br/>[config.py]"]
  node_user_repo["User repository<br/>[user.py]"]
  node_profile_repo["Profile repository"]
  node_taxonomy_repo["Taxonomy repository"]
  node_taxonomy_cache["Taxonomy cache"]
  node_uow["Unit of work<br/>[unit_of_work.py]"]
  node_db[("SQL database<br/>[db_helper.py]")]
  node_redis[("Redis<br/>[redis_helper.py]")]
end

node_client(("Mini app client"))
node_telegram(("Telegram"))

node_client -->|"sends requests"| node_fastapi
node_telegram -.->|"provides init data"| node_auth_router
node_fastapi -->|"mounts routes"| node_api_router
node_api_router -->|"registers"| node_auth_router
node_auth_router -->|"executes"| node_auth_usecase
node_auth_usecase -->|"validates"| node_initdata
node_auth_usecase -->|"issues token"| node_jwt
node_auth_usecase -->|"reads and updates"| node_user_repo
node_auth_usecase -->|"lists profiles"| node_profile_repo
node_auth_usecase -->|"commits"| node_uow
node_auth_router -->|"maps result"| node_auth_mapper
node_container -->|"constructs"| node_auth_usecase
node_container -->|"constructs"| node_profile_usecases
node_container -->|"constructs"| node_taxonomy_usecases
node_container -->|"configures"| node_jwt
node_container -->|"constructs"| node_content_validator
node_container -->|"constructs"| node_timezone
node_container -->|"constructs"| node_user_repo
node_container -->|"constructs"| node_profile_repo
node_container -->|"constructs"| node_taxonomy_repo
node_container -->|"constructs"| node_taxonomy_cache
node_fastapi -->|"disposes on shutdown"| node_db
node_fastapi -->|"disposes on shutdown"| node_redis
node_fastapi -->|"reads settings"| node_config
node_profile_routes -.->|"dispatches"| node_profile_usecases
node_taxonomy_routes -.->|"dispatches"| node_taxonomy_usecases

click node_fastapi "https://github.com/maksim-volosh/found-core-app/blob/main/app/main.py"
click node_api_router "https://github.com/maksim-volosh/found-core-app/blob/main/app/api/v1/__init__.py"
click node_auth_router "https://github.com/maksim-volosh/found-core-app/blob/main/app/api/v1/routers/auth.py"
click node_profile_routes "https://github.com/maksim-volosh/found-core-app/blob/main/app/api/v1/routers/profiles.py"
click node_taxonomy_routes "https://github.com/maksim-volosh/found-core-app/blob/main/app/api/v1/routers/taxonomy.py"
click node_auth_mapper "https://github.com/maksim-volosh/found-core-app/blob/main/app/api/v1/mappers/auth.py"
click node_auth_usecase "https://github.com/maksim-volosh/found-core-app/blob/main/app/application/use_cases/auth.py"
click node_profile_usecases "https://github.com/maksim-volosh/found-core-app/blob/main/app/application/use_cases/profile.py"
click node_taxonomy_usecases "https://github.com/maksim-volosh/found-core-app/blob/main/app/application/use_cases/taxonomy.py"
click node_jwt "https://github.com/maksim-volosh/found-core-app/blob/main/app/application/services/jwt_service.py"
click node_initdata "https://github.com/maksim-volosh/found-core-app/blob/main/app/application/services/telegram_init_data.py"
click node_content_validator "https://github.com/maksim-volosh/found-core-app/blob/main/app/application/services/profile_content_validator.py"
click node_timezone "https://github.com/maksim-volosh/found-core-app/blob/main/app/application/services/timezone_catalog.py"
click node_container "https://github.com/maksim-volosh/found-core-app/blob/main/app/core/composition/container.py"
click node_config "https://github.com/maksim-volosh/found-core-app/blob/main/app/core/config.py"
click node_user_repo "https://github.com/maksim-volosh/found-core-app/blob/main/app/infrastructure/repositories/user.py"
click node_profile_repo "https://github.com/maksim-volosh/found-core-app/blob/main/app/infrastructure/repositories/sqlalchemy_profile.py"
click node_taxonomy_repo "https://github.com/maksim-volosh/found-core-app/blob/main/app/infrastructure/repositories/sqlalchemy_taxonomy.py"
click node_taxonomy_cache "https://github.com/maksim-volosh/found-core-app/blob/main/app/infrastructure/repositories/redis_taxonomy_cache.py"
click node_uow "https://github.com/maksim-volosh/found-core-app/blob/main/app/infrastructure/unit_of_work.py"
click node_db "https://github.com/maksim-volosh/found-core-app/blob/main/app/infrastructure/helpers/db_helper.py"
click node_redis "https://github.com/maksim-volosh/found-core-app/blob/main/app/infrastructure/helpers/redis_helper.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_fastapi,node_api_router,node_auth_router,node_profile_routes,node_taxonomy_routes,node_auth_mapper,node_client toneBlue
class node_auth_usecase,node_profile_usecases,node_taxonomy_usecases,node_jwt,node_initdata,node_content_validator,node_timezone toneAmber
class node_container,node_config,node_user_repo,node_profile_repo,node_taxonomy_repo,node_taxonomy_cache,node_uow,node_db,node_redis toneRose
class node_telegram toneIndigo
```

## Components

### API surface

- [FastAPI app](https://github.com/maksim-volosh/found-core-app/blob/main/app/main.py): `app/main.py`
- [API v1 router](https://github.com/maksim-volosh/found-core-app/blob/main/app/api/v1/__init__.py): `app/api/v1/__init__.py`
- [Telegram auth route](https://github.com/maksim-volosh/found-core-app/blob/main/app/api/v1/routers/auth.py): `app/api/v1/routers/auth.py`
- [Profile routes](https://github.com/maksim-volosh/found-core-app/blob/main/app/api/v1/routers/profiles.py): `app/api/v1/routers/profiles.py`
- [Taxonomy routes](https://github.com/maksim-volosh/found-core-app/blob/main/app/api/v1/routers/taxonomy.py): `app/api/v1/routers/taxonomy.py`
- [Auth response mapper](https://github.com/maksim-volosh/found-core-app/blob/main/app/api/v1/mappers/auth.py): `app/api/v1/mappers/auth.py`

### Application workflows

- [Telegram authentication](https://github.com/maksim-volosh/found-core-app/blob/main/app/application/use_cases/auth.py): `app/application/use_cases/auth.py`
- [Profile workflows](https://github.com/maksim-volosh/found-core-app/blob/main/app/application/use_cases/profile.py): `app/application/use_cases/profile.py`
- [Taxonomy workflows](https://github.com/maksim-volosh/found-core-app/blob/main/app/application/use_cases/taxonomy.py): `app/application/use_cases/taxonomy.py`
- [JWT service](https://github.com/maksim-volosh/found-core-app/blob/main/app/application/services/jwt_service.py): `app/application/services/jwt_service.py`
- [Init-data validator](https://github.com/maksim-volosh/found-core-app/blob/main/app/application/services/telegram_init_data.py): `app/application/services/telegram_init_data.py`
- [Profile content validator](https://github.com/maksim-volosh/found-core-app/blob/main/app/application/services/profile_content_validator.py): `app/application/services/profile_content_validator.py`
- [Timezone catalog](https://github.com/maksim-volosh/found-core-app/blob/main/app/application/services/timezone_catalog.py): `app/application/services/timezone_catalog.py`

### Persistence and runtime

- [Dependency container](https://github.com/maksim-volosh/found-core-app/blob/main/app/core/composition/container.py): `app/core/composition/container.py`
- [Application settings](https://github.com/maksim-volosh/found-core-app/blob/main/app/core/config.py): `app/core/config.py`
- [User repository](https://github.com/maksim-volosh/found-core-app/blob/main/app/infrastructure/repositories/user.py): `app/infrastructure/repositories/user.py`
- [Profile repository](https://github.com/maksim-volosh/found-core-app/blob/main/app/infrastructure/repositories/sqlalchemy_profile.py): `app/infrastructure/repositories/sqlalchemy_profile.py`
- [Taxonomy repository](https://github.com/maksim-volosh/found-core-app/blob/main/app/infrastructure/repositories/sqlalchemy_taxonomy.py): `app/infrastructure/repositories/sqlalchemy_taxonomy.py`
- [Taxonomy cache](https://github.com/maksim-volosh/found-core-app/blob/main/app/infrastructure/repositories/redis_taxonomy_cache.py): `app/infrastructure/repositories/redis_taxonomy_cache.py`
- [Unit of work](https://github.com/maksim-volosh/found-core-app/blob/main/app/infrastructure/unit_of_work.py): `app/infrastructure/unit_of_work.py`
- [SQL database](https://github.com/maksim-volosh/found-core-app/blob/main/app/infrastructure/helpers/db_helper.py): `app/infrastructure/helpers/db_helper.py`
- [Redis](https://github.com/maksim-volosh/found-core-app/blob/main/app/infrastructure/helpers/redis_helper.py): `app/infrastructure/helpers/redis_helper.py`

### Other components

- **Mini app client**
- **Telegram**

## Connections

- Mini app client → FastAPI app: sends requests
- Telegram → Telegram auth route: provides init data
- FastAPI app → API v1 router: mounts routes (evidence: `app/main.py`)
- API v1 router → Telegram auth route: registers (evidence: `app/api/v1/__init__.py`)
- Telegram auth route → Telegram authentication: executes (evidence: `app/api/v1/routers/auth.py`)
- Telegram authentication → Init-data validator: validates (evidence: `app/application/use_cases/auth.py`)
- Telegram authentication → JWT service: issues token (evidence: `app/application/use_cases/auth.py`)
- Telegram authentication → User repository: reads and updates (evidence: `app/application/use_cases/auth.py`)
- Telegram authentication → Profile repository: lists profiles (evidence: `app/application/use_cases/auth.py`)
- Telegram authentication → Unit of work: commits (evidence: `app/application/use_cases/auth.py`)
- Telegram auth route → Auth response mapper: maps result (evidence: `app/api/v1/routers/auth.py`)
- Dependency container → Telegram authentication: constructs (evidence: `app/core/composition/container.py`)
- Dependency container → Profile workflows: constructs (evidence: `app/core/composition/container.py`)
- Dependency container → Taxonomy workflows: constructs (evidence: `app/core/composition/container.py`)
- Dependency container → JWT service: configures (evidence: `app/core/composition/container.py`)
- Dependency container → Profile content validator: constructs (evidence: `app/core/composition/container.py`)
- Dependency container → Timezone catalog: constructs (evidence: `app/core/composition/container.py`)
- Dependency container → User repository: constructs (evidence: `app/core/composition/container.py`)
- Dependency container → Profile repository: constructs (evidence: `app/core/composition/container.py`)
- Dependency container → Taxonomy repository: constructs (evidence: `app/core/composition/container.py`)
- Dependency container → Taxonomy cache: constructs (evidence: `app/core/composition/container.py`)
- FastAPI app → SQL database: disposes on shutdown (evidence: `app/main.py`)
- FastAPI app → Redis: disposes on shutdown (evidence: `app/main.py`)
- FastAPI app → Application settings: reads settings (evidence: `app/main.py`)
- Profile routes → Profile workflows: dispatches
- Taxonomy routes → Taxonomy workflows: dispatches
