# inter-iit-prepathon-thesloths/frontend architecture

> Architecture diagram of the GitHub repository inter-iit-prepathon-thesloths/frontend, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-08-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/inter-iit-prepathon-thesloths/frontend
- Repository: https://github.com/inter-iit-prepathon-thesloths/frontend

## Overview

#### Purpose and runtime
This is a Vite-built React + TypeScript single-page application, structured as an authenticated company/dashboard portal rather than a server-rendered app. Browser execution starts at `src/main.tsx`, mounts the root application in `src/App.tsx`, and produces deployable static assets in `dist/`.

#### Application composition and routing
`src/App.tsx` is the likely route/orchestration boundary for public authentication, onboarding, dashboard, search, and settings pages. Primary screens include `src/pages/Dashboard/Company.tsx`, `src/pages/Search.tsx`, `src/pages/Settings.tsx`, and authentication flows under `src/pages/Authentication/`. `src/pages/BackendRedirection.tsx` is a callback/transition point for backend-driven navigation, likely OAuth or post-auth redirects.

#### Authentication and access control
Authentication is represented as a multi-stage client flow: sign-in/sign-up/reset, password setup, OTP verification, and 2FA challenge. Relevant boundaries are `src/pages/Authentication/SignIn.tsx`, `src/pages/OtpVerification.tsx`, `src/pages/AskTwofa.tsx`, and `src/components/ProtectedRoute.tsx`. OAuth-specific UI is isolated in `src/components/Oauth.tsx`; password collection is separated in `src/components/AskForPassword.tsx` and `src/pages/CreatePassword.tsx`.

#### Shared state and API boundary
Global application state is centralized in `src/context/context.tsx`, providing a cross-page boundary for session or application data. Remote HTTP access is expected to pass through `src/utils/axiosInstance.ts`, rather than being embedded in individual screens. Environment-specific backend configuration is supplied through `.env.sample`, making the external API endpoint/configuration a deployment concern.

#### Authenticated shell and navigation
Authenticated pages are composed through reusable layout and navigation primitives: `src/layout/Layout.tsx`, `src/components/Layout.tsx`, `src/components/Header/index.tsx`, and `src/components/Sidebar/index.tsx`. This layer owns persistent chrome, navigation grouping, user/notification UI, and theme controls, while route pages supply the main content area.

#### Dashboard, company data, and visual presentation
The main domain-facing experience centers on company/dashboard information in `src/pages/Dashboard/Company.tsx`. Reusable representations include summary/stat cards, charts, tables, breadcrumbing, and search: `src/components/CardDataNormal.tsx`, `src/components/Charts/ChartOne.tsx`, `src/components/Tables/Table.tsx`, and `src/components/SearchBar.tsx`. Domain payload shapes are explicitly modeled in `src/types/company.ts`, `src/types/product.ts`, `src/types/package.ts`, and related type files.

#### Deployment and frontend infrastructure
Vite configuration resides in `vite.config.ts`; Tailwind/PostCSS styling is configured by `tailwind.config.cjs` and `postcss.config.js`, with global styles in `src/index.css` and `src/css/style.css`. Client-side SPA fallback/redirect behavior is provisioned for static hosting through `vercel.json`, `public/_redirects`, and `dist/_redirects`. `docker-compose.yml` supplies a containerized local/runtime infrastructure path.

