How abhinavreddy18-bytes/gator-ai works
Gator.AI is a full-stack AI chat application. Users sign up or log in, then use the protected chat page to send messages, view saved history, and clear conversations; the backend validates requests, checks JWT cookies, stores user/chat data, and requests AI replies. The graph also includes the landing and authentication UI, shared API client, and backend routing. README capabilities such as responsive design and code rendering are retained where they map to shown UI components; source excerpts do not establish every implementation detail.
Main entry points: App.tsx App Router · user-routes.ts User Routes · chats-routes.ts Chat Routes · AuthContext.tsx Auth State
Components 22
Frontend
- App Router
frontend/src/App.tsx - Landing Page
frontend/src/pages/Home.tsx - Login Page
frontend/src/pages/Login.tsx - Signup Page
frontend/src/pages/Signup.tsx - Header
frontend/src/components/Header.tsx - Chat Page
frontend/src/pages/Chats.tsx - Chat Message UI
frontend/src/components/chat/ChatItem.tsx - Form Input
frontend/src/components/shared/customizedInput.tsx - API Client
frontend/src/helpers/api-communicator.ts
Backend API
- Express App
backend/src/app.ts - Route Mounts
backend/src/routes/index.ts - User Routes
backend/src/routes/user-routes.ts - Chat Routes
backend/src/routes/chats-routes.ts - Chat Handlers
backend/src/controllers/chats-controllers.ts - Request Validation
backend/src/utils/validators.ts
Authentication
- Auth State
frontend/src/contexts/AuthContext.tsx - User Handlers
backend/src/controllers/users-controllers.ts - JWT Middleware
backend/src/utils/token-manager.ts
Data and AI
- User and Chat Model
backend/src/models/User.ts - MongoDB
- OpenAI API
Other components
- Visitor
Connections 31
- Visitor → App Router: uses
frontend/src/App.tsx - App Router → Landing Page: routes to
frontend/src/App.tsx - App Router → Login Page: routes to
frontend/src/App.tsx - App Router → Signup Page: routes to
frontend/src/App.tsx - App Router → Chat Page: routes to
frontend/src/App.tsx - App Router → Header: renders
frontend/src/App.tsx - App Router → Auth State: checks state
frontend/src/App.tsx - Login Page → Form Input: renders
frontend/src/pages/Login.tsx - Signup Page → Form Input: renders
frontend/src/pages/Signup.tsx - Login Page → Auth State: authenticates via
frontend/src/pages/Login.tsx - Signup Page → Auth State: registers via
frontend/src/pages/Signup.tsx - Auth State → API Client: calls
frontend/src/contexts/AuthContext.tsx - Chat Page → Auth State: reads state
frontend/src/pages/Chats.tsx - Chat Page → API Client: requests chat data
frontend/src/pages/Chats.tsx - Chat Page → Chat Message UI: renders messages
frontend/src/pages/Chats.tsx - API Client → User Routes: calls user API
frontend/src/helpers/api-communicator.ts - API Client → Chat Routes: calls chat API
frontend/src/helpers/api-communicator.ts - Express App → Route Mounts: mounts
backend/src/app.ts - Route Mounts → User Routes: registers
backend/src/routes/index.ts - Route Mounts → Chat Routes: registers
backend/src/routes/index.ts - User Routes → Request Validation: validates with
backend/src/routes/user-routes.ts - User Routes → JWT Middleware: checks token
backend/src/routes/user-routes.ts - User Routes → User Handlers: dispatches to
backend/src/routes/user-routes.ts - Chat Routes → Request Validation: validates with
backend/src/routes/chats-routes.ts - Chat Routes → JWT Middleware: checks token
backend/src/routes/chats-routes.ts - Chat Routes → Chat Handlers: dispatches to
backend/src/routes/chats-routes.ts - User Handlers → User and Chat Model: reads and writes
backend/src/controllers/users-controllers.ts - User Handlers → JWT Middleware: creates token
backend/src/controllers/users-controllers.ts - Chat Handlers → User and Chat Model: reads and writes
backend/src/controllers/chats-controllers.ts - Chat Handlers → OpenAI API: requests completion
backend/src/controllers/chats-controllers.ts - User and Chat Model → MongoDB: persists data
README.md