# tcube-1/military-academy-web architecture

> Architecture diagram of the GitHub repository tcube-1/military-academy-web, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-08-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/tcube-1/military-academy-web
- Repository: https://github.com/tcube-1/military-academy-web

## Overview

#### Purpose and Runtime
This is a TypeScript Next.js application using the App Router. Its visible product surface is a course-oriented site with home navigation and pages for academic/intermediate and defence-related courses. A separate backend source tree exists, but no API route bridge is present in the tree.

Primary web runtime entry points:
- `src/app/layout.tsx`
- `src/app/page.tsx`
- `src/app/home/page.tsx`

#### Route Structure
The App Router serves:
- `/` from `src/app/page.tsx`
- `/home` from `src/app/home/page.tsx`
- Arbitrary nested course paths under `/home/*` through the catch-all route `src/app/home/[...courses]/page.tsx`

The catch-all page is the central routing boundary for course-specific content. It likely interprets route segments and selects course views; this is the main extension point for adding course URLs.

#### Shared Application Shell
`src/app/layout.tsx` defines the root document/layout boundary for all pages. Global visual styling is applied through:
- `src/app/globals.css`
- `src/app/layout.tsx`

Home-facing shared UI is separated into reusable components:
- `src/app/components/home/NavBar.tsx`
- `src/app/components/home/Ribbon.tsx`

This keeps navigation and promotional/header content outside route page files.

#### Course Content Composition
Course content is implemented as React component modules rather than as a data-driven CMS or backend API. Top-level course groupings include:
- `src/app/components/courses/Degree.tsx`
- `src/app/components/courses/Intermidte.tsx`

Intermediate/exam content is split by destination:
- `src/app/components/courses/inter/IitPage.tsx`
- `src/app/components/courses/inter/NdaPage.tsx`
- `src/app/components/courses/inter/NeetPage.tsx`

The route layer should compose these components rather than embed their content directly.

#### Defence Course Domain
Defence content is organized as independent presentation modules under a dedicated domain folder:
- `src/app/components/courses/defence/IndianArmy.tsx`
- `src/app/components/courses/defence/IndianAirForce.tsx`
- `src/app/components/courses/defence/IndianNavy.tsx`

`src/app/components/courses/defence/IndianCostGuard.tsx` is an additional defence branch component. This folder is the clear boundary for expanding defence-specific pages or consolidating shared defence metadata.

#### Backend and Infrastructure Boundary
A separate TypeScript backend entry point exists at:
- `src/backend/index.ts`
- `src/backend/database/db.ts`

Database connectivity is isolated under `src/backend/database/db.ts`; the actual database vendor/service is not identifiable from the supplied tree. Backend error and async-request conventions are centralized in:
- `src/backend/config/ApiError.ts`
- `src/backend/config/asyncHandler.ts`
- `src/backend/config/httpStatus.ts`

No `src/app/api` routes, external API clients, or hosted service integrations are visible. Consequently, the Next.js UI and backend appear structurally separate, and any future dynamic course data requires an explicit integration boundary between the App Router and `src/backend`.

