How kumarancnpalani/odoo- works
Purpose and Entry Points
AssetFlow is a Next.js App Router application for enterprise IT asset registry, custody, reservations, maintenance, and physical audits. The public root routes users into authentication and the protected dashboard:
• src/app/page.tsx
• src/app/login/page.tsx
• src/app/dashboard/layout.tsx
• src/middleware.ts
Application Shell and Access Control
The dashboard layout provides the shared authenticated workspace and navigation; login submits through server-side auth actions. Middleware is the request boundary for route protection, while JWT/auth utilities provide session handling.
• src/app/dashboard/layout.tsx
• src/app/login/loginForm.tsx
• src/app/actions/authActions.ts
• src/lib/auth.ts
Persistence and Initialization
Prisma maps the relational AssetFlow domain to MySQL. The schema is the system-of-record boundary for assets, people, allocations, bookings, maintenance, and audit records. Database initialization and seed routines run schema/bootstrap checks for development deployment.
• prisma/schema.prisma
• prisma/seed.ts
• src/lib/prisma.ts
• src/lib/initDb.ts
Server-Action Domain Boundary
Mutating business workflows are implemented as Next.js Server Actions rather than a separate API layer. UI consoles invoke these actions for authorization-sensitive database updates, validation, status transitions, imports, and revalidation.
• src/app/actions/assetActions.ts
• src/app/actions/bookingActions.ts
• src/app/actions/maintenanceActions.ts
• src/app/actions/auditActions.ts
Asset Registry and Custody Flow
The assets directory manages catalog records, category-driven metadata, serials, tags, locations, condition, and availability. Allocation operations connect assets to employees/departments, enforce custody conflict rules, and support returns and transfer workflows.
• src/app/dashboard/assets/assetsDirectory.tsx
• src/app/dashboard/allocations/allocationsConsole.tsx
• src/app/actions/assetActions.ts
• src/app/actions/bookingActions.ts
Scheduling and Maintenance Flow
Bookable assets pass through reservation overlap validation before bookings are persisted. Maintenance uses a stateful repair workflow: assignment and repair status changes affect the linked asset’s availability/maintenance status.
• src/app/dashboard/bookings/bookingsConsole.tsx
• src/app/dashboard/maintenance/page.tsx
• src/components/maintenanceConsole.tsx
• src/app/actions/maintenanceActions.ts
Audit, Setup, and Operational I/O
Audit cycles generate assigned verification workflows and persist outcomes such as verified, missing, or damaged assets. Setup centralizes master-data administration and bulk imports. CSV utilities form the import/export boundary; SMTP mail sends workflow notifications externally.
• src/app/dashboard/audit/auditConsole.tsx
• src/app/dashboard/setup/setupTabs.tsx
• src/app/actions/importActions.ts
• src/lib/csvUtils.ts
• src/lib/mail.ts
Runtime and Infrastructure
The application runs on Next.js 16 with React 19 Server Components/Server Actions and Tailwind styling. It depends on a MySQL database via Prisma, SMTP via Nodemailer, and environment-provided database, JWT, and mail credentials. Deployment is compatible with the referenced Vercel-hosted instance.
• next.config.ts
• package.json
• src/lib/db.ts
• src/lib/runInit.ts
Main entry points: layout.tsx Dashboard shell · prisma.ts Prisma data access · auditActions.ts Audit actions · importActions.ts Import actions
Components 21
Access & Shell
- Public entry · Routes users into authentication.
src/app/page.tsx - Login form · Submits server-side authentication.
src/app/login/loginForm.tsx - Auth actions & JWT · Authenticates users and manages sessions.
src/app/actions/authActions.ts - Route middleware · Protects dashboard routes before rendering.
src/middleware.ts - Dashboard shell · Provides shared protected navigation and layout.
src/app/dashboard/layout.tsx
Dashboard Consoles
- Asset registry · Manages catalog, metadata, tags, locations, and availability.
src/app/dashboard/assets/assetsDirectory.tsx - Custody console · Handles allocation, return, and transfer workflows.
src/app/dashboard/allocations/allocationsConsole.tsx - Bookings console · Schedules reservations for bookable assets.
src/app/dashboard/bookings/bookingsConsole.tsx - Maintenance console · Tracks assignment and repair lifecycle.
src/components/maintenanceConsole.tsx - Audit console · Runs assigned physical verification cycles.
src/app/dashboard/audit/auditConsole.tsx - Setup & imports · Administers master data and bulk operations.
src/app/dashboard/setup/setupTabs.tsx
Server Actions
- Asset actions · Validates asset and custody state changes.
src/app/actions/assetActions.ts - Booking actions · Enforces reservation overlap rules before persistence.
src/app/actions/bookingActions.ts - Maintenance actions · Updates repair state and linked asset availability.
src/app/actions/maintenanceActions.ts - Audit actions · Generates audit work and records verification outcomes.
src/app/actions/auditActions.ts - Import actions · Executes bulk data ingestion.
src/app/actions/importActions.ts
Data & Operations
- Prisma data access · Connects server workflows to the relational domain.
src/lib/prisma.ts - AssetFlow schema · System of record for assets, people, allocations, bookings, maintenance, and audits.
prisma/schema.prisma - CSV I/O
src/lib/csvUtils.ts - SMTP notifications · Sends workflow notifications through Nodemailer.
src/lib/mail.ts - Database bootstrap · Runs schema and development bootstrap checks.
src/lib/initDb.ts
Connections 25
- Public entry → Login form: directs unauthenticated users
- Login form → Auth actions & JWT: submits credentials
- Auth actions & JWT → Route middleware: establishes session
- Route middleware → Dashboard shell: permits protected request
- Dashboard shell → Asset registry: hosts
- Dashboard shell → Custody console: hosts
- Dashboard shell → Bookings console: hosts
- Dashboard shell → Maintenance console: hosts
- Dashboard shell → Audit console: hosts
- Dashboard shell → Setup & imports: hosts
- Asset registry → Asset actions: mutates registry
- Custody console → Asset actions: changes custody
- Bookings console → Booking actions: creates reservations
- Maintenance console → Maintenance actions: updates repair workflow
- Audit console → Audit actions: records outcomes
- Setup & imports → Import actions: runs bulk import
- Import actions → CSV I/O: parses and exports CSV
- Asset actions → Prisma data access: persists changes
- Booking actions → Prisma data access: validates and persists
- Maintenance actions → Prisma data access: updates linked asset state
- Audit actions → Prisma data access: persists audit outcomes
- Import actions → Prisma data access: writes imported data
- Prisma data access → AssetFlow schema: maps domain models
- Database bootstrap → AssetFlow schema: bootstraps
- Audit actions → SMTP notifications: sends notifications