# magardeyash/minorproject architecture

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

- Interactive diagram: https://gitdiagram.com/magardeyash/minorproject
- Repository: https://github.com/magardeyash/minorproject

## Overview

1. **Overall shape**
   VentureLens is a **Next.js 15 App Router** application built around three user roles: **Founder**, **Employee/Contributor**, and **Admin**. The app is organized into route groups and dashboards rather than a single generic UI, so the architecture is primarily **role-segmented**.

2. **Public and authentication boundary**
   The public entry points are the landing page and the auth flows under `app/(auth)`. Separate login/register pages exist for founder, employee, and admin, backed by shared auth UI components in `components/auth`. This keeps unauthenticated access isolated from dashboard functionality.

3. **Role-based application shells**
   Each major area has its own layout: `app/dashboard/founder`, `app/dashboard/employee`, and `app/admin/dashboard`. These layouts likely provide navigation, access control, and shared shell chrome through components like `DashboardShell` and `Sidebar`. The result is a clean boundary between presentation shell and role-specific content pages.

4. **Core business domains**
   The repo centers on three domain objects:
   - **Ideas**: startup concepts submitted and managed by founders
   - **Applications**: contributors applying to ideas and founders reviewing applicants
   - **Users/Roles**: identity, role assignment, and profile data  
   These are reflected in `lib/db/ideas.ts`, `lib/db/applications.ts`, `lib/db/users.ts`, and `lib/db/roles.ts`, plus server actions in `actions/*.ts`.

5. **Mutation layer: Server Actions**
   The `actions/` directory is the main write path for the app. It contains role-specific mutations for auth, ideas, applications, profiles, nav state, roles, and admin operations. This suggests most create/update flows are handled through **server actions** rather than client-side API calls, keeping form submissions and validation close to the server.

6. **Read/API layer**
   The `app/api/` routes are reserved for infrastructure and async services rather than ordinary CRUD pages:
   - `api/auth/[...nextauth]` for NextAuth
   - `api/ai/evaluate` and `api/ai/team-suggestions` for AI-powered scoring/suggestions
   - `api/db/init`, `api/db/migrate`, `api/db/seed-admin` for database setup and admin bootstrapping  
   This separates operational endpoints from the user-facing dashboards.

7. **AI subsystem**
   The AI layer is isolated in `lib/ai/evaluate.ts` and exposed through API routes. The UI includes `EvaluationReport`, `ScoreBreakdownChart`, and `VentureScoreGauge`, which indicates the app computes and displays **venture viability / team-fit scores** for ideas. AI output appears to support founder decision-making and possibly team building.

8. **Data access and persistence**
   `lib/db.ts` and the domain-specific DB modules form the data access boundary to a **Neon PostgreSQL** database. The presence of migration and seed routes plus `scripts/migrate.mjs` implies the app manages schema lifecycle programmatically. This means the architecture has a distinct persistence layer, not just ad hoc queries from components.

9. **Authentication and authorization**
   Authentication is handled by **NextAuth.js v5**, configured via `auth.ts` and `auth.config.ts`, with TypeScript augmentation in `next-auth.d.ts`. Authorization is enforced through `lib/auth/guards.ts` and `middleware.ts`, which likely prevent cross-role dashboard access and gate protected routes. This is a major architectural boundary: identity is centralized, but access is role-specific.

10. **Dashboard feature areas**
   - **Founder dashboard**: create/edit ideas, view applicants, build teams, inspect scores, manage profile
   - **Employee dashboard**: browse ideas, apply, track applications, manage profile
   - **Admin dashboard**: moderate ideas, manage users, inspect platform state  
   Shared UI components in `components/dashboard` power tables, forms, badges, cards, and evaluation visuals across these workflows.

11. **Shared UI and composition**
   `components/ui`, `components/landing`, and `components/dashboard` indicate a layered component strategy: reusable low-level inputs, marketing pages, and role-specific app widgets. This reduces duplication while keeping domain UIs separate from common primitives.

12. **Operational and deployment concerns**
   The project is configured for **Vercel** deployment and uses standard Next.js tooling plus Tailwind CSS, PostCSS, and TypeScript. Database initialization is exposed as a route, so the app’s runtime depends on environment-provided `DATABASE_URL` and `AUTH_SECRET`, with setup partially automated through routes and scripts.

13. **What an architecture diagram should emphasize**
   The key diagram boundaries are:
   - **Public site vs authenticated dashboards**
   - **Role-based dashboards vs shared UI**
   - **Server actions for mutations vs API routes for auth/AI/ops**
   - **Application logic vs DB access layer**
   - **AuthN/AuthZ layer guarding all protected routes**
   - **AI scoring subsystem feeding founder-facing decision UIs**

