How voctor98/techsolutions_innovations works
Project Type and Purpose
• TechSolutions is primarily a full-stack, PHP + MySQL monolith for service/product/user management, augmented by modern front-end clients (a static PWA shell in root, a React SPA in /react-app, and a Next-JS SSR front end in /techsolutions-ssr) and by separate Node/Express API services (the root server.js + /routes/* and the dedicated /techsolutions-api microservice).
• Its goal is to let SMBs register users, manage products/services, and eventually use PWA/offline features.
File Structure
• Top-level PHP monolith
• .php files (index.php, login.php, add_product.php, etc.)
• /models with ORM-like JS models (Product.js, User.js)
• /database/techsolutions.sql for MySQL schema
• db.js likely for Node-layer DB connectivity
• /api PHP endpoints
• /routes/*.js + server.js for a Node/Express thin API
• service-worker.js + manifest.json for PWA scaffolding
• React SPA (/react-app)
• Vite-powered front end (App.jsx, main.jsx)
• Connects to one or both Node APIs
• Dedicated Node-Express microservice (/techsolutions-api)
• Controllers, models, routes in JS
• Separate package.json and .env
• SSR Next.js app (/techsolutions-ssr)
• Uses Next 13 App Router (app/layout.tsx, page.tsx, etc.)
• IndexedDB helper for offline caching
• Tests and E2E (__tests__, cypress/)
• Misc: uploads, logs, vendor, composer.lock (composer PHP deps)
README for Context
• Confirms the PHP + MySQL core, PWA in development, optional React/Firebase expansions.
• Mentions user/role management, product modules, reporting, PWA offline.
Main Components
a. Clients / Presentation Layer
• Web browser (static PHP pages + embedded JS)
• PWA shell (service-worker, manifest)
• React SPA (hosted via Vite or static server)
• Next-JS SSR front end
b. API Layer(s) / App Servers
• PHP monolith (Apache + PHP-FPM) handling .php routes, business logic, session management
• Node/Express “root” API (server.js + /routes)
• techsolutions-api microservice (productController, authMiddleware)
c. Data Layer
• MySQL database (single instance hosting techsolutions schema imported from /database/techsolutions.sql)
d. External & Support Services
• BotMan chat (botman.php)
• Email / password recovery service (send_recovery_email.php)
• File storage (/uploads)
• Logging (logs.txt, login_logout.log, password_reset.log)
e. Offline / Caching
• IndexedDB (in Next.js and testIndexedDB.js)
• Service Worker (caching static assets)
Relationships & Data Flows
• Browsers → (HTTP/HTTPS) → PHP Monolith or Node/Express APIs → MySQL
• React SPA & Next SSR → (REST) → Node/Express APIs (either root or /techsolutions-api) → MySQL
• PWA shell uses service-worker to intercept and cache requests to both PHP endpoints and Node API endpoints.
• BotMan chat communicates via webhook endpoints in PHP.
• Email module calls external SMTP (via PHP mail functions).
• All servers read/write to the same MySQL instance.
Architectural Patterns & Principles
• Monolithic core in PHP for legacy modules
• Microservices pattern for product API (/techsolutions-api) and for SPA/SSR separation
• Progressive enhancement via PWA (service-worker + manifest)
• MVC-ish separation in Node APIs (controllers/models/routes)
• Single source of truth (MySQL), with JS ORM-style models in /models and /techsolutions-api/models
Essential Detail
• Don’t omit any major component: show both root Node API and /techsolutions-api microservice.
• PWA elements (service-worker, manifest, offline storage).