How prathameshp107/clinlabops works
Project Type and Purpose
• This is a full-stack admin dashboard built with Next.js (App Router), React, Tailwind CSS and ShadCN UI.
• Its goal is to provide a unified interface for laboratory task management, customer enquiries, project management, experiment tracking, inventory control, user/role management and authentication.
File Structure & Architectural Patterns
• Top-level “src/app” directory holds all route handlers and layouts – a feature-based folder structure (admin-dashboard, enquiries, tasks, projects, experiments, inventory, user-management, auth flows).
• “src/components” is organized by domain (dashboard, task-management, project-management, experiment-management, inventory-management, user-management, auth, ui primitives).
• Utility, hook, data and store modules under “src/lib”, “src/hooks”, “src/data”, “src/store” implement shared logic, mock data, global state (Zustand, Context), API helpers (Axios/React-Query), and validation (Zod).
• No in-repo API routes are visible – the frontend likely consumes external REST/GraphQL microservices or serverless functions (e.g., Auth via NextAuth.js).
Main Components
a. Client Layer
• Web Browser / Mobile Browser
• Next.js App (App-Router/Server Components + Client Components)
b. Presentation Layer
• UI Library: ShadCN UI + Tailwind CSS
• Layouts & Pages (src/app/layout.js, page.js, nested route layouts)
• Reusable UI Components (src/components/ui, dashboard, feature-specific)
c. State & Data Layer
• React Context & Zustand for client state
• React Query + Axios for data fetching
• Form handling: React Hook Form + Zod
d. Authentication & Authorization
• NextAuth.js (JWT, OAuth providers: GitHub, Google)
• Two-Factor flow (2FA form component)
• Role-Based Access Control (Admin, Scientist, Technician, Reviewer)
e. API & Backend Services
• External LabTasker API (microservices for tasks, projects, enquiries, experiments, inventory, users)
• Database(s): e.g. PostgreSQL or MongoDB (data persistence)
• File Storage / CDN (lab reports, document uploads)
• Email Service (SMTP or third-party for notifications)
• Analytics / Logging Service (system logs, usage metrics)
f. Third-Party Integrations
• Charts: Recharts
• Animations: Framer Motion, Lottie (Aceternity UI)
• Date handling: date-fns
• PDF generation: react-pdf
• Internationalization: next-intl
• CI/CD: GitHub Actions (nextjs.yml)
Relationships & Data Flows
• User → Browser → Next.js SSR/CSR → React Components
• Components dispatch fetches via React Query/Axios → External API
• API ↔ Database (CRUD for tasks, enquiries, etc.)
• NextAuth.js ↔ OAuth Providers / Identity store
• File Uploads → Cloud Storage → Asset URLs served via CDN
• Notification events → Email Service (SMTP/SendGrid)
• Analytics events → Logging Service
Architectural Patterns & Design Principles
• Feature-based modular structure for clarity and scalability
• Separation of concerns: UI, state management, data access, auth
• Hybrid SSR/CSR using Next.js App Router and Server Components
• Component reusability: atomic UI primitives in src/components/ui
• Unidirectional data flow: React Query for server state, Zustand/Context for client state
• API-first approach: frontend decoupled from backend via REST/GraphQL