Main entry points: [`src/app/home/[...courses]/page.tsx`](https://github.com/tcube-1/military-academy-web/blob/main/src/app/home/%5B...courses%5D/page.tsx) (/home/* course route), [`src/app/layout.tsx`](https://github.com/tcube-1/military-academy-web/blob/main/src/app/layout.tsx) (Root layout), [`src/app/home/page.tsx`](https://github.com/tcube-1/military-academy-web/blob/main/src/app/home/page.tsx) (/home page), [`src/backend/index.ts`](https://github.com/tcube-1/military-academy-web/blob/main/src/backend/index.ts) (Backend entry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Next.js App Router"]
  node_root_layout["Root layout<br/>App shell<br/>[layout.tsx]"]
  node_global_css["Global styles<br/>CSS<br/>[globals.css]"]
  node_landing_route["/ landing page<br/>Route page<br/>[page.tsx]"]
  node_home_route["/home page<br/>Route page<br/>[page.tsx]"]
  node_course_route{{"/home/* course route<br/>Catch-all route<br/>[page.tsx]"}}
  node_navbar["Home navigation<br/>Shared UI<br/>[NavBar.tsx]"]
  node_ribbon["Home ribbon<br/>Shared UI<br/>[Ribbon.tsx]"]
end

subgraph group_courses["Course Components"]
  node_degree["Degree courses<br/>Course view<br/>[Degree.tsx]"]
  node_intermediate["Intermediate courses<br/>Course view<br/>[Intermidte.tsx]"]
  node_iit["IIT content<br/>Exam view<br/>[IitPage.tsx]"]
  node_nda["NDA content<br/>Exam view<br/>[NdaPage.tsx]"]
  node_neet["NEET content<br/>Exam view<br/>[NeetPage.tsx]"]
  node_defence["Defence course views<br/>Domain folder"]
  node_army["Indian Army<br/>Defence view<br/>[IndianArmy.tsx]"]
  node_air_force["Indian Air Force<br/>Defence view<br/>[IndianAirForce.tsx]"]
  node_navy["Indian Navy<br/>Defence view<br/>[IndianNavy.tsx]"]
  node_coast_guard["Indian Coast Guard<br/>Defence view"]
end

subgraph group_backend["Separate Backend"]
  node_backend_entry{{"Backend entry<br/>TypeScript service<br/>[index.ts]"}}
  node_database[("Database connection<br/>Database access<br/>[db.ts]")]
  node_backend_conventions["API conventions<br/>Error handling<br/>[ApiError.ts]"]
end

node_root_layout -->|"applies"| node_global_css
node_root_layout -->|"wraps"| node_landing_route
node_root_layout -->|"wraps"| node_home_route
node_root_layout -->|"wraps"| node_course_route
node_home_route -->|"uses"| node_navbar
node_home_route -->|"uses"| node_ribbon
node_course_route -->|"selects"| node_degree
node_course_route -->|"selects"| node_intermediate
node_course_route -->|"selects"| node_iit
node_course_route -->|"selects"| node_nda
node_course_route -->|"selects"| node_neet
node_course_route -->|"selects"| node_defence
node_defence -->|"contains"| node_army
node_defence -->|"contains"| node_air_force
node_defence -->|"contains"| node_navy
node_defence -->|"contains"| node_coast_guard
node_backend_entry -->|"connects through"| node_database
node_backend_entry -->|"uses"| node_backend_conventions
node_course_route -.->|"no integration bridge"| node_backend_entry

click node_root_layout "https://github.com/tcube-1/military-academy-web/blob/main/src/app/layout.tsx"
click node_global_css "https://github.com/tcube-1/military-academy-web/blob/main/src/app/globals.css"
click node_landing_route "https://github.com/tcube-1/military-academy-web/blob/main/src/app/page.tsx"
click node_home_route "https://github.com/tcube-1/military-academy-web/blob/main/src/app/home/page.tsx"
click node_course_route "https://github.com/tcube-1/military-academy-web/blob/main/src/app/home/%5B...courses%5D/page.tsx"
click node_navbar "https://github.com/tcube-1/military-academy-web/blob/main/src/app/components/home/NavBar.tsx"
click node_ribbon "https://github.com/tcube-1/military-academy-web/blob/main/src/app/components/home/Ribbon.tsx"
click node_degree "https://github.com/tcube-1/military-academy-web/blob/main/src/app/components/courses/Degree.tsx"
click node_intermediate "https://github.com/tcube-1/military-academy-web/blob/main/src/app/components/courses/Intermidte.tsx"
click node_iit "https://github.com/tcube-1/military-academy-web/blob/main/src/app/components/courses/inter/IitPage.tsx"
click node_nda "https://github.com/tcube-1/military-academy-web/blob/main/src/app/components/courses/inter/NdaPage.tsx"
click node_neet "https://github.com/tcube-1/military-academy-web/blob/main/src/app/components/courses/inter/NeetPage.tsx"
click node_army "https://github.com/tcube-1/military-academy-web/blob/main/src/app/components/courses/defence/IndianArmy.tsx"
click node_air_force "https://github.com/tcube-1/military-academy-web/blob/main/src/app/components/courses/defence/IndianAirForce.tsx"
click node_navy "https://github.com/tcube-1/military-academy-web/blob/main/src/app/components/courses/defence/IndianNavy.tsx"
click node_coast_guard "https://github.com/tcube-1/military-academy-web/blob/main/src/app/components/courses/defence/IndianCostGuard.tsx"
click node_backend_entry "https://github.com/tcube-1/military-academy-web/blob/main/src/backend/index.ts"
click node_database "https://github.com/tcube-1/military-academy-web/blob/main/src/backend/database/db.ts"
click node_backend_conventions "https://github.com/tcube-1/military-academy-web/blob/main/src/backend/config/ApiError.ts"

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_root_layout,node_global_css,node_landing_route,node_home_route,node_course_route,node_navbar,node_ribbon toneBlue
class node_degree,node_intermediate,node_iit,node_nda,node_neet,node_defence,node_army,node_air_force,node_navy,node_coast_guard toneAmber
class node_backend_entry,node_database,node_backend_conventions toneMint
```

## Components

### Next.js App Router

- [Root layout](https://github.com/tcube-1/military-academy-web/blob/main/src/app/layout.tsx): App shell · Document boundary and global styling. · `src/app/layout.tsx`
- [Global styles](https://github.com/tcube-1/military-academy-web/blob/main/src/app/globals.css): CSS · `src/app/globals.css`
- [/ landing page](https://github.com/tcube-1/military-academy-web/blob/main/src/app/page.tsx): Route page · `src/app/page.tsx`
- [/home page](https://github.com/tcube-1/military-academy-web/blob/main/src/app/home/page.tsx): Route page · `src/app/home/page.tsx`
- [/home/* course route](https://github.com/tcube-1/military-academy-web/blob/main/src/app/home/%5B...courses%5D/page.tsx): Catch-all route · Central URL-to-course composition boundary. · `src/app/home/[...courses]/page.tsx`
- [Home navigation](https://github.com/tcube-1/military-academy-web/blob/main/src/app/components/home/NavBar.tsx): Shared UI · `src/app/components/home/NavBar.tsx`
- [Home ribbon](https://github.com/tcube-1/military-academy-web/blob/main/src/app/components/home/Ribbon.tsx): Shared UI · `src/app/components/home/Ribbon.tsx`

### Course Components

- [Degree courses](https://github.com/tcube-1/military-academy-web/blob/main/src/app/components/courses/Degree.tsx): Course view · `src/app/components/courses/Degree.tsx`
- [Intermediate courses](https://github.com/tcube-1/military-academy-web/blob/main/src/app/components/courses/Intermidte.tsx): Course view · `src/app/components/courses/Intermidte.tsx`
- [IIT content](https://github.com/tcube-1/military-academy-web/blob/main/src/app/components/courses/inter/IitPage.tsx): Exam view · `src/app/components/courses/inter/IitPage.tsx`
- [NDA content](https://github.com/tcube-1/military-academy-web/blob/main/src/app/components/courses/inter/NdaPage.tsx): Exam view · `src/app/components/courses/inter/NdaPage.tsx`
- [NEET content](https://github.com/tcube-1/military-academy-web/blob/main/src/app/components/courses/inter/NeetPage.tsx): Exam view · `src/app/components/courses/inter/NeetPage.tsx`
- **Defence course views**: Domain folder · Independent branch presentation modules.
- [Indian Army](https://github.com/tcube-1/military-academy-web/blob/main/src/app/components/courses/defence/IndianArmy.tsx): Defence view · `src/app/components/courses/defence/IndianArmy.tsx`
- [Indian Air Force](https://github.com/tcube-1/military-academy-web/blob/main/src/app/components/courses/defence/IndianAirForce.tsx): Defence view · `src/app/components/courses/defence/IndianAirForce.tsx`
- [Indian Navy](https://github.com/tcube-1/military-academy-web/blob/main/src/app/components/courses/defence/IndianNavy.tsx): Defence view · `src/app/components/courses/defence/IndianNavy.tsx`
- [Indian Coast Guard](https://github.com/tcube-1/military-academy-web/blob/main/src/app/components/courses/defence/IndianCostGuard.tsx): Defence view · `src/app/components/courses/defence/IndianCostGuard.tsx`

### Separate Backend

No API bridge to the App Router is present.

- [Backend entry](https://github.com/tcube-1/military-academy-web/blob/main/src/backend/index.ts): TypeScript service · Structurally separate from the Next.js runtime. · `src/backend/index.ts`
- [Database connection](https://github.com/tcube-1/military-academy-web/blob/main/src/backend/database/db.ts): Database access · Database vendor is not identified. · `src/backend/database/db.ts`
- [API conventions](https://github.com/tcube-1/military-academy-web/blob/main/src/backend/config/ApiError.ts): Error handling · Shared API errors, async handling, and status codes. · `src/backend/config/ApiError.ts`

## Connections

- Root layout → Global styles: applies
- Root layout → / landing page: wraps
- Root layout → /home page: wraps
- Root layout → /home/* course route: wraps
- /home page → Home navigation: uses
- /home page → Home ribbon: uses
- /home/* course route → Degree courses: selects
- /home/* course route → Intermediate courses: selects
- /home/* course route → IIT content: selects
- /home/* course route → NDA content: selects
- /home/* course route → NEET content: selects
- /home/* course route → Defence course views: selects
- Defence course views → Indian Army: contains
- Defence course views → Indian Air Force: contains
- Defence course views → Indian Navy: contains
- Defence course views → Indian Coast Guard: contains
- Backend entry → Database connection: connects through
- Backend entry → API conventions: uses
- /home/* course route → Backend entry: no integration bridge · Dynamic course data would require an explicit boundary.
