# rgsharma745/csv-to-db architecture

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

- Interactive diagram: https://gitdiagram.com/rgsharma745/csv-to-db
- Repository: https://github.com/rgsharma745/csv-to-db

## Overview

This command-line Spring Boot utility migrates CSV files into PostgreSQL: startup invokes a loader, which discovers CSV files, parses headers and records, recreates a text-column table for each file, and batch-inserts its rows. The loader also normalizes table and column names through a shared utility. PostgreSQL is the durable destination; CSV and database are external to the repository. The README documents the migration capabilities, while the excerpts show their implementation concentrated in one loader class; no separate error-handling subsystem is evident.

Main entry points: [`src/main/java/com/rgsharma745/CsvToDbTable.java`](https://github.com/rgsharma745/csv-to-db/blob/main/src/main/java/com/rgsharma745/CsvToDbTable.java) (CSV loader), [`src/main/java/com/rgsharma745/CsvToDbApplication.java`](https://github.com/rgsharma745/csv-to-db/blob/main/src/main/java/com/rgsharma745/CsvToDbApplication.java) (Application entry), [`src/main/java/com/rgsharma745/Utils.java`](https://github.com/rgsharma745/csv-to-db/blob/main/src/main/java/com/rgsharma745/Utils.java) (Name normalizer)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Application runtime"]
  node_application["Application entry"]
end

subgraph group_migration["CSV migration"]
  node_loader["CSV loader<br/>[CsvToDbTable.java]"]
  node_csv_files["CSV files"]
  node_csv_parser["CSV parser"]
  node_name_normalizer["Name normalizer<br/>[Utils.java]"]
end

subgraph group_storage["Database storage"]
  node_postgres[("PostgreSQL")]
end

node_operator(("Operator"))

node_operator -->|"starts"| node_application
node_application -->|"invokes loading"| node_loader
node_csv_files -->|"reads files"| node_loader
node_loader -->|"parses CSV"| node_csv_parser
node_loader -->|"normalizes names"| node_name_normalizer
node_loader -->|"drops tables"| node_postgres
node_loader -->|"creates tables"| node_postgres
node_loader -->|"batch inserts"| node_postgres

click node_application "https://github.com/rgsharma745/csv-to-db/blob/main/src/main/java/com/rgsharma745/CsvToDbApplication.java"
click node_loader "https://github.com/rgsharma745/csv-to-db/blob/main/src/main/java/com/rgsharma745/CsvToDbTable.java"
click node_name_normalizer "https://github.com/rgsharma745/csv-to-db/blob/main/src/main/java/com/rgsharma745/Utils.java"

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_application toneBlue
class node_loader,node_csv_files,node_csv_parser,node_name_normalizer toneAmber
class node_postgres toneMint
class node_operator toneIndigo
```

## Components

### Application runtime

- [Application entry](https://github.com/rgsharma745/csv-to-db/blob/main/src/main/java/com/rgsharma745/CsvToDbApplication.java): `src/main/java/com/rgsharma745/CsvToDbApplication.java`

### CSV migration

- [CSV loader](https://github.com/rgsharma745/csv-to-db/blob/main/src/main/java/com/rgsharma745/CsvToDbTable.java): `src/main/java/com/rgsharma745/CsvToDbTable.java`
- **CSV files**
- **CSV parser**
- [Name normalizer](https://github.com/rgsharma745/csv-to-db/blob/main/src/main/java/com/rgsharma745/Utils.java): `src/main/java/com/rgsharma745/Utils.java`

### Database storage

- **PostgreSQL**

### Other components

- **Operator**

## Connections

- Operator → Application entry: starts (evidence: `src/main/java/com/rgsharma745/CsvToDbApplication.java`)
- Application entry → CSV loader: invokes loading (evidence: `src/main/java/com/rgsharma745/CsvToDbApplication.java`)
- CSV files → CSV loader: reads files (evidence: `src/main/java/com/rgsharma745/CsvToDbTable.java`)
- CSV loader → CSV parser: parses CSV (evidence: `src/main/java/com/rgsharma745/CsvToDbTable.java`)
- CSV loader → Name normalizer: normalizes names (evidence: `src/main/java/com/rgsharma745/CsvToDbTable.java`)
- CSV loader → PostgreSQL: drops tables (evidence: `src/main/java/com/rgsharma745/CsvToDbTable.java`)
- CSV loader → PostgreSQL: creates tables (evidence: `src/main/java/com/rgsharma745/CsvToDbTable.java`)
- CSV loader → PostgreSQL: batch inserts (evidence: `src/main/java/com/rgsharma745/CsvToDbTable.java`)
