# rituraj-anos/checkinmate architecture

> Architecture diagram of the GitHub repository rituraj-anos/checkinmate, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-09-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/rituraj-anos/checkinmate
- Repository: https://github.com/rituraj-anos/checkinmate

## Overview

##### Project Type & Purpose
- This is a full-stack web application (“CheckinMate”) built with Next.js (React) on the frontend and Next.js API routes on the backend, persisting data in Firebase Firestore.
- Purpose: real-time student attendance tracking via RFID tags, intended for hackathon use with easy deployment on Vercel.

##### File-Structure Analysis
- Top-Level Directories & Files
- public/ – static assets
- src/app/ – Next.js App Router routes & API endpoints
‑ page.tsx, layout.tsx, global-error.tsx, globals.css
‑ api/scan/route.ts (RFID scan ingestion)
‑ api/student/route.ts (student CRUD)
- src/components/ – presentational & layout React components
- src/components/ui/ – reusable UI primitives (buttons, dialogs, tables, etc.)
- src/hooks/ & src/lib/ – custom hooks and utilities, including firebase.ts connection
- simulate_scan.py – external script simulating RFID scans
- config files: next.config.ts, postcss.config.mjs, eslint.config.mjs

##### README Insights
- Technology stack: Next.js, Firebase Firestore, React
- Core features: add/edit students, real-time attendance, RFID support
- Deployment target: Vercel

##### Main Components
a. Client (Web Browser – React UI)
b. Next.js Frontend Server (SSR/CSR)
c. Next.js Serverless API Layer
- /api/student (student CRUD)
- /api/scan (RFID scan ingestion)
d. Firebase Firestore (NoSQL database)
e. simulate_scan.py (external scan simulator)
f. Vercel Hosting (deployment platform)

##### Architectural Patterns & Design Principles
- Full-stack separation: clear boundary between UI, API, and data persistence
- Serverless micro-endpoints (per-route functions) for scan and student services
- Real-time data flow via Firestore listeners
- Reusable UI primitives (atomic design in src/components/ui)

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Main Layers
    Browser["Web Browser (React UI)"]:::compute
    Frontend["Next.js Frontend Server (SSR/CSR)"]:::compute
    subgraph "API Layer"
        student["Student CRUD API"]:::compute
        scan["RFID Scan Ingestion API"]:::compute
    end
    DB["Firebase Firestore"]:::db
    Sim["simulate_scan.py"]:::external
    Vercel["Vercel Hosting"]:::platform

    %% Connections
    Browser -- HTTP/WS --> Frontend
    Frontend -- REST calls --> student
    Frontend -- REST calls --> scan
    student -- Read/Write --> DB
    scan -- Read/Write --> DB
    Sim -- HTTP POST --> scan
    DB -- Real-time updates --> Frontend
    Frontend --> Vercel

    %% Click Events
    click Browser "https://github.com/rituraj-anos/checkinmate/blob/main/src/app/page.tsx"
    click Frontend "https://github.com/rituraj-anos/checkinmate/blob/main/src/app/layout.tsx"
    click student "https://github.com/rituraj-anos/checkinmate/blob/main/src/app/api/student/route.ts"
    click scan "https://github.com/rituraj-anos/checkinmate/blob/main/src/app/api/scan/route.ts"
    click DB "https://github.com/rituraj-anos/checkinmate/blob/main/src/lib/firebase.ts"
    click Sim "https://github.com/rituraj-anos/checkinmate/blob/main/simulate_scan.py"

    %% Styles
    classDef compute fill:#bbdefb,stroke:#1e88e5,color:#0d47a1,stroke-width:2px;
    classDef db fill:#c8e6c9,stroke:#388e3c,color:#1b5e20,stroke-width:2px,shape:cylinder;
    classDef external fill:#e0e0e0,stroke:#757575,color:#424242,stroke-width:2px;
    classDef platform fill:#ffe0b2,stroke:#fb8c00,color:#e65100,stroke-width:2px;border-radius:50%;
    class Vercel platform;
```
