How aamnaqueen94-dotcom/supperweb-ai works
Purpose and entry points
This is a large Next.js/TypeScript modular web platform spanning AI, messaging, productivity, media, browser capabilities, commerce, and domain tools. The main UI entry is src/app/page.tsx; global rendering and cross-cutting setup begin in src/app/layout.tsx and src/middleware.ts. HTTP backend entry points are Next App Router handlers under src/app/api.
Route composition and feature surfaces
App Router route groups separate public, authentication, and dashboard experiences, while feature namespaces own their layouts and pages. Major surfaces include AI, messaging, cloud storage, meetings, maps, education, games, payments, and browser APIs.
• src/app/(auth)/layout.tsx
• src/app/(dashboard)/layout.tsx
• src/app/ai/layout.tsx
Pages generally compose domain-specific view components, feature components, hooks, and client-side state rather than embedding backend behavior directly.
• src/components/views/messaging-view.tsx
• src/components/ai/ai-chat/ai-chat.tsx
• src/hooks/messaging/use-messaging.ts
API boundary and request handling
src/app/api/**/route.ts is the server boundary for browser clients and integrations. APIs are organized by business domain, including auth, AI, chat/messaging, storage/files, payments, construction, and administration. Middleware and API pipeline modules provide intended common handling for authentication, validation, caching, retry, timeout, rate limiting, and response behavior.
• src/app/api/auth/login/route.ts
• src/app/api/messaging/conversations/route.ts
• src/lib/api/api.pipeline.ts
Authentication, authorization, and security
Authentication endpoints cover signup, login, logout, password recovery/reset, OAuth-style Google login, OTP, and identity checks. Security is a distinct layer with CSRF, SSRF, sanitization, upload validation, audit logging, and rate limiting. A broad permission subsystem models browser/device permissions and role or policy enforcement.
• src/app/api/auth/otp/verify/route.ts
• src/lib/security/security.ts
• src/lib/permissions/PermissionEngine.ts
Domain orchestration and state model
The repository uses repeated domain layers: interfaces/types define contracts; services and managers implement operations; React providers/hooks expose state to UI; stores hold feature state. AI, messaging, analytics, payments, storage, search, speech, video, and weather follow this pattern. There are parallel src/lib/services and src/services trees, so engineers should establish which layer is authoritative per feature before extending it.
• src/lib/services/ai/chat.service.ts
• src/providers/messaging/messaging.provider.ts
• src/store/messaging/messaging.store.ts
Persistence, realtime, and operations
Prisma is the visible database integration, with schema, seed process, and database scripts for migration, backup, and restore. Messaging has dedicated HTTP routes plus a socket module and a standalone messaging microservice; call handling also has a separate TypeScript microservice. This creates a boundary between Next.js request/response features and long-lived realtime processes.
• prisma/schema.prisma
• src/lib/messaging-socket.ts
• mini-services/messaging-service/index.ts
Runtime and deployment
The primary runtime is Node.js/Next.js, with React client components and browser-native capabilities accessed through feature hooks/services. Deployment is configured for Netlify; Caddy configuration suggests an optional reverse-proxy deployment path. A service worker and web manifests support PWA behavior.
• netlify.toml
• caddyfile
• public/sw.js
Main entry points: layout.tsx Root layout · api.pipeline.ts API pipeline · middleware.ts Request middleware · chat.service.ts Feature services
Components 21
Next.js Web App
App Router UI and request boundary.
- Request middleware · Applies cross-cutting request controls.
src/middleware.ts - Root layout · Global rendering and application setup.
src/app/layout.tsx - Home entry
src/app/page.tsx - Auth & dashboard routes · Separates authentication and dashboard experiences.
src/app/(auth)/layout.tsx - AI feature routes
src/app/ai/layout.tsx - Messaging UI
src/components/views/messaging-view.tsx - AI chat UI
src/components/ai/ai-chat/ai-chat.tsx - Domain API routes · Server boundary for auth, AI, messaging, storage, payments, and administration.
src/app/api/messaging/conversations/route.ts
Domain Layer
Feature services, state, and policy.
- API pipeline · Shared authentication, validation, caching, retry, timeout, and response handling.
src/lib/api/api.pipeline.ts - Security controls · CSRF, SSRF, sanitization, upload validation, auditing, and rate limits.
src/lib/security/security.ts - Permission engine · Enforces browser/device and role or policy permissions.
src/lib/permissions/PermissionEngine.ts - Feature services · Contracts and operations for AI, messaging, payments, storage, search, and media.
src/lib/services/ai/chat.service.ts - Messaging state · Exposes messaging state and client operations to views.
src/providers/messaging/messaging.provider.ts - Messaging hook
src/hooks/messaging/use-messaging.ts
Realtime Services
Long-lived messaging and call processes.
- Messaging socket · Connects web messaging to long-lived socket behavior.
src/lib/messaging-socket.ts - Messaging microservice · Standalone realtime messaging process.
mini-services/messaging-service/index.ts
Data & Operations
Persistence and deployment assets.
- Prisma database model · Database schema with migration, seed, backup, and restore workflows.
prisma/schema.prisma - PWA service worker · Provides offline and installable web behavior.
public/sw.js - Netlify deployment
netlify.toml - Caddy proxy option
caddyfile
Other components
- Browser clients
Connections 22
- Browser clients → Request middleware: requests
- Request middleware → Root layout: renders app
- Root layout → Home entry: hosts
- Root layout → Auth & dashboard routes: composes
- Root layout → AI feature routes: composes
- Auth & dashboard routes → Messaging UI: renders
- AI feature routes → AI chat UI: renders
- Messaging UI → Messaging hook: uses
- Messaging hook → Messaging state: reads and updates
- AI chat UI → Feature services: invokes
- Browser clients → Domain API routes: HTTP calls
- Domain API routes → API pipeline: runs through
- API pipeline → Security controls: applies
- API pipeline → Permission engine: authorizes
- API pipeline → Feature services: dispatches
- Feature services → Prisma database model: persists
- Messaging state → Messaging socket: realtime events
- Messaging socket → Messaging microservice: connects to
- Messaging microservice → Prisma database model: stores messages
- Browser clients → PWA service worker: registers
- Netlify deployment → Root layout: deploys
- Caddy proxy option → Request middleware: optional proxy