# eyelevelai/code-samples architecture

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

- Interactive diagram: https://gitdiagram.com/eyelevelai/code-samples
- Repository: https://github.com/eyelevelai/code-samples

## Overview

##### Project’s nature and purpose
- This is a *monorepo* of assorted code samples: Jupyter notebooks (“notebooks/”), standalone Python demos (“python/”), TypeScript demos (“typescript/”), RAG-battle experiments (“rag-battles/”), plus two larger subprojects under “projects/”:
- A Python-based Relativity database uploader (`relativity-database-uploader/`)
- A full-stack search & completion demo in both Next.js (`search-and-completion-next/`) and a Node.js service (`search-and-completion-node/`)
- There is no single running system; instead each folder represents a self-contained sample or micro-application.

##### File structure to spot architectural patterns
- Top-level groupings:
- notebooks/: data science and RAG-guide notebooks
- projects/relativity-database-uploader: Python CLI + DB modules + Relativity API integration
- projects/search-and-completion-next: Next.js 13 app with React pages + API routes + LLM client services
- projects/search-and-completion-node: Node.js CLI/server invoking LLM services
- python/*, typescript/*: simple demos illustrating environment-based LLM calls
- rag-battles/*: multi-stage RAG experiment pipelines (data ingestion, chunking, retrieval, LLM calls, results/upload)
- Look for sub-components like API layers, service modules, config files, external calls.

##### Extract insights from the README
- The root README is minimal (“# code-samples”)—it simply brands the repo.
- Each subproject often contains its own README pointing out stack, usage, and environment variables.

##### Detail without overthinking
- *all* high-level components, even if they only live in separate folders
- Don’t worry about inter-sample interactions—each is standalone
- How data flows within each sample: entrypoint → modules → external systems → output

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Monorepo root
    Monorepo["code-samples Monorepo"] 

    %% Notebooks
    subgraph "Notebooks"
        NB["Monorepo Notebooks"]:::notebooks
    end

    %% Python Demos
    subgraph "Python Demos"
        PD1["Getting Started Demo"]:::python
        PD2["ChatGPT Completions Demo"]:::python
    end

    %% TypeScript Demos
    subgraph "TypeScript Demos"
        TD1["Getting Started Demo"]:::typescript
        TD2["ChatGPT Completions Demo"]:::typescript
    end

    %% RAG-Battles
    subgraph "RAG-Battles"
        RB1["MPMQA Pipeline"]:::rag
        RB2["Battle 2 Pipeline"]:::rag
        RB3["Battle 3 Pipeline"]:::rag
        RB4["XRay Test Pipeline"]:::rag
    end

    %% Relativity Uploader
    subgraph "Relativity Database Uploader"
        RU["CLI & Modules"]:::python
    end

    %% Search & Completion Next.js
    subgraph "Search & Completion (Next.js)"
        SCN_UI["UI Pages"]:::webapp
        SCN_API["API Routes"]:::webapp
        SCN_SV["Service Modules"]:::webapp
        SCN_CFG["Config Files"]:::webapp
    end

    %% Search & Completion Node.js
    subgraph "Search & Completion (Node.js)"
        SCNode_CLI["CLI/Server Entry"]:::node
        SCNode_CFG["Config Loader"]:::node
        SCNode_SV["Service Modules"]:::node
        SCNode_PC["Package & Config"]:::node
    end

    %% Connections
    Monorepo --> NB
    Monorepo --> PD1
    Monorepo --> PD2
    Monorepo --> TD1
    Monorepo --> TD2
    Monorepo --> RB1
    Monorepo --> RB2
    Monorepo --> RB3
    Monorepo --> RB4
    Monorepo --> RU
    Monorepo --> SCN_UI
    Monorepo --> SCNode_CLI

    %% Click Events
    click NB "https://github.com/eyelevelai/code-samples/tree/main/notebooks/"
    click PD1 "https://github.com/eyelevelai/code-samples/blob/main/python/getting-started/demo.py"
    click PD2 "https://github.com/eyelevelai/code-samples/blob/main/python/chatGPT-completions/demo.py"
    click TD1 "https://github.com/eyelevelai/code-samples/blob/main/typescript/getting-started/demo.js"
    click TD2 "https://github.com/eyelevelai/code-samples/blob/main/typescript/chatGPT-completions/demo.js"
    click RB1 "https://github.com/eyelevelai/code-samples/tree/main/rag-battles/MPMQA/"
    click RB2 "https://github.com/eyelevelai/code-samples/tree/main/rag-battles/rag-battle-2/"
    click RB3 "https://github.com/eyelevelai/code-samples/tree/main/rag-battles/rag-battle-3/"
    click RB4 "https://github.com/eyelevelai/code-samples/tree/main/rag-battles/xray-test/"
    click RU "https://github.com/eyelevelai/code-samples/tree/main/projects/relativity-database-uploader/"
    click SCN_UI "https://github.com/eyelevelai/code-samples/blob/main/projects/search-and-completion-next/src/app/chat/page.tsx"
    click SCN_API "https://github.com/eyelevelai/code-samples/blob/main/projects/search-and-completion-next/src/app/api/search/route.ts"
    click SCN_SV "https://github.com/eyelevelai/code-samples/blob/main/projects/search-and-completion-next/src/app/services/openai.ts"
    click SCN_CFG "https://github.com/eyelevelai/code-samples/blob/main/projects/search-and-completion-next/next.config.mjs"
    click SCNode_CLI "https://github.com/eyelevelai/code-samples/blob/main/projects/search-and-completion-node/src/index.ts"
    click SCNode_CFG "https://github.com/eyelevelai/code-samples/blob/main/projects/search-and-completion-node/src/config.ts"
    click SCNode_SV "https://github.com/eyelevelai/code-samples/blob/main/projects/search-and-completion-node/src/services/openai.ts"
    click SCNode_PC "https://github.com/eyelevelai/code-samples/blob/main/projects/search-and-completion-node/package.json"

    %% Styles
    classDef notebooks fill:#ccffcc,stroke:#333,stroke-width:1px;
    classDef python fill:#ccf2ff,stroke:#333,stroke-width:1px;
    classDef typescript fill:#e6ccff,stroke:#333,stroke-width:1px;
    classDef rag fill:#ffe5cc,stroke:#333,stroke-width:1px;
    classDef webapp fill:#cce5ff,stroke:#333,stroke-width:1px;
    classDef node fill:#e5ccff,stroke:#333,stroke-width:1px;
```
