How y1lion/kinetix works
Purpose and entry points
Kinetix is a containerized sports-product e-commerce system: a Next.js browser UI calls an Express REST API, which persists data and sessions in MongoDB Atlas, indexes/searches products through Meilisearch, and uses Azure AI for enrichment. Runtime entry points are frontend/app/page.tsx, backend/server.js, and docker-compose.yml.
Frontend application
The Next.js/React TypeScript frontend provides catalogue browsing, authentication, basket, and administration views. The root UI and shared application shell are in frontend/app/page.tsx and frontend/app/layout.tsx; dedicated user flows are frontend/app/login/page.tsx, frontend/app/basket/page.tsx, and frontend/app/admin/page.tsx. It runs on port 3000 and must send credentialed API requests for session continuity.
HTTP API and route boundary
Express bootstrapping, database/session setup, CORS, and API documentation are centralized in backend/server.js. Routes partition the API by domain: authentication in backend/routes/auth.js, catalogue/search in backend/routes/products.js and backend/routes/search.js, basket operations in backend/routes/basket.js, and privileged operations in backend/routes/admin.js. Health is separately exposed through backend/routes/health.js.
Identity, sessions, and authorization
Registration/login logic belongs to backend/controllers/authController.js; user management is in backend/controllers/userController.js. Passwords are bcrypt-hashed, while express-session with Mongo-backed persistence makes the browser cookie the authentication boundary. backend/middleware/requireAuth.js gates authenticated operations, and backend/middleware/requireAdmin.js adds role-based protection for administration.
Domain persistence and commerce flow
Mongoose models define the durable core entities: users, products, and user-linked baskets in backend/models/user.js, backend/models/product.js, and backend/models/basket.js. backend/controllers/productController.js implements catalogue/product management; backend/controllers/basketController.js applies basket changes for the authenticated user. Seeded catalogue content enters through backend/data/productsDataset.js and backend/scripts/seedProducts.js.
Search and AI enrichment pipeline
Product discovery is separated from MongoDB persistence. backend/config/meilisearch.js and backend/services/meiliService.js connect and synchronize the Meilisearch index; backend/scripts/initMeili.js initializes it. Search quality is composed in backend/services/hybridEngine.js, with intent interpretation, product matching, and AI scoring split across backend/services/intentService.js, backend/services/matchService.js, and backend/services/aiScoreService.js. Azure AI Language and Vision are external dependencies, with image-oriented processing in backend/services/imageService.js.
Deployment and operational boundaries
Docker Compose coordinates frontend, backend, and local Meilisearch in docker-compose.yml; service images are defined by frontend/Dockerfile and backend/Dockerfile. MongoDB Atlas remains external and requires network access plus MONGO_URI; Meilisearch is addressed internally as http://meilisearch:7700. GitHub Actions in .github/workflows/ci.yml builds the stack, temporarily permits the runner in Atlas, verifies health/UI/Swagger, and runs database validation.
Main entry points: server.js Express server · docker-compose.yml Docker Compose · page.tsx Next.js application · basketController.js Product & basket logic
Components 20
Frontend
- Browser client · Uses credentialed requests to preserve sessions.
- Next.js application · Catalogue, login, basket, and administration flows.
frontend/app/page.tsx - Shared app shell
frontend/app/layout.tsx
Express API
- Express server · Configures CORS, sessions, database access, and API documentation.
backend/server.js - Auth routes
backend/routes/auth.js - Catalogue & basket routes · Product, search, and basket API domains.
backend/routes/products.js - Admin routes
backend/routes/admin.js - Identity & session logic · Bcrypt credentials and Mongo-backed browser sessions.
backend/controllers/authController.js - Auth and role guards · Requires an authenticated user and, where needed, an admin role.
backend/middleware/requireAuth.js - Product & basket logic · Manages catalogue data and authenticated user baskets.
backend/controllers/basketController.js - Commerce models · User, product, and user-linked basket entities.
backend/models/basket.js - Catalogue seed · Loads the product dataset into persistence.
backend/scripts/seedProducts.js
Search & enrichment
- Search routes
backend/routes/search.js - Hybrid search engine · Combines intent interpretation, matching, and AI scoring.
backend/services/hybridEngine.js - Meilisearch sync · Synchronizes product records to the search index.
backend/services/meiliService.js - Azure AI Language & Vision · Supports scoring and image-oriented enrichment.
Runtime & operations
- MongoDB Atlas · Durable users, products, baskets, and sessions.
- Meilisearch · Local Compose service addressed internally on port 7700.
- Docker Compose · Coordinates frontend, backend, and local Meilisearch.
docker-compose.yml - GitHub Actions CI · Builds the stack and verifies health, UI, Swagger, and database validation.
.github/workflows/ci.yml
Connections 26
- Browser client → Next.js application: renders
- Next.js application → Shared app shell: uses
- Next.js application → Express server: credentialed REST requests
- Express server → Auth routes: mounts
- Express server → Catalogue & basket routes: mounts
- Express server → Admin routes: mounts
- Express server → Search routes: mounts
- Express server → MongoDB Atlas: stores sessions
- Auth routes → Identity & session logic: delegates
- Identity & session logic → MongoDB Atlas: reads and writes users
- Catalogue & basket routes → Auth and role guards: requires authentication
- Admin routes → Auth and role guards: requires admin role
- Auth and role guards → Product & basket logic: permits requests
- Product & basket logic → Commerce models: uses
- Commerce models → MongoDB Atlas: persists
- Catalogue seed → Commerce models: loads products
- Search routes → Hybrid search engine: queries
- Hybrid search engine → Meilisearch: retrieves candidates
- Hybrid search engine → Azure AI Language & Vision: scores and enriches
- Product & basket logic → Meilisearch sync: synchronizes products
- Meilisearch sync → Meilisearch: indexes
- Docker Compose → Next.js application: runs
- Docker Compose → Express server: runs
- Docker Compose → Meilisearch: runs
- GitHub Actions CI → Docker Compose: builds and verifies
- GitHub Actions CI → MongoDB Atlas: temporarily authorizes runner