Main entry points: [`src/App.tsx`](https://github.com/inter-iit-prepathon-thesloths/frontend/blob/main/src/App.tsx) (App router), [`src/pages/Dashboard/Company.tsx`](https://github.com/inter-iit-prepathon-thesloths/frontend/blob/main/src/pages/Dashboard/Company.tsx) (Company dashboard), [`src/pages/Authentication/SignIn.tsx`](https://github.com/inter-iit-prepathon-thesloths/frontend/blob/main/src/pages/Authentication/SignIn.tsx) (Sign-in flow), [`src/layout/Layout.tsx`](https://github.com/inter-iit-prepathon-thesloths/frontend/blob/main/src/layout/Layout.tsx) (Authenticated layout)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Browser App"]
  node_entry(("Browser entry<br/>React bootstrap<br/>[main.tsx]"))
  node_app["App router<br/>route orchestration<br/>[App.tsx]"]
  node_state["Global state<br/>React context<br/>[context.tsx]"]
  node_api{{"HTTP client<br/>API boundary<br/>[axiosInstance.ts]"}}
end

subgraph group_auth["Authentication"]
  node_protected["Protected routes<br/>access guard<br/>[ProtectedRoute.tsx]"]
  node_signin["Sign-in flow<br/>authentication page<br/>[SignIn.tsx]"]
  node_otp["OTP &amp; 2FA<br/>authentication challenge"]
  node_oauth["OAuth UI<br/>authentication component<br/>[Oauth.tsx]"]
  node_redirect["Backend callback<br/>navigation transition"]
end

subgraph group_shell["Authenticated UI"]
  node_layout["Authenticated layout<br/>page shell<br/>[Layout.tsx]"]
  node_navigation["Header &amp; sidebar<br/>navigation UI<br/>[index.tsx]"]
end

subgraph group_domain["Dashboard &amp; Data"]
  node_company["Company dashboard<br/>primary screen<br/>[Company.tsx]"]
  node_presentation["Dashboard widgets<br/>charts, cards, tables<br/>[ChartOne.tsx]"]
  node_types["Company models<br/>TypeScript domain types<br/>[company.ts]"]
end

subgraph group_delivery["Build &amp; Deployment"]
  node_vite{{"Vite build<br/>frontend build<br/>[vite.config.ts]"}}
  node_spa_fallback["SPA fallback<br/>static-host redirects<br/>[vercel.json]"]
  node_container["Container runtime<br/>Docker Compose<br/>[docker-compose.yml]"]
end

node_entry -->|"mounts"| node_app
node_app -->|"uses"| node_state
node_app -->|"public auth routes"| node_signin
node_app -->|"callback route"| node_redirect
node_signin -->|"verification"| node_otp
node_signin -->|"OAuth option"| node_oauth
node_redirect -->|"updates session"| node_state
node_app -->|"guards private routes"| node_protected
node_protected -->|"permits"| node_layout
node_layout -->|"contains"| node_navigation
node_layout -->|"renders route content"| node_company
node_company -->|"composes"| node_presentation
node_company -.->|"uses"| node_types
node_company -->|"loads data"| node_api
node_api -.->|"session-aware requests"| node_state
node_vite -->|"builds"| node_entry
node_vite -.->|"deploys with"| node_spa_fallback
node_container -.->|"runs"| node_vite

click node_entry "https://github.com/inter-iit-prepathon-thesloths/frontend/blob/main/src/main.tsx"
click node_app "https://github.com/inter-iit-prepathon-thesloths/frontend/blob/main/src/App.tsx"
click node_state "https://github.com/inter-iit-prepathon-thesloths/frontend/blob/main/src/context/context.tsx"
click node_api "https://github.com/inter-iit-prepathon-thesloths/frontend/blob/main/src/utils/axiosInstance.ts"
click node_protected "https://github.com/inter-iit-prepathon-thesloths/frontend/blob/main/src/components/ProtectedRoute.tsx"
click node_signin "https://github.com/inter-iit-prepathon-thesloths/frontend/blob/main/src/pages/Authentication/SignIn.tsx"
click node_otp "https://github.com/inter-iit-prepathon-thesloths/frontend/blob/main/src/pages/OtpVerification.tsx"
click node_oauth "https://github.com/inter-iit-prepathon-thesloths/frontend/blob/main/src/components/Oauth.tsx"
click node_redirect "https://github.com/inter-iit-prepathon-thesloths/frontend/blob/main/src/pages/BackendRedirection.tsx"
click node_layout "https://github.com/inter-iit-prepathon-thesloths/frontend/blob/main/src/layout/Layout.tsx"
click node_navigation "https://github.com/inter-iit-prepathon-thesloths/frontend/blob/main/src/components/Sidebar/index.tsx"
click node_company "https://github.com/inter-iit-prepathon-thesloths/frontend/blob/main/src/pages/Dashboard/Company.tsx"
click node_presentation "https://github.com/inter-iit-prepathon-thesloths/frontend/blob/main/src/components/Charts/ChartOne.tsx"
click node_types "https://github.com/inter-iit-prepathon-thesloths/frontend/blob/main/src/types/company.ts"
click node_vite "https://github.com/inter-iit-prepathon-thesloths/frontend/blob/main/vite.config.ts"
click node_spa_fallback "https://github.com/inter-iit-prepathon-thesloths/frontend/blob/main/vercel.json"
click node_container "https://github.com/inter-iit-prepathon-thesloths/frontend/blob/main/docker-compose.yml"

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_entry,node_app,node_state,node_api toneBlue
class node_protected,node_signin,node_otp,node_oauth,node_redirect toneAmber
class node_layout,node_navigation toneMint
class node_company,node_presentation,node_types toneRose
class node_vite,node_spa_fallback,node_container toneIndigo
```

## Components

### Browser App

- [Browser entry](https://github.com/inter-iit-prepathon-thesloths/frontend/blob/main/src/main.tsx): React bootstrap · `src/main.tsx`
- [App router](https://github.com/inter-iit-prepathon-thesloths/frontend/blob/main/src/App.tsx): route orchestration · Coordinates public, onboarding, and authenticated routes. · `src/App.tsx`
- [Global state](https://github.com/inter-iit-prepathon-thesloths/frontend/blob/main/src/context/context.tsx): React context · Cross-page session and application state. · `src/context/context.tsx`
- [HTTP client](https://github.com/inter-iit-prepathon-thesloths/frontend/blob/main/src/utils/axiosInstance.ts): API boundary · Centralized remote HTTP access. · `src/utils/axiosInstance.ts`

### Authentication

- [Protected routes](https://github.com/inter-iit-prepathon-thesloths/frontend/blob/main/src/components/ProtectedRoute.tsx): access guard · `src/components/ProtectedRoute.tsx`
- [Sign-in flow](https://github.com/inter-iit-prepathon-thesloths/frontend/blob/main/src/pages/Authentication/SignIn.tsx): authentication page · `src/pages/Authentication/SignIn.tsx`
- [OTP & 2FA](https://github.com/inter-iit-prepathon-thesloths/frontend/blob/main/src/pages/OtpVerification.tsx): authentication challenge · `src/pages/OtpVerification.tsx`
- [OAuth UI](https://github.com/inter-iit-prepathon-thesloths/frontend/blob/main/src/components/Oauth.tsx): authentication component · `src/components/Oauth.tsx`
- [Backend callback](https://github.com/inter-iit-prepathon-thesloths/frontend/blob/main/src/pages/BackendRedirection.tsx): navigation transition · Handles backend-driven post-auth navigation. · `src/pages/BackendRedirection.tsx`

### Authenticated UI

- [Authenticated layout](https://github.com/inter-iit-prepathon-thesloths/frontend/blob/main/src/layout/Layout.tsx): page shell · Persistent chrome around routed content. · `src/layout/Layout.tsx`
- [Header & sidebar](https://github.com/inter-iit-prepathon-thesloths/frontend/blob/main/src/components/Sidebar/index.tsx): navigation UI · `src/components/Sidebar/index.tsx`

### Dashboard & Data

- [Company dashboard](https://github.com/inter-iit-prepathon-thesloths/frontend/blob/main/src/pages/Dashboard/Company.tsx): primary screen · `src/pages/Dashboard/Company.tsx`
- [Dashboard widgets](https://github.com/inter-iit-prepathon-thesloths/frontend/blob/main/src/components/Charts/ChartOne.tsx): charts, cards, tables · `src/components/Charts/ChartOne.tsx`
- [Company models](https://github.com/inter-iit-prepathon-thesloths/frontend/blob/main/src/types/company.ts): TypeScript domain types · `src/types/company.ts`

### Build & Deployment

- [Vite build](https://github.com/inter-iit-prepathon-thesloths/frontend/blob/main/vite.config.ts): frontend build · Builds static SPA assets to dist/. · `vite.config.ts`
- [SPA fallback](https://github.com/inter-iit-prepathon-thesloths/frontend/blob/main/vercel.json): static-host redirects · `vercel.json`
- [Container runtime](https://github.com/inter-iit-prepathon-thesloths/frontend/blob/main/docker-compose.yml): Docker Compose · `docker-compose.yml`

## Connections

- Browser entry → App router: mounts
- App router → Global state: uses
- App router → Sign-in flow: public auth routes
- App router → Backend callback: callback route
- Sign-in flow → OTP & 2FA: verification
- Sign-in flow → OAuth UI: OAuth option
- Backend callback → Global state: updates session
- App router → Protected routes: guards private routes
- Protected routes → Authenticated layout: permits
- Authenticated layout → Header & sidebar: contains
- Authenticated layout → Company dashboard: renders route content
- Company dashboard → Dashboard widgets: composes
- Company dashboard → Company models: uses
- Company dashboard → HTTP client: loads data
- HTTP client → Global state: session-aware requests
- Vite build → Browser entry: builds
- Vite build → SPA fallback: deploys with
- Container runtime → Vite build: runs
