Note: For the overall project vision, goals, and user features, please refer to the main Project README. This document covers the backend implementation details.
- ✨ Core Backend Functionality
- 🏗️ Architecture
- 💻 Technology Stack
- 🔌 API Documentation
- 🚀 Getting Started
- 📁 Project Structure
- 📜 License
This API serves as the engine for Learnability, providing:
- AI Content Services: Uses Google Gemini for generating lessons, quizzes, and summaries from user-uploaded materials.
- Personalization: Tracks user progress and provides a tailored content feed.
- Vector Search: Integrates Milvus for semantic search within learning materials.
- User & Content Management: Handles authentication, user data, subjects, materials, quizzes, etc.
- Analytics: Provides data on quiz performance.
The backend uses a modular Node.js/Express structure:
flowchart LR
User --> API[Express API Gateway]
API --> Auth[Auth Middleware JWT]
Auth --> Routes[API Routes]
Routes --> Handlers[Request Handlers]
Handlers --> Services[Business Logic Services]
Services --> Gemini[Gemini AI Service]
Services --> Milvus[Milvus Service]
Services --> Quiz[Quiz Service]
Services --> Stats[Stats Service]
Services --> Prisma[Prisma ORM]
Prisma --> DB[(PostgreSQL DB)]
Milvus --> MilvusDB[(Milvus Vector DB)]
Gemini --> VertexAI[Google Vertex AI]
style API fill:#f9f,stroke:#333,stroke-width:2px
style DB fill:#ccf,stroke:#333,stroke-width:2px
style MilvusDB fill:#cdf,stroke:#333,stroke-width:2px
style VertexAI fill:#fca,stroke:#333,stroke-width:2px
- Requests flow through authentication and routing to specific service logic interacting with databases and AI APIs.
- Language: TypeScript
- Framework: Node.js & Express.js
- ORM: Prisma
- Databases: PostgreSQL (Relational), Milvus (Vector)
- Validation: Zod
- Auth: JWT
- AI: Google Vertex AI (Gemini)
- Containerization: Docker & Docker Compose
The API provides RESTful endpoints for platform features.
Live OpenAPI Documentation: https://la.rkr.cx/api-docs
/api/v1/auth: User management (register, login, profile)./api/v1/stats: Learning progress tracking./api/v1/pyos: Subject/material management, lesson generation./api/v1/quiz: Quiz management and attempts./api/v1/analytics: Quiz performance data./api/v1/query: Semantic search./api/v1/feed: Personalized content feed.
(For detailed request/response structures, please refer to the route handlers and Zod schemas in the src/ directory.)
- Node.js (LTS - v18/v20+)
- npm / yarn
- Docker & Docker Compose
- Git
- Clone this repo:
git clone https://github.com/0xteamCookie/LearnAbility-backend.git&cd LearnAbility-backend - Env File: Copy
.env.exampleto.envand fill in your secrets (JWT_SECRET,GOOGLE_CLOUD_PROJECT, etc.). EnsureDATABASE_URLpoints to the Docker Postgres service name (default:postgres). - Start Databases:
# Start Postgres docker-compose -f docker/docker-compose-postgres/docker-compose.yml up -d # Start Milvus docker-compose -f docker/docker-compose-vectordb/docker-compose.yml up -d
- Install API Deps:
npm install - DB Migrations:
npx prisma migrate dev --name init - Run API: See below.
- Clone & Install: As above.
- Databases: Ensure PostgreSQL & Milvus are running and accessible.
- Env File: Copy
.env.exampleto.envand updateDATABASE_URLetc. for your setup. - DB Migrations:
npx prisma migrate dev --name init
npm run devThe API will typically be available at http://localhost:3000.
.
├── docker/ # Docker configs
├── prisma/ # DB schema & migrations
├── src/ # Source Code
│ ├── db/ # Prisma client
│ ├── handler/ # Route handlers
│ ├── middleware/ # Express middleware
│ ├── routes/ # API routes
│ ├── schemas/ # Zod validation schemas
│ ├── services/ # Business logic
│ └── index.ts # App entry point
├── .env.example
├── package.json
└── tsconfig.json
Licensed under the GNU General Public License v3.0.