{"id":24532691,"url":"https://github.com/follownaim/learnmate-server","last_synced_at":"2026-07-03T20:33:05.541Z","repository":{"id":271876316,"uuid":"906630208","full_name":"FollowNaim/LearnMate-Server","owner":"FollowNaim","description":"The backend implementation for LearnMate, an educational platform connecting tutors and learners. It provides APIs for user authentication, tutor management, bookings, and other essential features to support a seamless learning experience.","archived":false,"fork":false,"pushed_at":"2025-01-10T17:13:12.000Z","size":40,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-26T14:46:00.668Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/FollowNaim.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-12-21T12:54:16.000Z","updated_at":"2025-01-10T17:13:15.000Z","dependencies_parsed_at":null,"dependency_job_id":"fba8df86-2243-41a5-a157-f32d4d28a5eb","html_url":"https://github.com/FollowNaim/LearnMate-Server","commit_stats":null,"previous_names":["follownaim/learnmate-server","ar-naim/learnmate-server"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/FollowNaim/LearnMate-Server","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FollowNaim%2FLearnMate-Server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FollowNaim%2FLearnMate-Server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FollowNaim%2FLearnMate-Server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FollowNaim%2FLearnMate-Server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/FollowNaim","download_url":"https://codeload.github.com/FollowNaim/LearnMate-Server/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FollowNaim%2FLearnMate-Server/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35101091,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-03T02:00:05.635Z","response_time":110,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-01-22T10:18:03.837Z","updated_at":"2026-07-03T20:33:05.535Z","avatar_url":"https://github.com/FollowNaim.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# LearnMate Server\n\nThis repository contains the backend implementation for **LearnMate**, an educational platform connecting tutors and learners. It provides APIs for user authentication, tutor management, bookings, and other essential features to support a seamless learning experience.\n\n---\n\n## Purpose\n\nLearnMate aims to bridge the gap between students and tutors by providing an intuitive platform where learners can easily find, book, and review qualified tutors across various subjects and categories.\n\n---\n\n## Server URL\n\n[Live Server](https://learnmate-server.vercel.app/)\n\n---\n\n## Key Features\n\n- **User Authentication:**  \n  Secure user registration, login, and JWT-based authorization.\n\n- **Tutor Management:**  \n  CRUD operations for tutor profiles, dynamic category management, and real-time review updates.\n\n- **Booking System:**  \n  Flexible booking for tutorials with automatic updates to tutor availability and booking history.\n\n- **Dynamic Data Retrieval:**  \n  Advanced filtering, searching, and querying of tutor data.\n\n- **Category Insights:**  \n  Aggregated counts for tutor categories to help users find popular subjects quickly.\n\n- **User-Specific Data:**  \n  Fetch user-related data like tutorials and bookings based on authentication.\n\n- **API-First Approach:**  \n  Designed to support scalable front-end integration.\n\n---\n\n## Tech Stack\n\n- **Server Framework:** Express.js\n- **Database:** MongoDB\n- **Authentication:** JWT (JSON Web Tokens)\n- **Environment Management:** dotenv\n- **Middleware:** Cookie Parser, CORS\n- **Other Libraries:** MongoDB Driver, Node.js\n\n---\n\n## Endpoints\n\n### General Endpoints\n\n- **`GET /`**  \n  Returns a success message to verify the server is running.\n\n---\n\n### User Endpoints\n\n- **`GET /users`**  \n  Fetches the count of all users in the database.\n\n- **`POST /user`**  \n  Saves a new user to the database if the user does not already exist.\n\n- **`PATCH /user`**  \n  Updates the name of an existing user.\n\n---\n\n### Authentication Endpoints\n\n- **`POST /jwt`**  \n  Generates a JWT token for secure data transmission and sets it in a cookie.\n\n- **`GET /clearjwt`**  \n  Deletes the JWT token by clearing the cookie.\n\n---\n\n### Tutor Endpoints\n\n- **`GET /tutors`**  \n  Fetches all tutors or tutors based on query parameters (`category`, `count`, `reviews`, `search`).\n\n- **`GET /tutors/categories`**  \n  Fetches all unique tutor categories.\n\n- **`GET /tutors/:id`**  \n  Fetches details of a specific tutor by ID.\n\n- **`POST /tutors`**  \n  Saves a new tutor to the database.\n\n- **`PUT /tutors/:id`**  \n  Updates or inserts a tutor's details by ID.\n\n- **`PATCH /update-review/:id`**  \n  Updates the review count for a tutor and related bookings.\n\n- **`GET /my-tutorials/:email`**  \n  Fetches tutorials for a specific user (requires JWT verification).\n\n- **`DELETE /tutors/:id`**  \n  Deletes a specific tutor by ID.\n\n---\n\n### Booking Endpoints\n\n- **`GET /bookings`**  \n  Fetches all bookings for a specific user (requires JWT verification).\n\n- **`POST /bookings`**  \n  Saves a new booking if it does not already exist and updates the booking count for the tutor.\n\n---\n\n### Category Endpoints\n\n- **`GET /categories`**  \n  Aggregates and returns the count of tutors in each category.\n\n---\n\n## Features\n\n- **Authentication:**  \n  Secure JWT-based authentication and authorization for API access.\n\n- **Dynamic Queries:**  \n  Flexible query-based data retrieval for tutors and categories.\n\n- **Database Integration:**  \n  Robust interaction with MongoDB for efficient data storage and retrieval.\n\n- **Middleware Usage:**  \n  Cookie handling, CORS setup, and request validation for enhanced security and functionality.\n\n---\n\n## Dependencies\n\n- **cookie-parser**: ^1.4.7 – Middleware for parsing cookies in HTTP requests.\n- **cors**: ^2.8.5 – Package to enable Cross-Origin Resource Sharing (CORS).\n- **dotenv**: ^16.4.7 – Loads environment variables from a `.env` file into `process.env`.\n- **express**: ^4.21.2 – Fast, unopinionated web framework for Node.js.\n- **jsonwebtoken**: ^9.0.2 – JSON Web Token (JWT) for securely transmitting information between parties.\n- **mongodb**: ^6.12.0 – MongoDB driver for Node.js.\n\n---\n\n## 🔧 How to Run\n\n1. **Clone the repository.**\n\n```bash\n   git clone https://github.com/FollowNaim/LearnMate-Server\n   cd LearnMate-Server\n```\n\n2. **Install Dependencies**\n\n```bash\nnpm install\n```\n\n3. **Setup Environment Variables**\n\n- create .env in the root directory.\n- Add `JWT_TOKEN_SECRET` variable and put your **jwt secret token**.\n- create a collection on mongodb atlas.\n- Add `DB_USER, DB_PASS` variable and add your database username and password.\n\n4. **Run the application**\n\n```bash\nnpm run dev\n```\n\n5. **Access the app**\n\n- Open http://localhost:5000 in your browser.\n\n---\n\n## 🛠️ Deployment\n\n- Hosted on Netlify or Vercel for a fast and reliable experience.\n\n---\n\n## 🤝 Contributions\n\nContributions are welcome! Fork this repository, make your changes, and submit a pull request.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffollownaim%2Flearnmate-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffollownaim%2Flearnmate-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffollownaim%2Flearnmate-server/lists"}