How keval144/litlib works
Project type and purpose
• LitLib is a full-stack web application—a modern library management system—built on Next.js 14 App Router.
• It provides a responsive dashboard for managing book inventory, members, analytics, role-based access, notifications, backups, and more.
File structure
• Top-level folders:
• app/ – Next.js “App Router” entry points (page.tsx, layout.tsx, error.tsx, providers.tsx).
• components/ – UI primitives and shared elements (Navbar, Footer, ThemeSwitch, etc.).
• config/ – site-wide constants (fonts, theming).
• prisma/ – schema.prisma defining the MySQL data model.
• public/ – static assets (logos, manifest.json).
• styles/ – global CSS (Tailwind).
• types/ – shared TypeScript types.
• Config/build files: next.config.js, tsconfig.json, tailwind.config.js, eslint.config.mjs.
• package.json / lock file list dependencies: Next.js, Prisma, NextAuth, HeroUI, Shadcn UI, etc.
Key insights from README
• Tech stack: Next.js 14 App Router, TypeScript, Tailwind CSS + Variants, HeroUI v2, Shadcn UI, Framer Motion, Prisma + MySQL, NextAuth.js.
• Core features: inventory CRUD, role-based auth, analytics dashboard, theme switch, image uploads, email notifications, rate limiting, backups.
Main components & their interactions
a. Client (Browser)
• React / Next.js pages & components (SSR / SSG / CSR).
• Tailwind / HeroUI / Shadcn UI for styling and layout.
• Framer Motion for animations.
b. Next.js Server (Node.js)
• App Router handlers (app/api/…) exposing REST/JSON endpoints.
• NextAuth.js for authentication & session management.
• Business logic for books, members, borrowing, fines, backups, rate limiting.
c. Database Layer
• Prisma ORM translating queries to MySQL.
• Entities: User, Role, Book, Loan, Backup, Notification, etc.
d. External Services
• SMTP or transactional email provider (SendGrid/Mailer) for notifications.
• Optional file storage or DB-backups (could be local or S3).
Architectural patterns & principles
• Next.js App Router pattern (Layouts → Pages → Server/Client Components).
• Provider pattern (app/providers.tsx) to inject theme, auth context.
• Atomic UI components under components/primitives.ts.
• ORM layer (Prisma) separating data access from business logic.
• Modular config via config/*.
• Role-based access controls and middleware at route layer.