# nitasheu/mindory architecture

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

- Interactive diagram: https://gitdiagram.com/nitasheu/mindory
- Repository: https://github.com/nitasheu/mindory

## Overview

##### Project Type and Purpose
- Mindory is a full-stack web application.
- The frontend is built with Vue.js 3 (using the Composition API, Vite, and Tailwind CSS) and focuses on interactive UI (components, pages, modules, and state management via Pinia).
- The backend is implemented in NestJS, following a module-based architecture which organizes business logic into feature-specific modules (e.g., auth, code-processing, repositories, user) and includes common utilities (custom decorators, filters, pipes, and services).
- The project leverages Supabase for data storage as well as real-time features, evident from the dedicated supabase/migrations folder.

##### Major Architectural Components
a. Frontend Application:
- Contains directories for components, modules (auth, dashboard, profile, repositories, etc.), pages, router, and store.
- Uses Vue Router for navigation and Pinia for state management.
- Responsibilities include rendering the interactive visualization of codebases, handling user interactions, authentication, and making API requests to the backend.

b. Backend Application:
- Built with NestJS and divided into several modules (e.g., authentication, code-processing, repositories, user).
- Includes common shared modules (custom decorators, guards, filters, interceptors, pipes) and configuration modules (for connecting to Supabase, Neo4j, and other services).
- Manages API endpoints, business logic, authentication (using custom JWT guards, DTO validations), and integrates with external services like Supabase for real-time data operations.
- Swagger is used for API documentation, making the backend contract clear for frontend integration.

c. Database Layer:
- Uses Supabase as the primary database provider with SQL migrations maintained under supabase/migrations.
- The backend includes database-specific modules and services that directly interact with these data stores.

##### Relationships and Interactions
- Showing intra-backend interactions, such as how common modules (e.g., DTOs, custom decorators) support multiple feature modules.
- Optionally, include the API Documentation service (Swagger) as a component that sits adjacent to the backend to indicate clear endpoint contracts.

##### Highlighting Architectural Patterns and Technologies
- For the Frontend:
- Module-based architecture, state management, lazy-loaded routes, and the use of the Composition API.
- That components, views, and state modules interact to render a responsive UI.
- For the Backend:
- NestJS’s module-based architecture, dependency injection, and use of decorators for routing and authentication.
- Detail the segregation of concerns: controllers handle routing, services encapsulate business logic, and modules group related functionality.
- Use of DTOs for validation and Swagger for API docs.
- For the Database:
- That Supabase is used for both storage and real-time functionalities, together with SQL migration scripts to manage data schema changes.

## Diagram (Mermaid)

