How cloud-native-group-1/leave-n-attendance-frontend works
Project type and purpose
• This is a full-stack Next.js web application for leave and attendance management (frontend + serverless backend/API calls).
• It offers features such as leave requests, attendance tracking, team monitoring, notifications, and reports.
File structure
• app/ – Next.js “app” directory (layouts, pages, SSR/SSG routes).
• components/ – Reusable UI components (dialogs, tables, charts, sidebar, UI primitives under ui/).
• hooks/ – Custom React hooks (e.g., use-auth, use-mobile).
• lib/services/ – API client layer (calendar, leave-request, user, team, notifications, etc.).
• ci/cd files – GitHub Actions workflows, Dockerfile, Vercel/Cloud Run config.
• tests/ – Unit tests (Jest) and end-to-end tests (Playwright).
README insights
• CI: Jest unit tests, Playwright E2E tests, GitHub Actions.
• CD: Vercel auto-deploy on main, Docker + Cloud Run.
• No direct DB logic in the repo (assumes backend APIs are external or serverless).
a. Client (Browser)
• Users interact via browser, mobile, or desktop.
b. Next.js Frontend
• Pages and layouts under app/, renders UI.
• Uses components/ and hooks/ for client-side logic.
• Server-side rendering and API routes (if any).
c. API Client Layer
• lib/services/*: fetch wrappers for REST endpoints.
• lib/api.ts: central HTTP client.
d. External Backend / REST API
• Hosted elsewhere or via Cloud Run.
• Implements business logic, persistence, authentication.
e. Database & Auth
• May be a managed Postgres/MongoDB, plus an auth provider (e.g., NextAuth or OAuth).
f. CI/CD Pipeline
• GitHub Actions running Jest and Playwright.
• Docker build for Cloud Run, Vercel deployment.
Relationships & data flow
• Browser → Next.js Frontend (SSR/CSR)
• Next.js Frontend → lib/services → External REST API
• REST API ↔ Database
• REST API ↔ Auth Service
• CI systems push to repositories → GitHub Actions → tests → build → deployment to Vercel/Cloud Run
Architectural patterns & design principles
• Separation of concerns: UI (components/) vs. Data fetching (lib/services) vs. State (hooks/)
• Server-side rendering (SSR) for initial page loads, client-side navigation for speed
• API client abstraction layer for testability and reuse
• Modular UI via atomic “ui/” primitives and higher-order components