# joferdev2022/frontend_litmap_ai_tool architecture

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

- Interactive diagram: https://gitdiagram.com/joferdev2022/frontend_litmap_ai_tool
- Repository: https://github.com/joferdev2022/frontend_litmap_ai_tool

## Overview

1. **Repository scope**
   - This is the **frontend-only** part of LitMap AI.
   - It is an **Angular 16** single-page application that acts as the user interface for a literature-mapping workflow, while delegating document processing and analysis to a separate **FastAPI backend**.

2. **Overall application shape**
   - The app is organized around a root Angular shell, a shared UI layer, and several feature pages.
   - The main user flow is: **home/start → categorization → results**, with a persistent navigation shell around the routed content.

3. **Bootstrap and root composition**
   - `main.ts` boots the Angular app.
   - `AppModule` and `AppComponent` form the application root.
   - `AppComponent` is the top-level container that likely hosts the global layout and the router outlet.

4. **Routing structure**
   - Routing is split into a root routing module plus feature routing modules.
   - `pages-routing.module.ts` acts as the main feature entry point for page navigation.
   - Each feature page has its own routing module:
     - `home-routing.module.ts`
     - `categorization-routing.module.ts`
     - `results-routing.module.ts`
   - This indicates **route-level modularization**, which helps separate page concerns and supports lazy-loading or isolated feature bundles.

5. **Feature modules**
   - The main pages are split into dedicated Angular modules:
     - `HomeModule`
     - `CategorizationModule`
     - `ResultsModule`
     - `PagesModule`
   - These modules isolate each stage of the workflow and keep page-specific logic separate from shared UI.

6. **Shared UI components**
   - Reusable UI is grouped under `src/app/components`.
   - The key shared components are:
     - `NavbarComponent`
     - `SidebarComponent`
   - `ComponentsModule` likely exports these shared building blocks so they can be used across pages.
   - This suggests a classic **shell + feature content** architecture: the shell provides global navigation, while routed pages fill the main area.

7. **Page responsibilities**
   - `HomeComponent` is the entry point for the user journey, likely introducing the tool and starting the process.
   - `CategorizationComponent` appears to represent the document-classification or screening step in the systematic mapping workflow.
   - `ResultsComponent` is the output/visualization step where analysis outcomes are displayed.
   - `PagesComponent` likely acts as a wrapper or container around the routed pages.

8. **State and data flow**
   - The only service present is `AnswersService`.
   - This suggests that shared state or workflow data is centralized in one Angular service, probably used to pass user inputs, document selections, or classification results between pages.
   - Data flow is likely:
     - user actions in page components
     - shared state updates via `AnswersService`
     - backend/API communication for analysis
     - results rendered in the results page

9. **Backend boundary**
   - The frontend is explicitly integrated with a **REST API built in FastAPI**.
   - The boundary is clear: Angular handles interaction, navigation, and visualization; the backend handles the AI/document-processing logic.
   - No backend code is included here, so the architecture diagram should show the backend as an external service consumed by the frontend.

10. **Assets and presentation layer**
   - Static assets live under `src/assets`, including category-related images.
   - Global styling is in `styles.scss`, while component-level styles are colocated with each component.
   - This separation supports a presentation layer composed of reusable shell components and feature-specific page styling.

11. **Deployment and runtime**
   - The app runs in the browser after being built with the Angular toolchain.
   - Development uses the standard Angular CLI flow (`ng serve`).
   - The README mentions a deployed frontend on **Vercel**, so the client is likely hosted as static assets behind a managed frontend deployment platform.

12. **What is not in this repo**
   - There is no server, database, job queue, or ML pipeline in this repository.
   - Those responsibilities are externalized to the FastAPI backend and any services it calls.
   - For an architecture diagram, the frontend should be shown as a **presentation and orchestration layer**, not as the system of record or processing engine.

13. **Best diagram boundaries**
   - Draw the system as:
     - **Browser / Angular SPA**
     - inside it: **App shell**, **shared components**, **feature pages**, **shared service**
     - outside it: **FastAPI backend API**
   - The primary interaction path is user-driven and route-driven, with the frontend coordinating workflow steps and presenting backend-generated outcomes.

