# tanmaypatil/leave-application architecture

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

- Interactive diagram: https://gitdiagram.com/tanmaypatil/leave-application
- Repository: https://github.com/tanmaypatil/leave-application

## Overview

- Frontend Component: Although there is no dedicated “frontend” directory, the README highlights Vue, so include a “Vue.js Frontend” component. Note that client.js might be a supportive client file for interfacing with backend services.
- Backend Component (GraphQL Engine): Represent the Hasura GraphQL engine. This module is central and communicates with the frontend via API calls.
- Database: Include the Postgres database that is managed via Hasura. Emphasize that the schema is managed by a series of migration files (present in the many migration directories) and seed scripts, which define tables for employees, leave applications, managers, holidays, entities, and so on.
- Migration & Seeding System: Separate or sub-component that handles database schema migrations (using Hasura’s migration files) and seeds initial data.
- CI/CD Pipeline: Illustrate the GitHub Actions setup (.github/workflows/main.yaml and action.yaml) which automate testing and deployment.
- Testing Suite: Represent the “test” directory which holds the GraphQL test cases and scripts (test/run_tests.js, test/util.js, etc.) to indicate a solid test strategy.

##### Relationships and Interactions
- GraphQL Engine to the “Postgres Database” which is managed by the migration system.
- Demonstrate that Docker (or container orchestration) encapsulates both the backend service and the database.
- That the CI/CD pipeline (GitHub Actions) triggers tests, builds the Docker images, and deploys the containerized services.

##### Architectural Patterns & Technologies
- Microservice or Containerized Architecture: Emphasize the containerization of components (Hasura, Postgres, and possibly the Vue frontend if it is containerized separately) using Docker.
- Declarative Migrations/Version Control: Show that the database migrations in leave-server-app/leave-system (organized chronologically by timestamp folders) are a central part of the application’s design.
- CI/CD Integration: Stress the role of GitHub Actions in ensuring a smooth integration and continuous delivery pipeline.
- GraphQL API: Clearly label that communications between frontend and backend happen through a standardized GraphQL API endpoint provided by Hasura.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "CI/CD Pipeline"
        CI1["GitHub Actions Workflow: main.yaml"]:::cicd
        CI2["GitHub Actions Config: action.yaml"]:::cicd
    end

    subgraph "Containerization & Infrastructure"
        D1["Dockerfile"]:::container
        D2["Docker Compose: docker-compose.yaml"]:::container
        D3["Docker Compose: docker-compose-hasura.yaml"]:::container
        subgraph "Shell Scripts"
            S1["entrypoint.sh"]:::container
            S2["migrate.sh"]:::container
            S3["migrate_test.sh"]:::container
        end
    end

    subgraph "System Services"
        F["Vue.js Frontend"]:::frontend
        B["Hasura GraphQL Engine"]:::backend
        subgraph "Database Layer"
            DB["Postgres Database"]:::database
            subgraph "Migration & Seeding System"
                M1["Migrations"]:::migration
                M2["Seeds"]:::migration
            end
        end
    end

    subgraph "Testing Suite"
        T1["run_tests.js"]:::testing
        T2["util.js"]:::testing
        T3["Test Request Files"]:::testing
        T4["Test Response Files"]:::testing
    end

    CI1 -->|"build&deploy"| D1
    CI1 -->|"build&deploy"| D2
    CI1 -->|"build&deploy"| D3
    CI1 -->|"triggers_tests"| T1

    D1 -->|"deploys"| F
    D1 -->|"deploys"| B
    D1 -->|"deploys"| DB

    F -->|"API_calls"| B
    B -->|"Data_access"| DB

    M1 -->|"apply"| DB
    M2 -->|"apply"| DB

    T1 ---|"API_testing"| B

    click F "https://github.com/tanmaypatil/leave-application/blob/master/client.js"
    click B "https://github.com/tanmaypatil/leave-application/tree/master/leave-server-app"
    click DB "https://github.com/tanmaypatil/leave-application/tree/master/leave-server-app/database"
    click M1 "https://github.com/tanmaypatil/leave-application/tree/master/leave-server-app/leave-system/migrations"
    click M2 "https://github.com/tanmaypatil/leave-application/tree/master/leave-server-app/leave-system/seeds"
    click D1 "https://github.com/tanmaypatil/leave-application/tree/master/Dockerfile"
    click D2 "https://github.com/tanmaypatil/leave-application/blob/master/leave-server-app/docker-compose.yaml"
    click D3 "https://github.com/tanmaypatil/leave-application/blob/master/leave-server-app/docker-compose-hasura.yaml"
    click S1 "https://github.com/tanmaypatil/leave-application/blob/master/entrypoint.sh"
    click S2 "https://github.com/tanmaypatil/leave-application/blob/master/migrate.sh"
    click S3 "https://github.com/tanmaypatil/leave-application/blob/master/migrate_test.sh"
    click CI1 "https://github.com/tanmaypatil/leave-application/blob/master/.github/workflows/main.yaml"
    click CI2 "https://github.com/tanmaypatil/leave-application/blob/master/action.yaml"
    click T1 "https://github.com/tanmaypatil/leave-application/blob/master/test/run_tests.js"
    click T2 "https://github.com/tanmaypatil/leave-application/blob/master/test/util.js"
    click T3 "https://github.com/tanmaypatil/leave-application/tree/master/test/request"
    click T4 "https://github.com/tanmaypatil/leave-application/tree/master/test/response"

    classDef frontend fill:#add8e6,stroke:#333,stroke-width:2px;
    classDef backend fill:#c2f0c2,stroke:#333,stroke-width:2px;
    classDef database fill:#FFE4B5,stroke:#333,stroke-width:2px;
    classDef migration fill:#d1e7dd,stroke:#333,stroke-width:2px;
    classDef container fill:#e6e6fa,stroke:#333,stroke-width:2px;
    classDef cicd fill:#ffd1dc,stroke:#333,stroke-width:2px;
    classDef testing fill:#ffffcc,stroke:#333,stroke-width:2px;
```