```mermaid
graph TD
  %% Frontend Application Subgraph
  subgraph "Frontend Application (Vue.js)"
    FE_R["Frontend Root (Vue.js)"]
    F1["Reusable UI Components"]
    F2["Feature Modules (Auth,Dashboard,Profile,Repositories)"]
    F3["Pages"]
    F4["Routing (Vue Router)"]
    F5["State Management (Pinia)"]
    F6["Store Modules (Pinia)"]
    FE_R --> F1
    FE_R --> F2
    FE_R --> F3
    FE_R --> F4
    FE_R --> F5
    F5 --> F6
  end

  %% Backend API Service Subgraph
  subgraph "Backend API Service (NestJS)"
    BR["Backend Root (NestJS)"]
    %% Modules
    subgraph "Modules"
      B1["Auth Module"]
      B2["Code-Processing Module"]
      B3["Codebase-Input Module"]
      B4["Embeddings Module"]
      B5["Repositories Module"]
      B6["User Module"]
    end
    %% Common Utilities
    subgraph "Common Utilities"
      C1["Custom Decorators"]
      C2["Error Filters"]
      C3["Guards"]
      C4["Interceptors"]
      C5["Pipes"]
      C6["Common Services"]
    end
    %% Configuration
    subgraph "Configuration"
      D1["LanceDB Config"]
      D2["Neo4j Config"]
      D3["Supabase Config"]
    end
    %% Database Module & Migrations
    subgraph "Database Module & Migrations"
      E1["Database Module"]
      E2["Migrations"]
    end
    FDoc["API Documentation (Swagger)"]
    
    %% Connections within Backend
    BR -->|"contains"| B1
    BR -->|"contains"| C1
    BR -->|"contains"| D1
    BR -->|"contains"| E1
    BR -->|"has"| FDoc
  end

  %% Database Subgraph
  subgraph "Database (Supabase)"
    DB1["Supabase Migrations"]
  end

  %% External Communication
  FE_R ---|"API_calls"| BR
  BR ---|"Data_transactions"| DB1

  %% Styling Classes
  class FE_R,F1,F2,F3,F4,F5,F6 frontend
  class BR,B1,B2,B3,B4,B5,B6,C1,C2,C3,C4,C5,C6,D1,D2,D3,E1,E2,FDoc backend
  class DB1 database

  classDef frontend fill:#ADD8E6,stroke:#000,stroke-width:2px;
  classDef backend fill:#90EE90,stroke:#000,stroke-width:2px;
  classDef database fill:#FFB6C1,stroke:#000,stroke-width:2px;

click FE_R "https://github.com/nitasheu/mindory/tree/main/frontend/"
click F1 "https://github.com/nitasheu/mindory/tree/main/frontend/src/components/"
click F2 "https://github.com/nitasheu/mindory/tree/main/frontend/src/modules/"
click F3 "https://github.com/nitasheu/mindory/tree/main/frontend/src/pages/"
click F4 "https://github.com/nitasheu/mindory/blob/main/frontend/src/router/index.ts"
click F5 "https://github.com/nitasheu/mindory/tree/main/frontend/src/store/"
click F6 "https://github.com/nitasheu/mindory/tree/main/frontend/src/store/modules/"

click BR "https://github.com/nitasheu/mindory/tree/main/backend/"
click B1 "https://github.com/nitasheu/mindory/tree/main/backend/src/modules/auth/"
click B2 "https://github.com/nitasheu/mindory/tree/main/backend/src/modules/code-processing/"
click B3 "https://github.com/nitasheu/mindory/tree/main/backend/src/modules/codebase-input/"
click B4 "https://github.com/nitasheu/mindory/tree/main/backend/src/modules/embeddings/"
click B5 "https://github.com/nitasheu/mindory/tree/main/backend/src/modules/repositories/"
click B6 "https://github.com/nitasheu/mindory/tree/main/backend/src/modules/user/"

click C1 "https://github.com/nitasheu/mindory/tree/main/backend/src/common/decorators/"
click C2 "https://github.com/nitasheu/mindory/tree/main/backend/src/common/filters/"
click C3 "https://github.com/nitasheu/mindory/tree/main/backend/src/common/guards/"
click C4 "https://github.com/nitasheu/mindory/tree/main/backend/src/common/interceptors/"
click C5 "https://github.com/nitasheu/mindory/tree/main/backend/src/common/pipes/"
click C6 "https://github.com/nitasheu/mindory/tree/main/backend/src/common/services/"

click D1 "https://github.com/nitasheu/mindory/blob/main/backend/src/config/lancedb.config.ts"
click D2 "https://github.com/nitasheu/mindory/blob/main/backend/src/config/neo4j.config.ts"
click D3 "https://github.com/nitasheu/mindory/blob/main/backend/src/config/supabase.config.ts"

click E1 "https://github.com/nitasheu/mindory/blob/main/backend/src/database/database.module.ts"
click E2 "https://github.com/nitasheu/mindory/tree/main/backend/src/database/migrations/"

click FDoc "https://github.com/nitasheu/mindory/blob/main/swagger.json"

click DB1 "https://github.com/nitasheu/mindory/tree/main/supabase/migrations/"
```
