# bittu1040/daily-task-tracker architecture

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

- Interactive diagram: https://gitdiagram.com/bittu1040/daily-task-tracker
- Repository: https://github.com/bittu1040/daily-task-tracker

## Overview

##### Project type and purpose
- This is a single‐page web application (SPA) built with Angular (v19).
- It provides a task‐tracking UI: users log in, view dashboards, add tasks, and see statistics.
- There is no backend code here, but the app relies on external REST APIs for data and authentication.

##### File structure
- Top-level Angular config files (angular.json, tsconfig.json) and the “src” folder containing all code.
- src/app:
- app.component.ts/html/scss – root component and view
- app.routes.ts – routing configuration
- app.config.ts – environment or API endpoints
- components/* – UI components (login, dashboard, add‐task, task‐list, etc.)
- services/* – data and auth logic (AuthService, TaskService, CommonService)
- interceptors/auth.interceptor.ts – attaches auth tokens to HTTP requests
- guards/auth.guard.ts – protects routes behind authentication
- models/interface.ts – TypeScript interfaces for domain models
- src/assets and src/styles – static assets and global styling (SCSS partials).

##### README
- Confirms it’s an Angular CLI–generated SPA.
- Describes development server, build process, and testing with Karma.

##### Main components
a. Browser / Client
- Hosts index.html and the Angular app bundle.
b. Angular Application (AppModule)
- AppComponent (root)
- Router Module (app.routes.ts) with route definitions
- Feature Components (login, dashboard, add‐task, task‐list, etc.)
- Services Layer (AuthService, TaskService, CommonService)
- HTTP Interceptor (auth.interceptor.ts)
- Route Guard (auth.guard.ts)
- Models (interfaces)
c. External Services
- Authentication API (e.g., /api/auth)
- Tasks API (e.g., /api/tasks)
- Any third-party services (if used)
d. Build & Deployment
- Angular CLI / Webpack bundling → dist/
- Static hosting (e.g., NGINX, S3 + CloudFront)

##### Relationships and data flow
- User interacts with the Browser UI → Angular Router loads a component.
- Component calls a Service method (e.g., TaskService.getTasks()).
- Service issues HTTP request; AuthInterceptor attaches JWT.
- Request/response flows to/from External REST API.
- Guard prevents navigation if AuthService.isLoggedIn() is false.
- Data flows back through Service → Component → View.

##### Architectural patterns and design principles
- Component-based UI (Angular Components).
- Separation of concerns: Components handle view logic; Services handle data & business logic.
- HTTP Interceptor for cross-cutting concern (auth token injection).
- Router Guards for authorization.
- Reactive or promise-based data flows (Observables in Services).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Browser/Client Layer
    subgraph "Browser / Client"
        direction TB
        Index["index.html"]:::ui
        Main["main.ts"]:::ui
    end

    %% Angular Application Layer
    subgraph "Angular Application"
        direction TB
        AppModule["AppModule"]:::ui
        AppComponent["AppComponent"]:::ui
        Router["Router (app.routes.ts)"]:::ui
        Config["AppConfig (app.config.ts)"]:::service

        subgraph "UI Components"
            direction TB
            LoginC["LoginComponent"]:::ui
            DashboardC["DashboardComponent"]:::ui
            AddTaskC["AddTaskComponent"]:::ui
            TaskListC["TaskListComponent"]:::ui
            TaskStatsC["TaskStatisticsComponent"]:::ui
            TaskSummaryC["TaskSummaryComponent"]:::ui
            TopNavC["TopNavComponent"]:::ui
            PageNotFoundC["PageNotFoundComponent"]:::ui
        end

        subgraph "Services & Guards"
            direction TB
            AuthService["AuthService"]:::service
            TaskService["TaskService"]:::service
            CommonService["CommonService"]:::service
            AuthInterceptor["AuthInterceptor"]:::interceptor
            AuthGuard["AuthGuard"]:::service
            Interface["Interfaces"]:::service
        end
    end

    %% External Services Layer
    subgraph "External APIs"
        direction TB
        AuthAPI["Authentication API"]:::external
        TasksAPI["Tasks API"]:::external
        OtherAPI["Third-Party Services"]:::external
    end

    %% Build & Deployment Layer
    subgraph "Build & Deployment"
        direction TB
        CLI["angular.json"]:::build
        TS["tsconfig*.json"]:::build
        PKG["package.json"]:::build
        Dist["dist/"]:::build
        Hosting["Hosting (NGINX/S3+CDN)"]:::build
    end

    %% Assets & Styles
    Assets["src/assets/"]:::build
    Styles["Global Styles"]:::build

    %% Connections
    Index -->|loads| AppModule
    Main -->|bootstraps| AppModule
    AppModule -->|declares| AppComponent
    AppModule -->|imports| Router
    AppModule -->|provides| AuthInterceptor
    AppModule -->|provides| AuthGuard
    AppModule -->|provides| AuthService
    AppModule -->|provides| TaskService
    AppModule -->|provides| CommonService

    Router -->|routes to| LoginC
    Router -->|routes to| DashboardC
    Router -->|routes to| AddTaskC
    Router -->|routes to| TaskListC
    Router -->|routes to| TaskStatsC
    Router -->|routes to| TaskSummaryC
    Router -->|routes to| PageNotFoundC
    Router -->|uses guard| AuthGuard

    LoginC -->|calls| AuthService
    DashboardC -->|calls| TaskService
    AddTaskC -->|calls| TaskService
    TaskListC -->|calls| TaskService
    TaskStatsC -->|calls| TaskService
    TaskSummaryC -->|calls| TaskService
    TopNavC -->|calls| AuthService

    AuthService -->|request| AuthInterceptor
    TaskService -->|request| AuthInterceptor
    CommonService -->|request| AuthInterceptor

    AuthInterceptor -->|GET /auth| AuthAPI
    AuthInterceptor -->|GET/POST /tasks| TasksAPI
    AuthInterceptor -->|other| OtherAPI

    AuthAPI -->|response| AuthInterceptor
    TasksAPI -->|response| AuthInterceptor
    OtherAPI -->|response| AuthInterceptor

    AuthInterceptor -->|passes| AuthService
    AuthInterceptor -->|passes| TaskService

    Assets -->|included in| Dist
    Styles -->|included in| Dist

    CLI -->|build| Dist
    TS -->|compile| Dist
    PKG -->|dependencies| Dist
    Dist -->|deploy| Hosting

    %% Click Events
    click Index "https://github.com/bittu1040/daily-task-tracker/blob/master/src/index.html"
    click Main "https://github.com/bittu1040/daily-task-tracker/blob/master/src/main.ts"
    click AppComponent "https://github.com/bittu1040/daily-task-tracker/blob/master/src/app/app.component.ts"
    click Router "https://github.com/bittu1040/daily-task-tracker/blob/master/src/app/app.routes.ts"
    click Config "https://github.com/bittu1040/daily-task-tracker/blob/master/src/app/app.config.ts"
    click LoginC "https://github.com/bittu1040/daily-task-tracker/blob/master/src/app/components/login/login.component.ts"
    click DashboardC "https://github.com/bittu1040/daily-task-tracker/blob/master/src/app/components/dashboard/dashboard.component.ts"
    click AddTaskC "https://github.com/bittu1040/daily-task-tracker/blob/master/src/app/components/add-task/add-task.component.ts"
    click TaskListC "https://github.com/bittu1040/daily-task-tracker/blob/master/src/app/components/task-list/task-list.component.ts"
    click TaskStatsC "https://github.com/bittu1040/daily-task-tracker/blob/master/src/app/components/task-statistics/task-statistics.component.ts"
    click TaskSummaryC "https://github.com/bittu1040/daily-task-tracker/blob/master/src/app/components/task-summary/task-summary.component.ts"
    click TopNavC "https://github.com/bittu1040/daily-task-tracker/blob/master/src/app/components/top-nav/top-nav.component.ts"
    click PageNotFoundC "https://github.com/bittu1040/daily-task-tracker/blob/master/src/app/components/page-not-found/page-not-found.component.ts"
    click AuthService "https://github.com/bittu1040/daily-task-tracker/blob/master/src/app/services/auth.service.ts"
    click TaskService "https://github.com/bittu1040/daily-task-tracker/blob/master/src/app/services/task.service.ts"
    click CommonService "https://github.com/bittu1040/daily-task-tracker/blob/master/src/app/services/common.service.ts"
    click AuthInterceptor "https://github.com/bittu1040/daily-task-tracker/blob/master/src/app/interceptors/auth.interceptor.ts"
    click AuthGuard "https://github.com/bittu1040/daily-task-tracker/blob/master/src/app/guards/auth.guard.ts"
    click Interface "https://github.com/bittu1040/daily-task-tracker/blob/master/src/app/models/interface.ts"
    click Assets "https://github.com/bittu1040/daily-task-tracker/tree/master/src/assets/"
    click Styles "https://github.com/bittu1040/daily-task-tracker/blob/master/src/styles.scss"
    click CLI "https://github.com/bittu1040/daily-task-tracker/blob/master/angular.json"
    click TS "https://github.com/bittu1040/daily-task-tracker/blob/master/tsconfig.json"
    click PKG "https://github.com/bittu1040/daily-task-tracker/blob/master/package.json"

    %% Styles
    classDef ui fill:#D0E8FF,stroke:#0066CC,color:#000;
    classDef service fill:#DFF5D0,stroke:#339900,color:#000;
    classDef interceptor fill:#FFE5B4,stroke:#FF8C00,color:#000;
    classDef external fill:#FFF4C1,stroke:#CC9900,color:#000;
    classDef build fill:#E8E8E8,stroke:#666,color:#000;
```
