# moshohel/freelance-time-tracker architecture

> Architecture diagram of the GitHub repository moshohel/freelance-time-tracker, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-11). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/moshohel/freelance-time-tracker
- Repository: https://github.com/moshohel/freelance-time-tracker

## Overview

##### Project type and purpose
- This is a backend‐only RESTful API built with Laravel 12 (“Freelance Time Tracker API”).
- It provides user authentication (Laravel Sanctum), client/project CRUD, time logging, and reporting endpoints.

##### File structure
- Top‐level:
- app/Http/Controllers/Api → all HTTP entrypoints (AuthController, ClientController, ProjectController, TimeLogController)
- app/Services & app/Repositories → a Service layer sitting above a Repository layer
- app/Models → Eloquent models (User, Client, Project, TimeLog)
- database/migrations, factories, seeders → DB schema and test data
- routes/api.php → API route definitions, protected by auth middleware
- Config & bootstrap files for framework setup, .env for runtime config, public/index.php as front controller.

##### README
- Clearly describes features: authentication, client/project management, time logs, reporting.
- Lists tech stack: PHP 8.2, MySQL, Laravel 12, Sanctum, PHPUnit.
- Outlines API endpoints and usage.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% External Clients
    ExternalClients["External Clients<br/>(Postman, Mobile/Web Apps)"]:::external

    %% Infrastructure
    subgraph "Infrastructure"
        WebServer["Web Server / Load Balancer<br/>(Nginx/Apache)"]:::infra
        PHPFPM["PHP-FPM"]:::infra
    end

    %% Entry Point
    subgraph "Entry Point"
        FrontController["public/index.php"]:::app
        Htaccess[".htaccess"]:::app
    end

    %% Framework Bootstrap & Config
    subgraph "Bootstrap & Config"
        Env[".env / .env.example"]:::config
        BootstrapApp["bootstrap/app.php"]:::config
        ConfigFiles["config/*.php"]:::config
        SanctumConfig["config/sanctum.php"]:::config
        RouteProvider["app/Providers/RouteServiceProvider.php"]:::app
    end

    %% Routing
    subgraph "Routing"
        ApiRoutes["routes/api.php"]:::app
        WebRoutes["routes/web.php<br/>routes/console.php"]:::app
    end

    %% HTTP Kernel & Middleware
    Middleware["HTTP Kernel & Middleware"]:::app

    %% Presentation Layer
    subgraph "Presentation Layer"
        Controllers["Controllers (Api/*Controller)"]:::app
        Requests["Form Requests (Validation)"]:::app
        Resources["API Resources (Transformers)"]:::app
    end

    %% Service & Repository Layers
    subgraph "Service Layer"
        Services["Services"]:::app
        ServiceInterfaces["Service Interfaces"]:::app
    end

    subgraph "Repository Layer"
        Repos["Repositories"]:::app
        RepoInterfaces["Repository Interfaces"]:::app
    end

    %% Data Layer
    subgraph "Data Layer"
        Models["Eloquent Models"]:::data
        Database["MySQL Database"]:::data
        Migrations["database/migrations"]:::data
        Factories["database/factories"]:::data
        Seeders["database/seeders"]:::data
        Storage["File Storage (logs, cache, sessions)"]:::data
    end

    %% CI/CD & Testing
    subgraph "CI/CD & Testing"
        PHPUnit["PHPUnit Tests"]:::test
        TestSetup["phpunit.xml, tests/TestCase.php"]:::test
    end

    %% Flow
    ExternalClients -->|HTTP Request| WebServer
    WebServer --> PHPFPM
    PHPFPM --> FrontController
    FrontController --> Middleware
    Middleware --> ApiRoutes
    ApiRoutes --> Controllers
    Controllers -->|uses| Requests
    Controllers -->|returns| Resources
    Controllers --> Services
    Services --> ServiceInterfaces
    Services --> Repos
    Repos --> RepoInterfaces
    Repos --> Models
    Models --> Database
    Database --> Models
    Models --> Repos
    Storage -->|read/write| Controllers
    BootstrapApp --> FrontController
    Env -->|configures| BootstrapApp
    ConfigFiles -->|framework config| BootstrapApp
    SanctumConfig --> Middleware
    RouteProvider --> ApiRoutes
    WebRoutes --> Middleware
    PHPUnit --> Controllers
    PHPUnit --> Services
    PHPUnit --> Repos
    TestSetup --> PHPUnit

    %% Click Events
    click ExternalClients "https://github.com/moshohel/freelance-time-tracker/blob/master/postman/Freelencer time tracker.postman_collection.json"
    click FrontController "https://github.com/moshohel/freelance-time-tracker/blob/master/public/index.php"
    click Htaccess "https://github.com/moshohel/freelance-time-tracker/blob/master/public/.htaccess"
    click ApiRoutes "https://github.com/moshohel/freelance-time-tracker/blob/master/routes/api.php"
    click WebRoutes "https://github.com/moshohel/freelance-time-tracker/blob/master/routes/web.php"
    click WebRoutes "https://github.com/moshohel/freelance-time-tracker/blob/master/routes/console.php"
    click RouteProvider "https://github.com/moshohel/freelance-time-tracker/blob/master/app/Providers/RouteServiceProvider.php"
    click SanctumConfig "https://github.com/moshohel/freelance-time-tracker/blob/master/config/sanctum.php"
    click Controllers "https://github.com/moshohel/freelance-time-tracker/blob/master/app/Http/Controllers/Api/AuthController.php"
    click Controllers "https://github.com/moshohel/freelance-time-tracker/blob/master/app/Http/Controllers/Api/ClientController.php"
    click Controllers "https://github.com/moshohel/freelance-time-tracker/blob/master/app/Http/Controllers/Api/ProjectController.php"
    click Controllers "https://github.com/moshohel/freelance-time-tracker/blob/master/app/Http/Controllers/Api/TimeLogController.php"
    click Requests "https://github.com/moshohel/freelance-time-tracker/blob/master/app/Http/Requests/StoreClientRequest.php"
    click Requests "https://github.com/moshohel/freelance-time-tracker/blob/master/app/Http/Requests/UpdateClientRequest.php"
    click Requests "https://github.com/moshohel/freelance-time-tracker/blob/master/app/Http/Requests/StoreProjectRequest.php"
    click Requests "https://github.com/moshohel/freelance-time-tracker/blob/master/app/Http/Requests/UpdateProjectRequest.php"
    click Requests "https://github.com/moshohel/freelance-time-tracker/blob/master/app/Http/Requests/TimeLogRequest.php"
    click Requests "https://github.com/moshohel/freelance-time-tracker/blob/master/app/Http/Requests/UpdateTimeLogRequest.php"
    click Resources "https://github.com/moshohel/freelance-time-tracker/blob/master/app/Http/Resources/ClientResource.php"
    click Resources "https://github.com/moshohel/freelance-time-tracker/blob/master/app/Http/Resources/ProjectResource.php"
    click Resources "https://github.com/moshohel/freelance-time-tracker/blob/master/app/Http/Resources/TimeLogResource.php"
    click Services "https://github.com/moshohel/freelance-time-tracker/blob/master/app/Services/Client/ClientService.php"
    click Services "https://github.com/moshohel/freelance-time-tracker/blob/master/app/Services/Project/ProjectService.php"
    click Services "https://github.com/moshohel/freelance-time-tracker/blob/master/app/Services/TimeLog/TimeLogService.php"
    click ServiceInterfaces "https://github.com/moshohel/freelance-time-tracker/blob/master/app/Services/Client/ClientServiceInterface.php"
    click ServiceInterfaces "https://github.com/moshohel/freelance-time-tracker/blob/master/app/Services/Project/ProjectServiceInterface.php"
    click ServiceInterfaces "https://github.com/moshohel/freelance-time-tracker/blob/master/app/Services/TimeLog/TimeLogServiceInterface.php"
    click Repos "https://github.com/moshohel/freelance-time-tracker/blob/master/app/Repositories/Client/ClientRepository.php"
    click Repos "https://github.com/moshohel/freelance-time-tracker/blob/master/app/Repositories/Project/ProjectRepository.php"
    click Repos "https://github.com/moshohel/freelance-time-tracker/blob/master/app/Repositories/TimeLog/TimeLogRepository.php"
    click RepoInterfaces "https://github.com/moshohel/freelance-time-tracker/blob/master/app/Repositories/Client/ClientRepositoryInterface.php"
    click RepoInterfaces "https://github.com/moshohel/freelance-time-tracker/blob/master/app/Repositories/Project/ProjectRepositoryInterface.php"
    click RepoInterfaces "https://github.com/moshohel/freelance-time-tracker/blob/master/app/Repositories/TimeLog/TimeLogRepositoryInterface.php"
    click Models "https://github.com/moshohel/freelance-time-tracker/blob/master/app/Models/User.php"
    click Models "https://github.com/moshohel/freelance-time-tracker/blob/master/app/Models/Client.php"
    click Models "https://github.com/moshohel/freelance-time-tracker/blob/master/app/Models/Project.php"
    click Models "https://github.com/moshohel/freelance-time-tracker/blob/master/app/Models/TimeLog.php"
    click Migrations "https://github.com/moshohel/freelance-time-tracker/tree/master/database/migrations"
    click Factories "https://github.com/moshohel/freelance-time-tracker/tree/master/database/factories"
    click Seeders "https://github.com/moshohel/freelance-time-tracker/tree/master/database/seeders"
    click Storage "https://github.com/moshohel/freelance-time-tracker/tree/master/storage/app"
    click Storage "https://github.com/moshohel/freelance-time-tracker/tree/master/storage/framework"
    click Storage "https://github.com/moshohel/freelance-time-tracker/tree/master/storage/logs"
    click Env "https://github.com/moshohel/freelance-time-tracker/blob/master/.env.example"
    click ConfigFiles "https://github.com/moshohel/freelance-time-tracker/tree/master/config"
    click BootstrapApp "https://github.com/moshohel/freelance-time-tracker/blob/master/bootstrap/app.php"
    click PHPUnit "https://github.com/moshohel/freelance-time-tracker/tree/master/tests/Feature"
    click PHPUnit "https://github.com/moshohel/freelance-time-tracker/tree/master/tests/Unit"
    click TestSetup "https://github.com/moshohel/freelance-time-tracker/blob/master/phpunit.xml"

    %% Styles
    classDef external fill:#9f6,stroke:#333,stroke-width:1px
    classDef infra fill:#6cc,stroke:#333,stroke-width:1px
    classDef app fill:#ade,stroke:#333,stroke-width:1px
    classDef data fill:#f96,stroke:#333,stroke-width:1px
    classDef config fill:#fc9,stroke:#333,stroke-width:1px
    classDef test fill:#ccf,stroke:#333,stroke-width:1px
```
