How magardeyash/minorproject works
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: DashboardShell.tsx Dashboard UI · AuthCard.tsx Auth UI · ideas.ts Server Actions · layout.tsx Auth Layout
Components 21
Public
Landing and unauthenticated entry points
Auth
Role-specific sign-in and registration flows
- Auth Layout · Shared wrapper for authentication pages
app/(auth)/layout.tsx - Founder Login · Founder sign-in entry
app/(auth)/login/founder/page.tsx - Employee Login · Employee sign-in entry
app/(auth)/login/employee/page.tsx - Admin Login · Admin sign-in entry
app/(auth)/login/admin/page.tsx
Dashboards
Authenticated role-based application shells
- Founder Dash · Founder dashboard layout and navigation shell
app/dashboard/founder/layout.tsx - Employee Dash · Employee dashboard layout and navigation shell
app/dashboard/employee/layout.tsx - Admin Dash · Admin dashboard layout and navigation shell
app/admin/dashboard/layout.tsx
Backend
Actions, data access, AI, and operational routes
- Ideas DB · Idea persistence and querying boundary
lib/db/ideas.ts - Apps DB · Application persistence and querying boundary
lib/db/applications.ts - Users DB · User and profile persistence boundary
lib/db/users.ts - Roles DB · Role assignment and authorization data
lib/db/roles.ts - Server Actions · Primary write path for forms and role workflows
actions/ideas.ts - Auth Actions · Login and registration server actions
actions/auth/login.ts - AI Scoring · Idea evaluation and team suggestion service layer
lib/ai/evaluate.ts - NextAuth API · Authentication callback and session endpoint
app/api/auth/[...nextauth]/route.ts - Ops APIs · Database init, migrate, and seed endpoints
app/api/db/init/route.ts
Shared UI
Reusable UI and dashboard components
- Dashboard UI · Reusable dashboard forms, tables, cards, and visuals
components/dashboard/DashboardShell.tsx - Auth UI · Reusable login and registration form components
components/auth/AuthCard.tsx - UI Primitives · Shared input and logo building blocks
components/ui/FormInput.tsx
Connections 26
- 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