# ashheidari/wordrix architecture

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

- Interactive diagram: https://gitdiagram.com/ashheidari/wordrix
- Repository: https://github.com/ashheidari/wordrix

## Overview

##### Main Components
- Client Application:
- Represented by the Angular codebase.
- Contains core UI components (app.component.*, main.ts, etc.) and configuration files (angular.json, etc.).
- Runs within its own Docker container and is orchestrated via Docker Compose.
- Server Application:
- Contains the REST API endpoints (located in the server/app package) to handle requests from the client.
- Includes components for neural network processing (model.py & model-notebook.ipynb) and data extraction (extract-dataset.ipynb).
- Also includes utility functions (utils.py) for setting up and populating the database.
- Runs within its own Docker container, with its container orchestration managed by Docker Compose.
- Database (Implicit component):
- Although not explicitly mentioned as a separate database service, the README and utils.py indicate a database is created/populated by the backend. You may choose to represent it as a dedicated storage component if it is hidden behind the API.
- External Services:
- Docker and Docker Compose act as the deployment and environment management layer for both client and server.

##### Relationships and Interactions
- The Client sends HTTP requests to the Server’s API endpoints to perform operations and fetch data.
- The Server processes these requests, possibly running neural network inferences (using model.py) and returns responses.
- The Server also handles background tasks such as dataset extraction and database initialization.
- Both the client and server containers can be illustrated as separate nodes managed by Docker Compose, highlighting their orchestration and deployment strategy.

##### Important Architectural Patterns
- Separation of Concerns: Clearly splitting the client and server into two distinct codebases and containerized services.
- Microservice-style (Containerized) Deployment: Each part (client and server) is isolated within its own Docker container.
- API-Driven Communication: The client interacts with the backend through RESTful API endpoints.
- Neural Network Integration: Highlight the standalone neural network model building, which is central to the backend’s functionality.

##### Relevant Technologies, Frameworks, and Libraries
- Angular (client-side framework).
- Python (server-side code, REST API).
- Docker and Docker Compose for containerization and deployment.
- Jupyter Notebooks (for interactive development/review of the model and data extraction).
- Likely additional Python libraries for neural networks and web scraping (implied by the model and extract-dataset notebooks).

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Docker Compose"
        subgraph "Angular Client Container"
            AC["Angular Client"]:::client
            AC_UI["Core UI Components"]:::client
            AC_P["Client Packaging"]:::packaging
            AC -->|"UI_Rendering"| AC_UI
            AC -->|"Containerized"| AC_P
        end
        subgraph "Python Server Container"
            PS["Python Server (API & Neural Network)"]:::server
            API["REST API Endpoints"]:::server
            NN["Neural Network Module"]:::server
            DE["Dataset Extraction Module"]:::server
            DBU["Database Utilities"]:::server
            SP["Server Packaging"]:::packaging
            PS -->|"HandlesRequests"| API
            API -->|"ModelInference"| NN
            API -->|"DataExtraction"| DE
            API -->|"DBOps"| DBU
            PS -->|"Containerized"| SP
        end
    end
    DB["Database (Storage)"]:::database

    %% Cross-container interactions
    AC -->|"HTTP/REST_API"| API
    DBU -->|"Updates_DB"| DB

    %% Styles
    classDef client fill:#add8e6,stroke:#333,stroke-width:2px;
    classDef server fill:#90ee90,stroke:#333,stroke-width:2px;
    classDef packaging fill:#ffcc99,stroke:#333,stroke-width:2px;
    classDef database fill:#ffffcc,stroke:#333,stroke-width:2px;

    %% Click Events for Angular Client Components
    click AC "https://github.com/ashheidari/wordrix/tree/main/client/"
    click AC_UI "https://github.com/ashheidari/wordrix/blob/main/client/angular.json"
    click AC_P "https://github.com/ashheidari/wordrix/tree/main/client/Dockerfile"
    click AC_UI "https://github.com/ashheidari/wordrix/blob/main/client/src/app/app.component.html"
    click AC_UI "https://github.com/ashheidari/wordrix/blob/main/client/src/app/app.component.ts"
    click AC_UI "https://github.com/ashheidari/wordrix/blob/main/client/src/app/app.module.ts"
    click AC_UI "https://github.com/ashheidari/wordrix/blob/main/client/src/main.ts"
    click AC_P "https://github.com/ashheidari/wordrix/blob/main/client/docker-compose.yml"

    %% Click Events for Python Server Components
    click PS "https://github.com/ashheidari/wordrix/tree/main/server/app/"
    click API "https://github.com/ashheidari/wordrix/blob/main/server/app/main.py"
    click NN "https://github.com/ashheidari/wordrix/blob/main/server/model.py"
    click NN "https://github.com/ashheidari/wordrix/blob/main/server/model-notebook.ipynb"
    click DE "https://github.com/ashheidari/wordrix/blob/main/server/extract_dataset.ipynb"
    click DBU "https://github.com/ashheidari/wordrix/blob/main/server/utils.py"
    click DBU "https://github.com/ashheidari/wordrix/blob/main/server/app/database.py"
    click SP "https://github.com/ashheidari/wordrix/tree/main/server/Dockerfile"
    click SP "https://github.com/ashheidari/wordrix/blob/main/server/docker-compose.yml"
```
