How juanmgualteros/droker-agentic-hub works
Main Components
• Frontend (Client/UI):
• Built with Next.js 14 and TypeScript.
• Uses folder-based routing (see directories under src/app, e.g., locale-specific folders for admin, login, superadmin, etc.).
• Contains comprehensive UI components (src/components) like layout components (AppLayout, PortalLayout, etc.), navigation, forms, and specialized admin/superadmin components.
• Implements internationalization (i18n) using next-intl (see src/i18n and localization files).
• API / Backend Endpoints:
• API routes are defined under src/app/api (e.g., admin-users, organizations, products, and superadmin endpoints).
• These endpoints coordinate business logic and interact with the data layer.
• Database & ORM:
• PostgreSQL is used along with Prisma ORM.
• The prisma folder holds the schema, migrations, and seed scripts.
• The lib directory contains database connection implementations (e.g., src/lib/db/prisma.ts) and helper functions.
• External Services / Integration:
• Supabase is used for storage and additional services (see src/lib/supabase and Supabase-related SQL files).
• Environment variables include all links necessary to connect to the Supabase project alongside a secret key for cookie-based authentication.
• Middleware & Configuration:
• Global middlewares (middleware.ts at the root and in src/) are used for processes like cookie validation and edge runtime adaptations.
• Configuration files such as next.config.js, tailwind.config.js, and vercel.json provide environment- and deployment-related settings.
Relationships and Interactions
• The Client/UI layer (rendered by Next.js) sends requests (often via fetch or dedicated fetch/use client hooks) to the API endpoints.
• API endpoints process requests, validate authentication (using cookie-based mechanisms likely implemented in middleware.ts), and interact with the database through Prisma.
• The database (PostgreSQL) is accessed via the Prisma ORM to perform CRUD operations.
• Frontend and API layers also incorporate internationalization, wherein locale-specific pages and content are served to users.
Architectural Patterns and Design Principles
• The project follows Next.js best practices with a clear separation of concerns: the presentation layer (pages/components), an API layer (serverless functions/routed API endpoints), and a persistence layer (Prisma & PostgreSQL).
• It leverages a modular file structure (separated directories for admin, superadmin, and user functionalities) which improves maintainability.
• Middleware usage ensures security (authentication and edge runtime support) at the request handling level.
• The design is component-driven, with reusable UI components (organized in src/components) and style tokens and themes (under src/styles/design-system).
Relevant Technologies and Their Roles
• Next.js 14: Provides the App Router, SSR, and client-side routing.
• TypeScript: Ensures type safety across both frontend and backend.
• Tailwind CSS: Used for consistent design and responsive styling.
• Prisma ORM & PostgreSQL: Manage data modeling and persistence.
• Supabase: Provides storage and additional cloud functions.
• next-intl: Handles internationalization for a multi-locale experience.