# ShuleCoach Backend API
A comprehensive Node.js/Express backend API for the ShuleCoach AI Study Buddy platform, designed specifically for Kenyan KCSE students.
Pitch Deck Link:
canva.com
Live Demo:
412292-fba2aa1cb4af4e1492d8…
## Features
- **Authentication & Authorization**: JWT-based auth with refresh tokens
- **User Management**: Profile management, progress tracking, subscription handling
- **Payment Integration**: IntaSend API integration for M-Pesa and card payments
- **Study Sessions**: Track and manage study sessions with detailed analytics
- **Quiz System**: Generate and manage KCSE-style quizzes with progress tracking
- **Security**: Rate limiting, input validation, password hashing
- **Database**: MongoDB with Mongoose ODM
## Tech Stack
- **Runtime**: Node.js
- **Framework**: Express.js
- **Database**: MongoDB with Mongoose
- **Authentication**: JWT (jsonwebtoken)
- **Security**: bcryptjs, helmet, cors, express-rate-limit
- **Validation**: express-validator
- **Payment**: IntaSend API integration
## Installation
1. **Clone and setup**:
```bash
cd backend
npm install
```
2. **Environment Setup**:
```bash
cp .env.example .env
# Edit .env with your configuration
```
3. **Start MongoDB**:
```bash
# Make sure MongoDB is running locally or update MONGODB_URI in .env
mongod
```
4. **Run the server**:
```bash
# Development
npm run dev
# Production
npm start
```
## API Endpoints
### Authentication (`/api/auth`)
- `POST /register` - Register new user
- `POST /login` - User login
- `POST /refresh` - Refresh access token
- `GET /me` - Get current user
- `POST /logout` - Logout user
- `POST /forgot-password` - Send password reset email
### Users (`/api/users`)
- `GET /profile` - Get user profile
- `PUT /profile` - Update user profile
- `GET /progress` - Get study prog …