# hemantgharat/transliteration-api architecture

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

- Interactive diagram: https://gitdiagram.com/hemantgharat/transliteration-api
- Repository: https://github.com/hemantgharat/transliteration-api

## Overview

##### Project type and purpose
- This is a standalone backend API service (no heavy frontend) built with FastAPI and Uvicorn.
- Purpose: accept HTTP requests carrying an ITRANS-encoded word, return its Devanagari transliteration plus fuzzy-matched suggestions from a predefined Hindi word list.

##### File structure
- Top-level files:
- main.py        → FastAPI application definitions and route handlers
- hindi_words.txt → Data source for suggestion engine
- index.html     → Simple static landing page (optional UI/test page)
- requirements.txt → Python dependencies
- Dockerfile/.dockerignore → Containerization for deployment
- .gitignore
- No frontend folder, no database folder: this is a single‐service API.
- Configuration files (Dockerfile) show it’s intended to run in a container.

##### README for additional insights
- Confirms FastAPI + Uvicorn stack
- Uses two core libraries:
- indic-transliteration for script conversion
- rapidfuzz for fuzzy matching suggestions
- Provides one GET endpoint (/transliterate/), expects a “word” query parameter, returns JSON

##### Key advice
- Be detailed but stay focused: capture every moving part (ASGI server, CORS, transliteration lib, suggestion lib).
- Do not over-compartmentalize; this service is small—group related functions together.

## Diagram (Mermaid)

```mermaid
flowchart TD
    Client["HTTP Client / Browser"]:::external
    StaticPage["Static Landing Page (index.html)"]:::external

    Client -->|HTTP GET /transliterate?word| LB["Load Balancer / Reverse Proxy (NGINX)"]:::external
    StaticPage -->|Test UI| Client

    LB --> Uvicorn["Uvicorn ASGI Server"]:::app
    Uvicorn --> FastAPI["FastAPI Application"]:::app
    FastAPI --> CORS["CORS Middleware (Starlette)"]:::app

    subgraph "Business Logic Modules"
        direction TB
        Transliteration["Transliteration Module\n(indic-transliteration)"]:::app
        Suggestion["Suggestion Module\n(rapidfuzz + Loader)"]:::app
    end

    FastAPI --> Transliteration
    FastAPI --> Suggestion
    Suggestion --> HindiWords[(hindi_words.txt)]:::data

    FastAPI -->|JSON Response| Uvicorn
    Uvicorn -->|HTTP Response| LB
    LB -->|HTTP Response| Client

    ExternalDeps["External Dependencies\n(indic-transliteration, rapidfuzz, Pydantic)"]:::external
    ExternalDeps --> Transliteration
    ExternalDeps --> Suggestion
    ExternalDeps --> FastAPI

    subgraph "Dev & Config Files"
        direction TB
        Req["requirements.txt"]:::config
        Docker["Dockerfile/.dockerignore"]:::config
        Gitignore[".gitignore"]:::config
        Readme["README.md"]:::config
    end

    click FastAPI "https://github.com/hemantgharat/transliteration-api/blob/main/main.py"
    click Uvicorn "https://github.com/hemantgharat/transliteration-api/blob/main/main.py"
    click Transliteration "https://github.com/hemantgharat/transliteration-api/blob/main/main.py"
    click Suggestion "https://github.com/hemantgharat/transliteration-api/blob/main/main.py"
    click HindiWords "https://github.com/hemantgharat/transliteration-api/blob/main/hindi_words.txt"
    click StaticPage "https://github.com/hemantgharat/transliteration-api/blob/main/index.html"
    click Req "https://github.com/hemantgharat/transliteration-api/blob/main/requirements.txt"
    click Docker "https://github.com/hemantgharat/transliteration-api/tree/main/Dockerfile"
    click Docker "https://github.com/hemantgharat/transliteration-api/blob/main/.dockerignore"
    click Gitignore "https://github.com/hemantgharat/transliteration-api/blob/main/.gitignore"
    click Readme "https://github.com/hemantgharat/transliteration-api/blob/main/README.md"

    classDef external fill:#a8d5ba,stroke:#333,stroke-width:1px
    classDef app fill:#a0c4ff,stroke:#333,stroke-width:1px
    classDef data fill:#ffec99,stroke:#333,stroke-width:1px
    classDef config fill:#d3d3d3,stroke:#333,stroke-width:1px
```
