{"id":29664246,"url":"https://github.com/getssh/universe_backend","last_synced_at":"2025-08-03T18:33:48.482Z","repository":{"id":290760978,"uuid":"975466830","full_name":"getssh/UNIverse_Backend","owner":"getssh","description":null,"archived":false,"fork":false,"pushed_at":"2025-06-14T08:23:57.000Z","size":3312,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"dev","last_synced_at":"2025-06-14T09:28:20.822Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/getssh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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,"zenodo":null}},"created_at":"2025-04-30T11:08:40.000Z","updated_at":"2025-06-14T08:24:01.000Z","dependencies_parsed_at":null,"dependency_job_id":"e05939f1-f52f-4bb2-b16a-daf75cb5bd38","html_url":"https://github.com/getssh/UNIverse_Backend","commit_stats":null,"previous_names":["getssh/universe_backend"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/getssh/UNIverse_Backend","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/getssh%2FUNIverse_Backend","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/getssh%2FUNIverse_Backend/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/getssh%2FUNIverse_Backend/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/getssh%2FUNIverse_Backend/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/getssh","download_url":"https://codeload.github.com/getssh/UNIverse_Backend/tar.gz/refs/heads/dev","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/getssh%2FUNIverse_Backend/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266496661,"owners_count":23938715,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-22T02:00:09.085Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"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-07-22T12:36:20.325Z","updated_at":"2025-07-22T12:36:31.687Z","avatar_url":"https://github.com/getssh.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ca name=\"readme-top\"\u003e\u003c/a\u003e\n\n\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"https://res.cloudinary.com/dvtc6coe2/image/upload/v1748447526/UNI_logo2_gzkocx.png\" alt=\"UNIverse Platform Logo\" width=\"300\"\u003e\n  \u003ch1\u003e\u003cb\u003eUNIverse Platform\u003c/b\u003e\u003c/h1\u003e\n  \u003cp\u003eA comprehensive application for university communities, fostering connection, collaboration, and resource sharing.\u003c/p\u003e\n\u003c/div\u003e\n\n\u003c!-- TABLE OF CONTENTS --\u003e\n\n# 📗 Table of Contents\n\n- [📖 About the Project](#about-project)\n  - [🌟 Overview](#overview)\n  - [🛠 Built With](#built-with)\n    - [Tech Stack](#tech-stack)\n    - [Key Features](#key-features)\n  - [🚀 Live Demo ](#live-demo)\n- [ How the Code Works (Backend)](#how-the-code-works)\n  - [Project Structure](#project-structure)\n  - [Core Modules \u0026 Functionalities](#core-modules--functionalities)\n    - [Authentication Flow](#authentication-flow)\n    - [User Profiles \u0026 ID Verification](#user-profiles--id-verification)\n    - [Groups](#groups)\n    - [Channels](#channels)\n    - [Posts](#posts)\n    - [Comments](#comments)\n    - [Events](#events)\n    - [Chat \u0026 Messaging](#chat--messaging)\n    - [Reporting System](#reporting-system)\n    - [File Uploads](#file-uploads)\n- [💻 Getting Started](#getting-started)\n  - [Prerequisites](#prerequisites)\n  - [Setup](#setup)\n  - [Environment Variables](#environment-variables)\n  - [Install](#install)\n  - [Usage](#usage)\n  - [Run tests](#run-tests)\n- [📄 API Endpoints Summary](#api-endpoints-summary)\n- [👥 Authors](#authors)\n- [🔭 Future Features](#future-features)\n- [🤝 Contributing](#contributing)\n- [⭐️ Show your support](#support)\n- [🙏 Acknowledgements](#acknowledgements)\n- [📝 License](#license)\n\n\u003c!-- PROJECT DESCRIPTION --\u003e\n\n# 📖 About the Project \u003ca name=\"about-project\"\u003e\u003c/a\u003e\n\n## 🌟 Overview \u003ca name=\"overview\"\u003e\u003c/a\u003e\n\n**UNIverse Platform** is a multifaceted web application built with the MERN (MongoDB, Express.js, React.js/NextJS, Node.js) stack, designed to serve as a central hub for university students, faculty, and administrators. It aims to enhance campus life by providing tools for communication, collaboration, event management, resource sharing, and community building.\n\nThe platform features robust user authentication with role-based access control, real-time chat and messaging powered by Socket.IO, a dynamic posting system for groups and university-wide channels, event creation and attendance tracking, and a comprehensive reporting system for content moderation. Cloudinary is leveraged for efficient media and file storage, including an innovative ID card verification system using OCR for automated role assignment.\n\nTo ensure a safe and supportive digital environment, the platform integrates AI-powered content moderation to automatically detect and flag inappropriate or harmful content. Additionally, it features a conversational AI chatbot to assist users with common questions, platform navigation, and feature usage—enhancing user experience and engagement.\n\n## 🛠 Built With \u003ca name=\"built-with\"\u003e\u003c/a\u003e\n\n### Tech Stack \u003ca name=\"tech-stack\"\u003e\u003c/a\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003e\u003cstrong\u003eClient-Side (Frontend - Assumed for a MERN App)\u003c/strong\u003e\u003c/summary\u003e\n  \u003cul\u003e\n    \u003cli\u003e\u003ca href=\"https://reactjs.org/\"\u003eReact.js\u003c/a\u003e (with Hooks \u0026 Context API or a state manager like Redux/Zustand)\u003c/li\u003e\n    \u003cli\u003e\u003ca href=\"https://reactrouter.com/\"\u003eReact Router\u003c/a\u003e (for navigation)\u003c/li\u003e\n    \u003cli\u003e\u003ca href=\"https://axios-http.com/\"\u003eAxios\u003c/a\u003e (for API requests)\u003c/li\u003e\n    \u003cli\u003e\u003ca href=\"https://socket.io/docs/v4/client-api/\"\u003eSocket.IO Client\u003c/a\u003e (for real-time communication)\u003c/li\u003e\n    \u003cli\u003eCSS Framework (e.g., \u003ca href=\"https://tailwindcss.com/\"\u003eTailwind CSS\u003c/a\u003e, \u003ca href=\"https://mui.com/\"\u003eMaterial-UI\u003c/a\u003e, \u003ca href=\"https://getbootstrap.com/\"\u003eBootstrap\u003c/a\u003e)\u003c/li\u003e\n    \u003cli\u003eDate Management (e.g., \u003ca href=\"https://date-fns.org/\"\u003edate-fns\u003c/a\u003e or \u003ca href=\"https://momentjs.com/\"\u003eMoment.js\u003c/a\u003e)\u003c/li\u003e\n  \u003c/ul\u003e\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003e\u003cstrong\u003eServer-Side (Backend)\u003c/strong\u003e\u003c/summary\u003e\n  \u003cul\u003e\n    \u003cli\u003e\u003ca href=\"https://nodejs.org/\"\u003eNode.js\u003c/a\u003e (runtime environment)\u003c/li\u003e\n    \u003cli\u003e\u003ca href=\"https://expressjs.com/\"\u003eExpress.js\u003c/a\u003e (web application framework)\u003c/li\u003e\n    \u003cli\u003e\u003ca href=\"https://mongoosejs.com/\"\u003eMongoose\u003c/a\u003e (MongoDB object modeling)\u003c/li\u003e\n    \u003cli\u003e\u003ca href=\"https://socket.io/\"\u003eSocket.IO\u003c/a\u003e (real-time engine)\u003c/li\u003e\n    \u003cli\u003e\u003ca href=\"https://www.npmjs.com/package/jsonwebtoken\"\u003eJSON Web Token (JWT)\u003c/a\u003e (for authentication)\u003c/li\u003e\n    \u003cli\u003e\u003ca href=\"https://www.npmjs.com/package/bcrypt\"\u003ebcrypt\u003c/a\u003e (for password hashing)\u003c/li\u003e\n    \u003cli\u003e\u003ca href=\"https://www.npmjs.com/package/multer\"\u003eMulter\u003c/a\u003e (for handling multipart/form-data, file uploads)\u003c/li\u003e\n    \u003cli\u003e\u003ca href=\"https://cloudinary.com/\"\u003eCloudinary SDK\u003c/a\u003e (for cloud-based image and file storage, and OCR)\u003c/li\u003e\n    \u003cli\u003e\u003ca href=\"https://www.npmjs.com/package/nodemailer\"\u003eNodemailer\u003c/a\u003e (for sending emails)\u003c/li\u003e\n    \u003cli\u003e\u003ca href=\"https://www.npmjs.com/package/express-validator\"\u003eexpress-validator\u003c/a\u003e (for request data validation)\u003c/li\u003e\n    \u003cli\u003e\u003ca href=\"https://www.npmjs.com/package/dotenv\"\u003edotenv\u003c/a\u003e (for environment variable management)\u003c/li\u003e\n    \u003cli\u003e\u003ca href=\"https://www.npmjs.com/package/cors\"\u003ecors\u003c/a\u003e (for Cross-Origin Resource Sharing)\u003c/li\u003e\n    \u003cli\u003e\u003ca href=\"https://www.npmjs.com/package/helmet\"\u003ehelmet\u003c/a\u003e (for securing Express apps with HTTP headers)\u003c/li\u003e\n    \u003cli\u003e\u003ca href=\"https://www.npmjs.com/package/morgan\"\u003emorgan\u003c/a\u003e (HTTP request logger)\u003c/li\u003e\n    \u003cli\u003e\u003ca href=\"https://www.npmjs.com/package/express-async-errors\"\u003eexpress-async-errors\u003c/a\u003e (for handling async errors in Express)\u003c/li\u003e\n  \u003c/ul\u003e\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eDatabase\u003c/strong\u003e\u003c/summary\u003e\n  \u003cul\u003e\n    \u003cli\u003e\u003ca href=\"https://www.mongodb.com/\"\u003eMongoDB\u003c/a\u003e (NoSQL database, often with MongoDB Atlas for cloud hosting)\u003c/li\u003e\n  \u003c/ul\u003e\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eDevelopment Tools \u0026 Practices\u003c/strong\u003e\u003c/summary\u003e\n  \u003cul\u003e\n    \u003cli\u003eGit \u0026 GitHub (Version Control)\u003c/li\u003e\n    \u003cli\u003eVS Code (Code Editor)\u003c/li\u003e\n    \u003cli\u003ePostman / Insomnia (API Testing)\u003c/li\u003e\n    \u003cli\u003eNodemon (for automatic server restarts during development)\u003c/li\u003e\n    \u003cli\u003eESLint / Prettier (Code linting and formatting)\u003c/li\u003e\n    \u003cli\u003eRESTful API Design Principles\u003c/li\u003e\n    \u003cli\u003eMVC (Model-View-Controller) or similar architectural pattern for backend organization\u003c/li\u003e\n  \u003c/ul\u003e\n\u003c/details\u003e\n\n### Key Features \u003ca name=\"key-features\"\u003e\u003c/a\u003e\n\n-   **User Management:**\n    -   Secure signup with email verification.\n    -   Login with JWT-based authentication.\n    -   Role-based access control (Student, Teacher, System Admin, University Admin).\n    -   Automated role assignment via ID card OCR (Cloudinary).\n    -   User profiles with image uploads.\n-   **University \u0026 Channel Management:**\n    -   System admins can create and manage universities.\n    -   University admins can create and manage university-specific channels (e.g., announcements, departmental).\n    -   Channel profile pictures.\n-   **Group Functionality:**\n    -   Users can create and join groups (public, private, university-specific).\n    -   Group administration (admins, moderators).\n    -   Join request system for private groups.\n    -   Group profile and cover photo uploads.\n-   **Content Creation \u0026 Interaction:**\n    -   Users can create posts within groups or channels, with optional file attachments.\n    -   Like/unlike posts and comments.\n    -   Threaded commenting system on posts.\n-   **AI Model Integration**\n    -   Uploaded (image/text) content is filtered with AI\n    -   Ensures user safety from online bullying and harassment \n-   **AI Chatbot**\n    -   Users can ask the chatbot any question they want\n    -   Users can easily access the chatbot from the landing page\n-   **Event Management:**\n    -   Users (with appropriate permissions) can create university events.\n    *   Structured event location (physical address or online meeting URL).\n    -   Event cover images, attendee registration, and external registration links.\n    -   Associated real-time chat for each event.\n-   **Real-time Communication:**\n    -   One-on-one and group/event chats using Socket.IO.\n    -   Real-time message delivery, typing indicators, and read receipts (basic).\n    -   File sharing within chats.\n-   **Moderation \u0026 Reporting:**\n    -   Users can report posts, groups, comments, etc.\n    -   Admin interface (conceptual) for reviewing and resolving reports.\n    -   Automated actions based on report thresholds (e.g., user warnings/bans, content removal).\n-   **File Storage:** Secure and efficient file/image storage using Cloudinary.\n\n\u003cp align=\"right\"\u003e(\u003ca href=\"#readme-top\"\u003eback to top\u003c/a\u003e)\u003c/p\u003e\n\n\u003c!-- LIVE DEMO --\u003e\n\n## 🚀 Live Demo \u003ca href=\"https://universeapp-ruby.vercel.app\" name=\"live-demo\"\u003e\u003c/a\u003e\n\n-   [Live Demo Link](https://universeapp-ruby.vercel.app)\n-   [Frontend Repository Link](https://github.com/Berihun101/universe_frontend)\n\n\u003cp align=\"right\"\u003e(\u003ca href=\"#readme-top\"\u003eback to top\u003c/a\u003e)\u003c/p\u003e\n\n\u003c!-- HOW THE CODE WORKS --\u003e\n\n#  How the Code Works (Backend) \u003ca name=\"how-the-code-works\"\u003e\u003c/a\u003e\n\nThe backend of UNIverse Platform is built using Node.js and Express.js, following a modular structure inspired by the MVC (Model-View-Controller) pattern. Mongoose is used as an ODM (Object Data Modeling) library to interact with the MongoDB database.\n\n## Project Structure \u003ca name=\"project-structure\"\u003e\u003c/a\u003e\n\n```\nUNIverse_Backend/\n├── node_modules/\n├── config/                  \n│   ├── db.js \n│   ├── cloudinary.js         \n├── controllers/\n│   ├── authController.js\n│   ├── userController.js\n│   ├── groupController.js\n│   ├── postController.js\n│   └── channelController.js\n│   ├── chatBotController.js\n│   ├── chatController.js\n│   ├── commentController.js\n│   ├── eventController.js\n│   └── messageController.js\n│   ├── reportController.js\n│   ├── universityController.js\n├── middleware/\n│   ├── authMiddleware.js\n│   ├── errorMiddleware.js\n├── models/\n│   ├── User.js\n│   ├── Group.js\n│   ├── Post.js\n│   ├── University.js\n│   └── Channel.js\n│   ├── Chat.js\n│   ├── Comment.js\n│   ├── Message.js\n│   ├── Report.js\n│   └── Event.js\n├── routes/\n│   ├── auth.js \n│   ├── usersRoutes.js \n│   ├── groupsRoutes.js \n│   ├── posts.js \n│   ├── chatBotRoutes.js\n│   ├── chatRoutes.js\n│   └── universityRoutes.js\n│   ├── channelRoutes.js\n│   ├── comments.js\n│   ├── eventRoutes.js\n│   ├── messageRoutes.js\n│   └── reportRoutes.js\n├── utils/\n│   ├── chatBotUtils.js \n│   ├── cloudinaryUploader.js \n│   ├── emailSender.js \n│   ├── fileUtils.js\n│   ├── moderationService.js\n│   └── ocrUtils.js\n├── public/\n├── server.js\n├── socket.js\n├── .env \n├── .gitignore\n├── package.json\n└── package-lock.json\n└── README.md\n```\n\n\n## Core Modules \u0026 Functionalities \u003ca name=\"core-modules--functionalities\"\u003e\u003c/a\u003e\n\n### Authentication (`authController.js`, `authMiddleware.js`)\n-   **Signup:** Users register with name, email, password, and upload an ID card. Passwords are hashed using `bcrypt`. An email verification token is generated and sent via `nodemailer`.\n-   **ID Card OCR:** The uploaded ID card is sent to Cloudinary for OCR. Text is extracted, and keywords (\"student,\" \"teacher\") are used to *tentatively* assign a role. The user's `idCardUrl` is stored, and a `verified` flag indicates ID check status.\n-   **Login:** Users log in with email and password. `bcrypt.compare` validates the password. Upon success, a JSON Web Token (JWT) is generated, containing `userId` and `role`.\n-   **Protection:** The `protect` middleware verifies the JWT from the `Authorization: Bearer \u003ctoken\u003e` header for protected routes, attaching `req.user` to the request.\n-   **Authorization:** The `authorize` middleware checks if `req.user.role` matches specified roles or if the user has specific permissions on a resource (e.g., is a channel admin).\n\n### User Profiles \u0026 ID Verification (`userController.js`, `User.js`)\n-   Users have profiles with fields like department, faculty, profile picture (Cloudinary URL), etc.\n-   The `verified` field on the User model is set to `true` after successful ID card OCR and role assignment, or by manual admin verification. `accountStatus` tracks the overall state (e.g., `waitVerification`, `waitIdVerification`, `active`, `banned`).\n\n### File Uploads (`Cloudinary`, `Multer`, `cloudinaryUploader.js`)\n-   `Multer` middleware handles `multipart/form-data` requests. Files are typically stored in memory (`multer.memoryStorage()`).\n-   A utility function (`uploadToCloudinary`) streams the file buffer to Cloudinary, which returns a secure URL and public ID.\n-   Different folders on Cloudinary are used for profile pictures, ID cards, post attachments, event covers, etc.\n-   Pre-delete Mongoose hooks are implemented in models to delete associated files from Cloudinary when a document (e.g., Post, Event, User) is deleted.\n\n### Entity Management (General Pattern for Groups, Channels, Posts, Events, etc.)\n-   **Models (`models/`):** Define the schema, validation, virtuals, indexes, and middleware (e.g., `pre('save')`, `pre('findOneAndDelete')`) for each entity.\n-   **Controllers (`controllers/`):** Contain the business logic for CRUD operations, membership management, interactions (likes, attends), etc. They interact with models and handle request/response cycles.\n-   **Routes (`routes/`):** Define API endpoints, apply middleware (authentication, authorization, validation, file uploads), and map requests to controller functions. `express-validator` is used for input validation.\n\n### Groups (`Group.js`, `groupController.js`)\n-   Users can create groups (creator becomes an admin).\n-   Groups have admins (max 5) and moderators (max 10), who must be members.\n-   Privacy settings (`public`, `private`, `university_only`, etc.) control visibility and join mechanisms.\n-   Private groups use a `joinRequests` system, managed by group staff.\n-   When a group is created, an associated `Chat` room is also created, and its ID is stored in `group.associatedChat`. Group members are automatically added as participants to this chat.\n-   Joining/leaving a group also updates the participant list of the associated chat.\n\n### Channels (`Channel.js`, `channelController.js`)\n-   Created by System Admins or designated University Admins.\n-   Associated with a specific `University`.\n-   Have a `channelType` (e.g., announcement, departmental).\n-   Users can join/leave channels (access might be restricted by `isPublic` and university affiliation).\n\n### Posts (`Post.js`, `postController.js`)\n-   Users can create posts within `Groups` or `Channels`.\n-   Posts can include text content and multiple file attachments (stored on Cloudinary).\n-   Features liking and will have a separate `Comment` system.\n-   Pre-delete hooks clean up Cloudinary files and associated comments/reports.\n\n### Comments (`Comment.js`, `commentController.js`)\n-   Hierarchical: Comments can be top-level on a `Post` or replies to other `Comments` (using `parentCommentId`).\n-   Feature liking and editing.\n-   Pre-delete hooks ensure replies and reports are also cleaned up.\n\n### Events (`Event.js`, `eventController.js`)\n-   Can be created by authorized users (e.g., admins, teachers).\n-   Associated with a `University`.\n-   Detailed `location` object (for physical or online events) and `registrationLink`.\n-   Manage attendees and have an optional `maxAttendees` limit.\n-   An associated `Chat` room is created for each event, with organizers/attendees as participants.\n-   Joining/leaving event attendance also updates the participant list of the event's chat.\n-   Pre-delete hooks clean up the associated chat, Cloudinary cover image, and reports.\n\n### Chat \u0026 Messaging (`Chat.js`, `Message.js`, `chatController.js`, `messageController.js`, `socket.js`)\n-   **`Chat` Model:** Represents a conversation (one-on-one, group, or event). Stores participants and a link to the last message.\n-   **`Message` Model:** Represents an individual message within a chat, including content, sender, optional file attachment, likes, reactions, and read receipts.\n-   **Controllers:**\n    -   `chatController`: Handles creating/finding chat rooms and fetching a user's chat list.\n    -   `messageController`: Handles sending new messages (text/file), fetching messages for a chat, editing/deleting messages, and marking messages as read.\n-   **Socket.IO (`socket.js`):**\n    -   Handles real-time communication.\n    -   Authenticates socket connections using JWT.\n    -   Manages rooms based on `chatId`. Clients `joinChat` to receive updates for that specific chat.\n    -   After HTTP requests (e.g., new message via POST), controllers use the `io` instance to `emit` events (`newMessage`, `messageUpdated`, `messageDeleted`, `chatParticipantsUpdated`, `typing`) to the relevant chat room.\n    -   Clients listen for these events to update their UI in real-time.\n\n### Reporting System (`Report.js`, `reportController.js`)\n-   Users can report various content types (`Post`, `Group`, `Comment`, `Channel`, `User`).\n-   Reports store `targetType`, `targetId`, `reason`, and `reportedBy`.\n-   Admins can view and resolve reports, recording `actionTaken` and `adminNotes`.\n-   An automated system (`handleReportThresholds`) in `reportController` checks unresolved report counts after a new report is created. Based on thresholds, it can:\n    -   Warn/ban users (updating `User.accountStatus`).\n    -   Remove reported content (posts/comments).\n    -   Deactivate groups (updating `Group.status`).\n\n\u003cp align=\"right\"\u003e(\u003ca href=\"#readme-top\"\u003eback to top\u003c/a\u003e)\u003c/p\u003e\n\n\u003c!-- GETTING STARTED --\u003e\n\n## 💻 Getting Started \u003ca name=\"getting-started\"\u003e\u003c/a\u003e\n\nTo get a local copy up and running, follow these steps.\n\n### Prerequisites \u003ca name=\"prerequisites\"\u003e\u003c/a\u003e\n\n-   **Node.js:** Version 16.x or higher recommended. Download from [nodejs.org](https://nodejs.org/).\n-   **npm** (Node Package Manager) or **yarn:** Comes with Node.js.\n-   **MongoDB:**\n    -   Install MongoDB Community Server locally ([MongoDB Installation Guide](https://www.mongodb.com/try/download/community)).\n    -   OR use a cloud-hosted MongoDB service like [MongoDB Atlas](https://www.mongodb.com/cloud/atlas).\n-   **Cloudinary Account:** Sign up at [cloudinary.com](https://cloudinary.com/). You will need your Cloud Name, API Key, and API Secret. Enable the OCR Add-on if you plan to use the ID card verification feature.\n-   **Email Service (for `nodemailer`):**\n    -   For development: A service like [Mailtrap.io](https://mailtrap.io/) (for testing emails in a fake inbox).\n    -   For production: A transactional email service like SendGrid, Mailgun, AWS SES, etc.\n-   **Git:** For version control.\n-   **Code Editor:** VS Code is recommended.\n-   **API Client:** Postman or Insomnia for testing API endpoints.\n\n### Setup \u003ca name=\"setup\"\u003e\u003c/a\u003e\n\n1.  **Clone the repository:**\n    ```sh\n    git clone https://github.com/getssh/UNIverse_Backend\n    cd UNIverse_Backend\n    ```\n\n2.  **Create Environment File:**\n    Duplicate the `.env.example` file (if you have one) or create a new file named `.env` in the root of the project.\n\n### Environment Variables \u003ca name=\"environment-variables\"\u003e\u003c/a\u003e\n\nPopulate your `.env` file with the following (replace placeholders with your actual values):\n\n```env\nNODE_ENV=development\nPORT=5000\n\n# MongoDB Connection URI\nMONGO_URI=mongodb://localhost:27017/uniPlatformDB # Or your MongoDB Atlas URI\n\n# JWT Configuration\nJWT_SECRET=YOUR_VERY_STRONG_JWT_SECRET_KEY_HERE # Change this to a long, random string\nJWT_EXPIRES_IN=1d # e.g., 1d, 7d, 1h\n# JWT_COOKIE_EXPIRES_IN_DAYS=1 # If using cookies for JWT\n\n# Cloudinary Credentials\nCLOUDINARY_CLOUD_NAME=your_cloud_name\nCLOUDINARY_API_KEY=your_api_key\nCLOUDINARY_API_SECRET=your_api_secret\n\n# Nodemailer Configuration (Example using Mailtrap for development)\nEMAIL_HOST=smtp.mailtrap.io\nEMAIL_PORT=2525\nEMAIL_USER=your_mailtrap_username\nEMAIL_PASS=your_mailtrap_password\nEMAIL_FROM='\"UNIverse Platform\" \u003cnoreply@universe.com\u003e' # Sender display name and email\n\n# Frontend URL (for links in emails, CORS)\nCLIENT_URL=http://localhost:3000 # Your React frontend URL\n```\n\n### Install \u003ca name=\"install\"\u003e\u003c/a\u003e\n\nInstall project dependencies:\n\n```npm install```\n\nOR if using yarn\n\nyarn install\n\n### Usage \u003ca name=\"usage\"\u003e\u003c/a\u003e\n1. Ensure MongoDB is running (if local) or accessible (if cloud).\n2. Start the development server:\n\n```npm run server```\n\n### Run tests \u003ca name=\"run-tests\"\u003e\u003c/a\u003e\n\nUse postman to test the endpoints and functionality\n\n\u003cp align=\"right\"\u003e(\u003ca href=\"#readme-top\"\u003eback to top\u003c/a\u003e)\u003c/p\u003e\n\n### API Endpoints Summary \u003ca name=\"api-endpoints-summary\"\u003e\u003c/a\u003e\n\nA Postman collection or detailed API documentation (e.g., using Swagger/OpenAPI) would provide comprehensive details. Here's a high-level summary:\n\n-   **Auth:**\n    - POST /api/auth/register - User signup (with ID card \u0026 profile pic)\n    - POST /api/auth/login - User login\n    - GET /api/auth/verify-email/:token - Email verification\n    - GET /api/auth/me - Get current logged-in user (Protected)\n\n-   **Users:**\n    - GET /api/users/:userId - Get user profile\n    - PUT /api/users/profile - Update current user's profile (Protected)\n-   **Universities:** (Admin protected for CUD)\n    - POST /api/universities - Create university\n    - GET /api/universities - Get all universities\n    - GET /api/universities/:universityId - Get single university\n    - PUT /api/universities/:universityId - Update university\n    - DELETE /api/universities/:universityId - Delete university\n-   **Channels:**\n    - POST /api/channels - Create channel (Admin/Uni Admin)\n    - GET /api/channels - Get channels (filtered)\n    - GET /api/channels/:channelId - Get single channel\n    - PUT /api/channels/:channelId/update - Update channel (Admin/Channel Admin)\n    - DELETE /api/channels/:channelId/delete - Delete channel (Admin/Channel Admin)\n    - POST /api/channels/:channelId/join - Join channel\n    - DELETE /api/channels/:channelId/leave - Leave channel\n    - GET /api/channels/:channelId/members - Get channel members\n-   **Groups:**\n    - POST /api/groups - Create group\n    - GET /api/groups - Get groups (filtered)\n    - GET /api/groups/:groupId - Get single group\n    - PUT /api/groups/:groupId - Update group (Admin/Group Admin)\n    - DELETE /api/groups/:groupId - Delete group (Admin/Group Admin)\n    - POST /api/groups/:groupId/join - Join or request to join group\n    - DELETE /api/groups/:groupId/leave - Leave group\n    - GET /api/groups/:groupId/join-requests - Get join requests (Group Staff)\n    - PUT /api/groups/:groupId/join-requests/:requestId - Manage join request (Group Staff)\n    (Staff management routes: promote/demote admin/mod, kick member)\n-   **Posts:**\n    - POST /api/posts - Create post (in group/channel)\n    - GET /api/posts - Get posts (filtered)\n    - GET /api/posts/:postId - Get single post\n    - PUT /api/posts/:postId - Update post (Owner)\n    - DELETE /api/posts/:postId - Delete post (Owner/Admin)\n    - PUT /api/posts/:postId/like - Like/unlike post\n-   **Comments:**\n    - POST /api/posts/:postId/comments - Create comment on post\n    - GET /api/posts/:postId/comments - Get comments for post\n    - PUT /api/comments/:commentId - Update comment (Owner)\n    - DELETE /api/comments/:commentId - Delete comment (Owner/Admin)\n    - PUT /api/comments/:commentId/like - Like/unlike comment\n-   **Events:**\n    - POST /api/events - Create event\n    - GET /api/events - Get events (filtered)\n    - GET /api/events/:eventId - Get single event\n    - PUT /api/events/:eventId - Update event (Organizer/Admin)\n    - DELETE /api/events/:eventId - Delete event (Organizer/Admin)\n    - POST /api/events/:eventId/attend - Attend/Register for event\n    - DELETE /api/events/:eventId/attend - Unregister from event\n    - GET /api/events/:eventId/attendees - Get event attendees\n-   **Chats:**\n    - POST /api/chats/one-on-one - Get or create one-on-one chat\n    - GET /api/chats - Get user's chats\n    - GET /api/chats/:chatId - Get chat details\n-   **Messages:**\n    - POST /api/messages - Send message (with optional file)\n    - GET /api/messages/:chatId - Get messages for a chat\n    - PUT /api/messages/:messageId - Edit message\n    - DELETE /api/messages/:messageId - Delete message\n    - PUT /api/messages/read/:chatId - Mark messages as read\n-   **Reports:**\n    - POST /api/reports - Create a report\n    - GET /api/reports - Get reports (Admin only)\n    - PUT /api/reports/:reportId/resolve - Resolve a report (Admin only)\n\nNote: All protected routes require a valid JWT in the Authorization: Bearer \u003ctoken\u003e header.\n\n\u003cp align=\"right\"\u003e(\u003ca href=\"#readme-top\"\u003eback to top\u003c/a\u003e)\u003c/p\u003e\n\n\u003c!-- AUTHORS --\u003e\n\n## 👥 Authors \u003ca name=\"authors\"\u003e\u003c/a\u003e\n\n👤 **Getayawkal Tamrat**\n\n- GitHub: [@getssh](https://github.com/getssh/)\n- LinkedIn: [Getayawkal Tamrat](https://www.linkedin.com/in/getayawkal-tamrat/)\n- Email: [gtamrat33@gmail.com](mailto:gtamrat33@gmail.com)\n\n👤 **BERIHUN TAREKEGN**\n\n- Email: [taberihun07@gmail.com](mailto:taberihun07@gmail.com)\n\n👤 **Binyam Tagel**\n\n- Email: [binyam.tagel@gmail.com](mailto:binyam.tagel@gmail.com)\n\n👤 **Fikadu**\n\n- Email: [fikadu026@gmail.com](mailto:fikadu026@gmail.com)\n\n\u003cp align=\"right\"\u003e(\u003ca href=\"#readme-top\"\u003eback to top\u003c/a\u003e)\u003c/p\u003e\n\n\u003c!-- FUTURE FEATURES --\u003e\n\n### 🔭 Future Features \u003ca name=\"future-features\"\u003e\u003c/a\u003e\n\n-   **Advanced User Profiles:** Custom fields, portfolio links, skill endorsements.\n-   **Notifications System:** Real-time and email notifications for likes, comments, mentions, event reminders, new group posts, etc.\n-   **Enhanced Search:** Global search across posts, users, groups, events, with advanced filtering.\n-   **Polls \u0026 Surveys:** Integrated into posts or groups.\n-   **Resource Sharing Module:** Dedicated section for sharing academic resources (notes, past papers).\n-   **Direct File Sharing between Users.**\n-   **Full-fledged Calendar Integration for Events.**\n-   **Admin Dashboard:** Comprehensive UI for system admins and university admins to manage users, content, reports, and platform settings.\n-   **Gamification/Points System:** For user engagement.\n-   **Internationalization (i18n) and Localization (l10n).**\n-   **Improved Real-time Presence:** More detailed online/offline/idle status.\n-   **Message Reactions for Chat Messages.** Already started\n-   **Voice/Video Call Integration.**\n-   **More granular permissions for Group/Channel staff.**\n-   **AI intergrated study buddy:** Match students for study sessions\n-   **Mock exam generator:** Add feature for students and staff to generate exams/questions based on submited files\n\n\u003cp align=\"right\"\u003e(\u003ca href=\"#readme-top\"\u003eback to top\u003c/a\u003e)\u003c/p\u003e\n\n\u003c!-- CONTRIBUTING --\u003e\n\n### 🤝 Contributing \u003ca name=\"contributing\"\u003e\u003c/a\u003e\n\nContributions, issues, and feature requests are welcome! We value the input from the community to make UNIverse Platform even better.\n\n-   1. **Fork the Project**\n-   2. **Create your Feature Branch** (git checkout -b feature/AmazingFeature)\n-   3. **Commit your Changes** (git commit -m 'Add some AmazingFeature')\n-   4. **Push to the Branch** (git push origin feature/AmazingFeature)\n-   5. **Open a Pull Request**\n\nPlease make sure to update tests as appropriate and follow the existing code style.\nFeel free to check the \u003ca href=\"https://github.com/getssh/UNIverse_Backend/issues\"\u003eissues\u003c/a\u003e page for current tasks or to report new ones.\n\n\u003cp align=\"right\"\u003e(\u003ca href=\"#readme-top\"\u003eback to top\u003c/a\u003e)\u003c/p\u003e\n\n\u003c!-- SUPPORT --\u003e\n\n### ⭐️ Show your support \u003ca name=\"support\"\u003e\u003c/a\u003e\n\nIf you find UNIverse Platform useful or interesting, please consider giving it a star on \u003ca href=\"https://github.com/getssh/UNIverse_Backend\" target=\"_blank\"\u003eGitHub\u003c/a\u003e! Your support helps motivate further development and showcases the project to a wider audience.\n\nYou can also contribute by reporting bugs, suggesting features, or submitting pull requests.\n\n\u003cp align=\"right\"\u003e(\u003ca href=\"#readme-top\"\u003eback to top\u003c/a\u003e)\u003c/p\u003e\n\n\u003c!-- ACKNOWLEDGEMENTS --\u003e\n\n### 🙏 Acknowledgements \u003ca name=\"acknowledgements\"\u003e\u003c/a\u003e\n\n-   All group members participated in the project\n-   The vast open-source community for providing the excellent tools and libraries that made this project possible.\n-   Gebeya and Safaricom for their support and the opportunity to work on this project\n\n\u003cp align=\"right\"\u003e(\u003ca href=\"#readme-top\"\u003eback to top\u003c/a\u003e)\u003c/p\u003e\n\n\u003c!-- LICENSE --\u003e\n\n### 📝 License \u003ca name=\"license\"\u003e\u003c/a\u003e\nThis project is licensed under the MIT License. See the LICENSE file for more details.\n\n\u003cp align=\"right\"\u003e(\u003ca href=\"#readme-top\"\u003eback to top\u003c/a\u003e)\u003c/p\u003e","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgetssh%2Funiverse_backend","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgetssh%2Funiverse_backend","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgetssh%2Funiverse_backend/lists"}