Main entry points: [`src/app/pages/pages-routing.module.ts`](https://github.com/joferdev2022/frontend_litmap_ai_tool/blob/master/src/app/pages/pages-routing.module.ts) (Pages Routing), [`src/app/app.module.ts`](https://github.com/joferdev2022/frontend_litmap_ai_tool/blob/master/src/app/app.module.ts) (AppModule), [`src/app/app.component.ts`](https://github.com/joferdev2022/frontend_litmap_ai_tool/blob/master/src/app/app.component.ts) (AppComponent), [`src/app/components/components.module.ts`](https://github.com/joferdev2022/frontend_litmap_ai_tool/blob/master/src/app/components/components.module.ts) (ComponentsModule)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_g_app["App shell"]
  node_n_main["main.ts<br/>bootstrap<br/>[main.ts]"]
  node_n_app_module["AppModule<br/>[app.module.ts]"]
  node_n_app_component["AppComponent<br/>shell<br/>[app.component.ts]"]
  node_n_app_routing["App Routing"]
end

subgraph group_g_shared["Shared UI"]
  node_n_components_module["ComponentsModule"]
  node_n_navbar["Navbar<br/>ui component"]
  node_n_sidebar["Sidebar<br/>ui component"]
  node_n_answers_service[("AnswersService<br/>state service<br/>[answers.service.ts]")]
end

subgraph group_g_pages["Pages"]
  node_n_pages_module["PagesModule<br/>[pages.module.ts]"]
  node_n_pages_routing["Pages Routing"]
  node_n_pages_component["PagesComponent<br/>page shell<br/>[pages.component.ts]"]
  node_n_home_module["HomeModule<br/>[home.module.ts]"]
  node_n_home_routing["Home Routing"]
  node_n_home_component["HomeComponent<br/>page<br/>[home.component.ts]"]
  node_n_cat_module["CategorizationModule"]
  node_n_cat_routing["Categorization Routing"]
  node_n_cat_component["CategorizationComponent<br/>page"]
  node_n_res_module["ResultsModule<br/>[results.module.ts]"]
  node_n_res_routing["Results Routing"]
  node_n_res_component["ResultsComponent<br/>page"]
end

subgraph group_g_external["External API"]
  node_n_backend[("FastAPI API<br/>external backend")]
end

node_n_main -->|"boots"| node_n_app_module
node_n_app_module -->|"declares"| node_n_app_component
node_n_app_module -->|"imports"| node_n_app_routing
node_n_app_component -->|"uses"| node_n_components_module
node_n_app_component -->|"hosts"| node_n_pages_component
node_n_app_routing -->|"delegates"| node_n_pages_routing
node_n_pages_module -->|"declares"| node_n_pages_component
node_n_pages_module -->|"imports"| node_n_pages_routing
node_n_pages_routing -->|"routes to"| node_n_home_module
node_n_pages_routing -->|"routes to"| node_n_cat_module
node_n_pages_routing -->|"routes to"| node_n_res_module
node_n_home_module -->|"declares"| node_n_home_component
node_n_home_module -->|"imports"| node_n_home_routing
node_n_cat_module -->|"declares"| node_n_cat_component
node_n_cat_module -->|"imports"| node_n_cat_routing
node_n_res_module -->|"declares"| node_n_res_component
node_n_res_module -->|"imports"| node_n_res_routing
node_n_components_module -->|"exports"| node_n_navbar
node_n_components_module -->|"exports"| node_n_sidebar
node_n_home_component -->|"reads/writes"| node_n_answers_service
node_n_cat_component -->|"reads/writes"| node_n_answers_service
node_n_res_component -->|"reads"| node_n_answers_service
node_n_cat_component -->|"calls"| node_n_backend
node_n_res_component -->|"fetches"| node_n_backend

click node_n_main "https://github.com/joferdev2022/frontend_litmap_ai_tool/blob/master/src/main.ts"
click node_n_app_module "https://github.com/joferdev2022/frontend_litmap_ai_tool/blob/master/src/app/app.module.ts"
click node_n_app_component "https://github.com/joferdev2022/frontend_litmap_ai_tool/blob/master/src/app/app.component.ts"
click node_n_app_routing "https://github.com/joferdev2022/frontend_litmap_ai_tool/blob/master/src/app/app-routing.module.ts"
click node_n_pages_module "https://github.com/joferdev2022/frontend_litmap_ai_tool/blob/master/src/app/pages/pages.module.ts"
click node_n_pages_routing "https://github.com/joferdev2022/frontend_litmap_ai_tool/blob/master/src/app/pages/pages-routing.module.ts"
click node_n_pages_component "https://github.com/joferdev2022/frontend_litmap_ai_tool/blob/master/src/app/pages/pages.component.ts"
click node_n_home_module "https://github.com/joferdev2022/frontend_litmap_ai_tool/blob/master/src/app/pages/home/home.module.ts"
click node_n_home_routing "https://github.com/joferdev2022/frontend_litmap_ai_tool/blob/master/src/app/pages/home/home-routing.module.ts"
click node_n_home_component "https://github.com/joferdev2022/frontend_litmap_ai_tool/blob/master/src/app/pages/home/home.component.ts"
click node_n_cat_module "https://github.com/joferdev2022/frontend_litmap_ai_tool/blob/master/src/app/pages/categorization/categorization.module.ts"
click node_n_cat_routing "https://github.com/joferdev2022/frontend_litmap_ai_tool/blob/master/src/app/pages/categorization/categorization-routing.module.ts"
click node_n_cat_component "https://github.com/joferdev2022/frontend_litmap_ai_tool/blob/master/src/app/pages/categorization/categorization.component.ts"
click node_n_res_module "https://github.com/joferdev2022/frontend_litmap_ai_tool/blob/master/src/app/pages/results/results.module.ts"
click node_n_res_routing "https://github.com/joferdev2022/frontend_litmap_ai_tool/blob/master/src/app/pages/results/results-routing.module.ts"
click node_n_res_component "https://github.com/joferdev2022/frontend_litmap_ai_tool/blob/master/src/app/pages/results/results.component.ts"
click node_n_components_module "https://github.com/joferdev2022/frontend_litmap_ai_tool/blob/master/src/app/components/components.module.ts"
click node_n_navbar "https://github.com/joferdev2022/frontend_litmap_ai_tool/blob/master/src/app/components/navbar/navbar.component.ts"
click node_n_sidebar "https://github.com/joferdev2022/frontend_litmap_ai_tool/blob/master/src/app/components/sidebar/sidebar.component.ts"
click node_n_answers_service "https://github.com/joferdev2022/frontend_litmap_ai_tool/blob/master/src/app/services/answers.service.ts"

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_n_main,node_n_app_module,node_n_app_component,node_n_app_routing toneBlue
class node_n_components_module,node_n_navbar,node_n_sidebar,node_n_answers_service toneAmber
class node_n_pages_module,node_n_pages_routing,node_n_pages_component,node_n_home_module,node_n_home_routing,node_n_home_component,node_n_cat_module,node_n_cat_routing,node_n_cat_component,node_n_res_module,node_n_res_routing,node_n_res_component toneMint
class node_n_backend toneRose
```

## Components

### App shell

Root Angular bootstrap and global layout

- [main.ts](https://github.com/joferdev2022/frontend_litmap_ai_tool/blob/master/src/main.ts): bootstrap · Angular entry point · `src/main.ts`
- [AppModule](https://github.com/joferdev2022/frontend_litmap_ai_tool/blob/master/src/app/app.module.ts): module · Root application module · `src/app/app.module.ts`
- [AppComponent](https://github.com/joferdev2022/frontend_litmap_ai_tool/blob/master/src/app/app.component.ts): shell · Top-level app container · `src/app/app.component.ts`
- [App Routing](https://github.com/joferdev2022/frontend_litmap_ai_tool/blob/master/src/app/app-routing.module.ts): routing · Root router configuration · `src/app/app-routing.module.ts`

### Shared UI

Reusable presentation components

- [ComponentsModule](https://github.com/joferdev2022/frontend_litmap_ai_tool/blob/master/src/app/components/components.module.ts): module · Shared UI exports · `src/app/components/components.module.ts`
- [Navbar](https://github.com/joferdev2022/frontend_litmap_ai_tool/blob/master/src/app/components/navbar/navbar.component.ts): ui component · Top navigation bar · `src/app/components/navbar/navbar.component.ts`
- [Sidebar](https://github.com/joferdev2022/frontend_litmap_ai_tool/blob/master/src/app/components/sidebar/sidebar.component.ts): ui component · Persistent side navigation · `src/app/components/sidebar/sidebar.component.ts`
- [AnswersService](https://github.com/joferdev2022/frontend_litmap_ai_tool/blob/master/src/app/services/answers.service.ts): state service · Shared workflow state · `src/app/services/answers.service.ts`

### Pages

Route-driven workflow stages

- [PagesModule](https://github.com/joferdev2022/frontend_litmap_ai_tool/blob/master/src/app/pages/pages.module.ts): module · Feature container for routed pages · `src/app/pages/pages.module.ts`
- [Pages Routing](https://github.com/joferdev2022/frontend_litmap_ai_tool/blob/master/src/app/pages/pages-routing.module.ts): routing · Main page routing entry · `src/app/pages/pages-routing.module.ts`
- [PagesComponent](https://github.com/joferdev2022/frontend_litmap_ai_tool/blob/master/src/app/pages/pages.component.ts): page shell · Wrapper around routed pages · `src/app/pages/pages.component.ts`
- [HomeModule](https://github.com/joferdev2022/frontend_litmap_ai_tool/blob/master/src/app/pages/home/home.module.ts): module · Home page feature module · `src/app/pages/home/home.module.ts`
- [Home Routing](https://github.com/joferdev2022/frontend_litmap_ai_tool/blob/master/src/app/pages/home/home-routing.module.ts): routing · Home route definition · `src/app/pages/home/home-routing.module.ts`
- [HomeComponent](https://github.com/joferdev2022/frontend_litmap_ai_tool/blob/master/src/app/pages/home/home.component.ts): page · Start page for the workflow · `src/app/pages/home/home.component.ts`
- [CategorizationModule](https://github.com/joferdev2022/frontend_litmap_ai_tool/blob/master/src/app/pages/categorization/categorization.module.ts): module · Categorization feature module · `src/app/pages/categorization/categorization.module.ts`
- [Categorization Routing](https://github.com/joferdev2022/frontend_litmap_ai_tool/blob/master/src/app/pages/categorization/categorization-routing.module.ts): routing · Categorization route definition · `src/app/pages/categorization/categorization-routing.module.ts`
- [CategorizationComponent](https://github.com/joferdev2022/frontend_litmap_ai_tool/blob/master/src/app/pages/categorization/categorization.component.ts): page · Screening and classification step · `src/app/pages/categorization/categorization.component.ts`
- [ResultsModule](https://github.com/joferdev2022/frontend_litmap_ai_tool/blob/master/src/app/pages/results/results.module.ts): module · Results feature module · `src/app/pages/results/results.module.ts`
- [Results Routing](https://github.com/joferdev2022/frontend_litmap_ai_tool/blob/master/src/app/pages/results/results-routing.module.ts): routing · Results route definition · `src/app/pages/results/results-routing.module.ts`
- [ResultsComponent](https://github.com/joferdev2022/frontend_litmap_ai_tool/blob/master/src/app/pages/results/results.component.ts): page · Output and visualization page · `src/app/pages/results/results.component.ts`

### External API

Backend boundary outside this repository

- **FastAPI API**: external backend · Document processing and analysis backend

## Connections

- main.ts → AppModule: boots · Angular bootstrap into root module
- AppModule → AppComponent: declares · Root module hosts the top-level shell
- AppModule → App Routing: imports · Connects application routing
- AppComponent → ComponentsModule: uses · Shell composes shared navigation UI
- AppComponent → PagesComponent: hosts · Router outlet renders page wrapper
- App Routing → Pages Routing: delegates · Root routes forward to page routes
- PagesModule → PagesComponent: declares · Page container module
- PagesModule → Pages Routing: imports · Feature routing for pages
- Pages Routing → HomeModule: routes to · Home route loads the home feature
- Pages Routing → CategorizationModule: routes to · Categorization route loads the workflow step
- Pages Routing → ResultsModule: routes to · Results route loads the output view
- HomeModule → HomeComponent: declares · Home page module
- HomeModule → Home Routing: imports · Home route configuration
- CategorizationModule → CategorizationComponent: declares · Categorization page module
- CategorizationModule → Categorization Routing: imports · Categorization route configuration
- ResultsModule → ResultsComponent: declares · Results page module
- ResultsModule → Results Routing: imports · Results route configuration
- ComponentsModule → Navbar: exports · Shared top navigation component
- ComponentsModule → Sidebar: exports · Shared side navigation component
- HomeComponent → AnswersService: reads/writes · Starts workflow state
- CategorizationComponent → AnswersService: reads/writes · Stores categorization progress
- ResultsComponent → AnswersService: reads · Consumes shared answers and results state
- CategorizationComponent → FastAPI API: calls · Sends documents for processing
- ResultsComponent → FastAPI API: fetches · Loads analysis outcomes for display