Main entry points: [`components/dashboard/DashboardShell.tsx`](https://github.com/magardeyash/minorproject/blob/master/components/dashboard/DashboardShell.tsx) (Dashboard UI), [`components/auth/AuthCard.tsx`](https://github.com/magardeyash/minorproject/blob/master/components/auth/AuthCard.tsx) (Auth UI), [`actions/ideas.ts`](https://github.com/magardeyash/minorproject/blob/master/actions/ideas.ts) (Server Actions), [`app/(auth)/layout.tsx`](https://github.com/magardeyash/minorproject/blob/master/app/(auth)/layout.tsx) (Auth Layout)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_public["Public"]
  node_landing["Landing<br/>public entry<br/>[page.tsx]"]
  node_appshell["App Shell<br/>root layout<br/>[layout.tsx]"]
end

subgraph group_auth["Auth"]
  node_authlayout["Auth Layout<br/>route shell<br/>[layout.tsx]"]
  node_founderlogin["Founder Login<br/>auth page<br/>[page.tsx]"]
  node_employeelogin["Employee Login<br/>auth page<br/>[page.tsx]"]
  node_adminlogin["Admin Login<br/>auth page<br/>[page.tsx]"]
end

subgraph group_dashboards["Dashboards"]
  node_founderdash["Founder Dash<br/>role shell<br/>[layout.tsx]"]
  node_employeedash["Employee Dash<br/>role shell<br/>[layout.tsx]"]
  node_admindash["Admin Dash<br/>role shell<br/>[layout.tsx]"]
end

subgraph group_backend["Backend"]
  node_ideasdomain[("Ideas DB<br/>data access<br/>[ideas.ts]")]
  node_applicationsdomain[("Apps DB<br/>data access<br/>[applications.ts]")]
  node_usersdomain[("Users DB<br/>data access<br/>[users.ts]")]
  node_rolesdomain[("Roles DB<br/>data access<br/>[roles.ts]")]
  node_actionslayer{{"Server Actions<br/>mutation layer<br/>[ideas.ts]"}}
  node_authactions{{"Auth Actions<br/>mutation layer<br/>[login.ts]"}}
  node_ailayer{{"AI Scoring<br/>[evaluate.ts]"}}
  node_authapi["NextAuth API<br/>api route<br/>[route.ts]"]
  node_opsapi["Ops APIs<br/>api route<br/>[route.ts]"]
end

subgraph group_shared["Shared UI"]
  node_dashboardui["Dashboard UI<br/>shared components<br/>[DashboardShell.tsx]"]
  node_authui["Auth UI<br/>shared components<br/>[AuthCard.tsx]"]
  node_controls["UI Primitives<br/>shared components<br/>[FormInput.tsx]"]
end

node_landing -->|"routes to"| node_authlayout
node_authlayout -->|"hosts"| node_founderlogin
node_authlayout -->|"hosts"| node_employeelogin
node_authlayout -->|"hosts"| node_adminlogin
node_founderlogin -->|"uses"| node_authui
node_employeelogin -->|"uses"| node_authui
node_adminlogin -->|"uses"| node_authui
node_authui -->|"composes"| node_controls
node_founderdash -->|"uses"| node_dashboardui
node_employeedash -->|"uses"| node_dashboardui
node_admindash -->|"uses"| node_dashboardui
node_dashboardui -->|"reads/writes"| node_ideasdomain
node_dashboardui -->|"reads/writes"| node_applicationsdomain
node_dashboardui -->|"reads/writes"| node_usersdomain
node_actionslayer -->|"mutates"| node_ideasdomain
node_actionslayer -->|"mutates"| node_applicationsdomain
node_actionslayer -->|"mutates"| node_usersdomain
node_actionslayer -->|"mutates"| node_rolesdomain
node_authactions -->|"feeds"| node_authapi
node_authapi -->|"authz data"| node_rolesdomain
node_opsapi -->|"initializes"| node_ideasdomain
node_opsapi -->|"initializes"| node_usersdomain
node_ailayer -->|"analyzes"| node_ideasdomain
node_ailayer -->|"surfaces in"| node_dashboardui
node_appshell -->|"hosts"| node_dashboardui
node_appshell -->|"hosts"| node_authui

click node_landing "https://github.com/magardeyash/minorproject/blob/master/app/page.tsx"
click node_appshell "https://github.com/magardeyash/minorproject/blob/master/app/layout.tsx"
click node_authlayout "https://github.com/magardeyash/minorproject/blob/master/app/(auth)/layout.tsx"
click node_founderlogin "https://github.com/magardeyash/minorproject/blob/master/app/(auth)/login/founder/page.tsx"
click node_employeelogin "https://github.com/magardeyash/minorproject/blob/master/app/(auth)/login/employee/page.tsx"
click node_adminlogin "https://github.com/magardeyash/minorproject/blob/master/app/(auth)/login/admin/page.tsx"
click node_founderdash "https://github.com/magardeyash/minorproject/blob/master/app/dashboard/founder/layout.tsx"
click node_employeedash "https://github.com/magardeyash/minorproject/blob/master/app/dashboard/employee/layout.tsx"
click node_admindash "https://github.com/magardeyash/minorproject/blob/master/app/admin/dashboard/layout.tsx"
click node_ideasdomain "https://github.com/magardeyash/minorproject/blob/master/lib/db/ideas.ts"
click node_applicationsdomain "https://github.com/magardeyash/minorproject/blob/master/lib/db/applications.ts"
click node_usersdomain "https://github.com/magardeyash/minorproject/blob/master/lib/db/users.ts"
click node_rolesdomain "https://github.com/magardeyash/minorproject/blob/master/lib/db/roles.ts"
click node_actionslayer "https://github.com/magardeyash/minorproject/blob/master/actions/ideas.ts"
click node_authactions "https://github.com/magardeyash/minorproject/blob/master/actions/auth/login.ts"
click node_ailayer "https://github.com/magardeyash/minorproject/blob/master/lib/ai/evaluate.ts"
click node_authapi "https://github.com/magardeyash/minorproject/blob/master/app/api/auth/[...nextauth]/route.ts"
click node_opsapi "https://github.com/magardeyash/minorproject/blob/master/app/api/db/init/route.ts"
click node_dashboardui "https://github.com/magardeyash/minorproject/blob/master/components/dashboard/DashboardShell.tsx"
click node_authui "https://github.com/magardeyash/minorproject/blob/master/components/auth/AuthCard.tsx"
click node_controls "https://github.com/magardeyash/minorproject/blob/master/components/ui/FormInput.tsx"

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_landing,node_appshell toneBlue
class node_authlayout,node_founderlogin,node_employeelogin,node_adminlogin toneAmber
class node_founderdash,node_employeedash,node_admindash toneMint
class node_ideasdomain,node_applicationsdomain,node_usersdomain,node_rolesdomain,node_actionslayer,node_authactions,node_ailayer,node_authapi,node_opsapi toneRose
class node_dashboardui,node_authui,node_controls toneIndigo
```

## Components

### Public

Landing and unauthenticated entry points

- [Landing](https://github.com/magardeyash/minorproject/blob/master/app/page.tsx): public entry · Marketing homepage and public app entry · `app/page.tsx`
- [App Shell](https://github.com/magardeyash/minorproject/blob/master/app/layout.tsx): root layout · Global application layout and styles · `app/layout.tsx`

### Auth

Role-specific sign-in and registration flows

- [Auth Layout](https://github.com/magardeyash/minorproject/blob/master/app/(auth)/layout.tsx): route shell · Shared wrapper for authentication pages · `app/(auth)/layout.tsx`
- [Founder Login](https://github.com/magardeyash/minorproject/blob/master/app/(auth)/login/founder/page.tsx): auth page · Founder sign-in entry · `app/(auth)/login/founder/page.tsx`
- [Employee Login](https://github.com/magardeyash/minorproject/blob/master/app/(auth)/login/employee/page.tsx): auth page · Employee sign-in entry · `app/(auth)/login/employee/page.tsx`
- [Admin Login](https://github.com/magardeyash/minorproject/blob/master/app/(auth)/login/admin/page.tsx): auth page · Admin sign-in entry · `app/(auth)/login/admin/page.tsx`

### Dashboards

Authenticated role-based application shells

- [Founder Dash](https://github.com/magardeyash/minorproject/blob/master/app/dashboard/founder/layout.tsx): role shell · Founder dashboard layout and navigation shell · `app/dashboard/founder/layout.tsx`
- [Employee Dash](https://github.com/magardeyash/minorproject/blob/master/app/dashboard/employee/layout.tsx): role shell · Employee dashboard layout and navigation shell · `app/dashboard/employee/layout.tsx`
- [Admin Dash](https://github.com/magardeyash/minorproject/blob/master/app/admin/dashboard/layout.tsx): role shell · Admin dashboard layout and navigation shell · `app/admin/dashboard/layout.tsx`

### Backend

Actions, data access, AI, and operational routes

- [Ideas DB](https://github.com/magardeyash/minorproject/blob/master/lib/db/ideas.ts): data access · Idea persistence and querying boundary · `lib/db/ideas.ts`
- [Apps DB](https://github.com/magardeyash/minorproject/blob/master/lib/db/applications.ts): data access · Application persistence and querying boundary · `lib/db/applications.ts`
- [Users DB](https://github.com/magardeyash/minorproject/blob/master/lib/db/users.ts): data access · User and profile persistence boundary · `lib/db/users.ts`
- [Roles DB](https://github.com/magardeyash/minorproject/blob/master/lib/db/roles.ts): data access · Role assignment and authorization data · `lib/db/roles.ts`
- [Server Actions](https://github.com/magardeyash/minorproject/blob/master/actions/ideas.ts): mutation layer · Primary write path for forms and role workflows · `actions/ideas.ts`
- [Auth Actions](https://github.com/magardeyash/minorproject/blob/master/actions/auth/login.ts): mutation layer · Login and registration server actions · `actions/auth/login.ts`
- [AI Scoring](https://github.com/magardeyash/minorproject/blob/master/lib/ai/evaluate.ts): service · Idea evaluation and team suggestion service layer · `lib/ai/evaluate.ts`
- [NextAuth API](https://github.com/magardeyash/minorproject/blob/master/app/api/auth/[...nextauth]/route.ts): api route · Authentication callback and session endpoint · `app/api/auth/[...nextauth]/route.ts`
- [Ops APIs](https://github.com/magardeyash/minorproject/blob/master/app/api/db/init/route.ts): api route · Database init, migrate, and seed endpoints · `app/api/db/init/route.ts`

### Shared UI

Reusable UI and dashboard components

- [Dashboard UI](https://github.com/magardeyash/minorproject/blob/master/components/dashboard/DashboardShell.tsx): shared components · Reusable dashboard forms, tables, cards, and visuals · `components/dashboard/DashboardShell.tsx`
- [Auth UI](https://github.com/magardeyash/minorproject/blob/master/components/auth/AuthCard.tsx): shared components · Reusable login and registration form components · `components/auth/AuthCard.tsx`
- [UI Primitives](https://github.com/magardeyash/minorproject/blob/master/components/ui/FormInput.tsx): shared components · Shared input and logo building blocks · `components/ui/FormInput.tsx`

## Connections

- Landing → Auth Layout: routes to · Public users move into auth flows from the landing surface
- Auth Layout → Founder Login: hosts · Shared auth shell renders role-specific login pages
- Auth Layout → Employee Login: hosts · Shared auth shell renders role-specific login pages
- Auth Layout → Admin Login: hosts · Shared auth shell renders role-specific login pages
- Founder Login → Auth UI: uses · Founder login is built from shared auth components
- Employee Login → Auth UI: uses · Employee login is built from shared auth components
- Admin Login → Auth UI: uses · Admin login is built from shared auth components
- Auth UI → UI Primitives: composes · Auth forms rely on shared input primitives
- Founder Dash → Dashboard UI: uses · Founder dashboard pages use shared shell and widgets
- Employee Dash → Dashboard UI: uses · Employee dashboard pages use shared shell and widgets
- Admin Dash → Dashboard UI: uses · Admin dashboard pages use shared shell and widgets
- Dashboard UI → Ideas DB: reads/writes · Dashboard features operate on idea records
- Dashboard UI → Apps DB: reads/writes · Application workflows depend on application records
- Dashboard UI → Users DB: reads/writes · Profile and user views depend on user data
- Server Actions → Ideas DB: mutates · Server actions persist idea changes
- Server Actions → Apps DB: mutates · Server actions persist application changes
- Server Actions → Users DB: mutates · Server actions update profiles and user state
- Server Actions → Roles DB: mutates · Server actions manage role-related state
- Auth Actions → NextAuth API: feeds · Auth actions work with the NextAuth session boundary
- NextAuth API → Roles DB: authz data · Authentication ties into role and access data
- Ops APIs → Ideas DB: initializes · Operational routes prepare the database and seed data
- Ops APIs → Users DB: initializes · Operational routes prepare the database and seed data
- AI Scoring → Ideas DB: analyzes · AI scoring evaluates idea data and team fit
- AI Scoring → Dashboard UI: surfaces in · AI outputs are displayed in founder-facing dashboard visuals
- App Shell → Dashboard UI: hosts · Global app shell supports the dashboard experience
- App Shell → Auth UI: hosts · Global app shell also wraps auth UI
