How hwy21i/apex-develoment works
This repository is a construction-operations ERP: users manage projects and operational records through a Next.js application, while API routes authenticate requests, perform domain operations, and persist data in MongoDB. The graph highlights project/task management, procurement and inventory, reporting/search, and shared access/runtime layers. The README is only the generic Next.js starter README; domain capabilities are inferred from the repository tree and sampled source. Unsampled modules are included only where their paths and roles are clear; their internal links are omitted when evidence is unavailable.
Main entry points: tasks/route.ts Task API · mongodb.ts MongoDB connector · guard.ts Permission guard · dashboard/route.ts Dashboard metrics
Components 22
User experience
- App shell
components/layout/AppShell.tsx - Session provider
components/auth/UserProvider.tsx - Record client
hooks/useRecords.ts - Project workspace
app/projects/[projectId]/overview/page.tsx
Project operations
- Projects API
app/api/projects/route.ts - Task workspace
app/projects/[projectId]/tasks/page.tsx - Task API
app/api/tasks/route.ts - Dashboard metrics
app/api/dashboard/route.ts
Supply and inventory
- Procurement requests
app/procurement/requests/page.tsx - Goods receipts
app/api/goods-receipts/route.ts - Inventory workspace
app/inventory/page.tsx
Platform services
- Global search
app/api/search/route.ts - PDF reports
app/api/reports/pdf/route.ts - Authentication API
app/api/auth/me/route.ts - Permission guard
lib/auth/guard.ts - Project access
lib/services/access.ts - Audit service
lib/services/audit.ts
Persistence
- MongoDB connector
lib/db/mongodb.ts - Project records
models/Project.ts - Task records
models/Task.ts - Supply records
models/GoodsReceipt.ts
Other components
- ERP user
Connections 29
- ERP user → App shell: uses
- App shell → Session provider: reads session
components/layout/AppShell.tsx - Session provider → Authentication API: fetches session
components/auth/UserProvider.tsx - Session provider → Authentication API: requests logout
components/auth/UserProvider.tsx - Record client → Projects API: fetches projects
hooks/useRecords.ts - Record client → Inventory workspace: supports records
app/inventory/page.tsx - Task workspace → App shell: uses shell
- Procurement requests → App shell: uses shell
app/procurement/requests/page.tsx - Task API → Permission guard: checks permission
app/api/tasks/route.ts - Task API → Project access: checks project access
app/api/tasks/route.ts - Task API → MongoDB connector: connects database
app/api/tasks/route.ts - Task API → Task records: reads and writes
app/api/tasks/route.ts - Task API → Audit service: logs changes
app/api/tasks/route.ts - Task API → Project records: refreshes metrics
app/api/tasks/route.ts - Dashboard metrics → Permission guard: checks permission
app/api/dashboard/route.ts - Dashboard metrics → MongoDB connector: connects database
app/api/dashboard/route.ts - Dashboard metrics → Project records: queries projects
app/api/dashboard/route.ts - Dashboard metrics → Task records: queries tasks
app/api/dashboard/route.ts - Goods receipts → Permission guard: checks permission
app/api/goods-receipts/route.ts - Goods receipts → Project access: checks project access
app/api/goods-receipts/route.ts - Goods receipts → MongoDB connector: connects database
app/api/goods-receipts/route.ts - Goods receipts → Supply records: creates receipts
app/api/goods-receipts/route.ts - Global search → MongoDB connector: connects database
app/api/search/route.ts - Global search → Project records: searches projects
app/api/search/route.ts - Global search → Task records: searches tasks
app/api/search/route.ts - PDF reports → MongoDB connector: connects database
app/api/reports/pdf/route.ts - PDF reports → Permission guard: checks permission
app/api/reports/pdf/route.ts - PDF reports → Project records: queries projects
app/api/reports/pdf/route.ts - Permission guard → MongoDB connector: loads user
lib/auth/guard.ts