How kaan-market/kaan-backend works
Project type and purpose
• This is a backend monolith for a B2B bulk-buying platform (“Kaan Backend”) built with Node.js, Express, PostgreSQL, and Prisma ORM.
• It exposes REST endpoints for phone-based authentication (OTP via Twilio) and user profile management. A simple static “test-frontend” directory provides a minimal client for manual API tests.
File structure
• Top level
• package.json, tsconfig.json, jest.config.js → config and dependencies
• prisma/ → database schema and migrations
• src/ → application source code
• test-frontend/ → minimal client for manual testing
• src/app.ts → main Express server setup
• src/middleware/ → cross-cutting concerns (auth guard, request validation)
• src/modules/
• auth/ → controllers, routes, service, tests for OTP-based authentication
• profile/ → routes and service for profile CRUD
• src/utils/ → OTP generation and Twilio integration
• src/generated/prisma/ → auto-generated Prisma client and runtime
README for additional insights
• Describes core modules (Auth, Profile) and their flows
• Lists environment variables (DATABASE_URL, TWILIO_*)
• Details database models (User, Otp) and migration history
• Outlines future modules (User Management, Product, Order, Group Buying)
Additional recommendations
• Flows (e.g., “OTP request”, “OTP verify → user upsert”)
• Environment variables or configuration externalized from code