How abnet32/evangadi-forum works
Project type and purpose
• This is a full-stack discussion/forum web application (“Evangadi Forum”) that integrates AI assistance.
• Frontend: React SPA (modular components, routing, axios).
• Backend: Node.js + Express REST API.
• Database: MySQL.
• External service: OpenAI GPT for AI‐generated answers.
• Auth: JWT + bcrypt.
File structure
• Top-level “client” folder is the React app, organized by Components and Pages.
• Api/axios.js sets up HTTP client.
• Components folder holds reusable UI pieces (Header, Footer, Chatbot, ProtectedRoute, etc.).
• Pages folder contains route views (Home, Question, Answer, Groups, etc.).
• Top-level “server” folder is the backend:
• app.js – Express app initialization with routes and middleware (CORS, dotenv, JWT auth).
• routes/ – maps URLs to controller functions.
• controller/ – business logic for auth, questions, answers, AI, groups, users, installation.
• middleware/ – e.g. authMiddleware.
• db/ – dbConfig (MySQL connection), table.sql schema.
• utils/ – sendEmail, other helpers.
• There’s an “API DOCUMENTATION – Evangadi Forum.md” indicating REST endpoint specs.
README for additional insights
• Confirms React + Express + MySQL + OpenAI + JWT.
• Features: Auth, Q&A, AI Assistant, responsive, copy, REST, bcrypt.
a. Main components:
1. Client (React SPA)
2. API Gateway / Backend (Express.js server)
3. Database (MySQL)
4. External AI Service (OpenAI API)
5. Authentication module (JWT, bcrypt)
b. Relationships & data flows:
• Client ↔ Backend via HTTPS/REST (axios).
• Backend ↔ Database via SQL queries (dbConfig).
• Backend ↔ OpenAI via HTTPS calls (aiController).
• Client obtains JWT on login/signup, sends token in Authorization header to protected endpoints.
c. Architectural patterns/design principles:
• Frontend: Component-based SPA, router-based navigation, context API for global state.
• Backend: MVC-style separation (routes → controllers → utils/db), middleware for cross-cutting concerns (CORS, auth).
• Layered architecture: Presentation (React), API layer (Express routes/controllers), Data access (MySQL).
• RESTful API design, stateless auth with JWT.
d. Key technologies/frameworks:
• React, Vite, Axios
• Express.js, Node.js, dotenv, CORS
• MySQL
• OpenAI GPT API
• bcrypt, jsonwebtoken, UUID