# kaushalrijal/veloce architecture

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

- Interactive diagram: https://gitdiagram.com/kaushalrijal/veloce
- Repository: https://github.com/kaushalrijal/veloce

## Overview

##### Project type and purpose
- Veloce is a command‑line version control system (VCS) written in C.
- Purpose: let users authenticate, create/manage repositories, record commits, view history, and revert changes.

##### File structure
- Top‑level C modules:
- main.c       → CLI orchestration and menu flow
- auth.c       → user signup/login, password encryption, security questions
- repos.c      → create/list/delete repositories
- commits.c    → create commits, list commit history, revert to an earlier state
- loading.c    → persistence: reading/writing `.dat` files for users, repos, commits
- vcs.h        → shared data structures and function prototypes
- No external services or databases—persistence is file‑based.

##### README for additional insights
- Features map one‑to‑one with modules above.
- Build instructions show standalone GCC compilation into a single `vcs` executable.

##### Elements
- Clear labels: module names and their source files
- CLI → Auth (login/signup) → Persistence
- CLI → Repo → Persistence
- CLI → Commit → Persistence
- Blue rectangles for “Services” (Auth, Repo, Commit)
- Yellow oval for “CLI Interface”
- Grey rectangle for “Loading / Data Access Layer”

##### Detailed breakdown
- Split each service into input (functions called by main.c) and output (files read/written)
- “revert” flow: Commit Service reads commit object, writes new HEAD pointer in the repo file

3. Loading module connecting to “File System (.dat files)”

This layered, modular view ensures all components and their interactions are captured accurately and in detail.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Presentation Layer
    CLI(("CLI Interface (main.c)")):::cli

    %% Business Logic Layer
    subgraph "Business Logic"
        Auth["Authentication Service (auth.c)"]:::service
        Repo["Repository Management Service (repos.c)"]:::service
        Commit["Commit Management Service (commits.c)"]:::service
    end

    %% Data Access Layer
    Loading["Loading Module (loading.c)"]:::dataaccess
    FS(("File System (.dat files)")):::filesystem

    %% Shared Models
    Models["vcs.h: User, Repo, Commit record prototypes"]:::models

    %% Relationships
    CLI -->|"login/signup"| Auth
    CLI -->|"repo operations"| Repo
    CLI -->|"commit operations"| Commit

    Auth -->|"read/write user data"| Loading
    Repo -->|"read/write repo metadata"| Loading
    Commit -->|"read/write commit objects"| Loading

    Loading -->|"binary .dat files"| FS

    Commit -->|"belongs to repo"| Repo
    Auth -->|"authorize operations"| Repo
    Auth -->|"authorize operations"| Commit

    %% Click Events
    click CLI "https://github.com/kaushalrijal/veloce/blob/main/main.c"
    click Auth "https://github.com/kaushalrijal/veloce/blob/main/auth.c"
    click Repo "https://github.com/kaushalrijal/veloce/blob/main/repos.c"
    click Commit "https://github.com/kaushalrijal/veloce/blob/main/commits.c"
    click Loading "https://github.com/kaushalrijal/veloce/blob/main/loading.c"
    click Models "https://github.com/kaushalrijal/veloce/blob/main/vcs.h"

    %% Styles
    classDef cli fill:#f9f,stroke:#333,stroke-width:2px
    classDef service fill:#bbf,stroke:#333,stroke-width:2px
    classDef dataaccess fill:#ccc,stroke:#333,stroke-width:2px
    classDef filesystem fill:#afa,stroke:#333,stroke-width:2px
    classDef models fill:#eee,stroke:#333,stroke-width:1px,stroke-dasharray: 5 5
```
