Welcome to the official documentation and source code for the Brainly Backend API. This API powers the Brainly platform, providing functionality to manage users, content, and brain-related data.
- About the Project
- Features
- API Endpoints
- Installation
- Usage
- Technologies Used
- Contributing
- License
- Contact
The Brainly Backend API is designed to handle user management, content creation and management, and brain-related operations (which may include content recommendations, sharing, etc.). This API is part of the Brainly platform, which provides educational tools for users.
- User Authentication and Management
- Registration
- Login
- Profile management
- Content Management
- Create, update, retrieve, and delete content
- Brain Operations
- Shareable content and data interactions
-
GET /api/v1/user
- Description: Get details of the authenticated user.
-
POST /api/v1/user/signup
- Description: Register a new user.
- Body:
{ "email": "user@example.com", "password": "your_password" }
-
POST /api/v1/user/signin
- Description: User login.
- Body:
{ "email": "user@example.com", "password": "your_password" }
-
GET /api/v1/contents
- Description: Retrieve all content.
-
POST /api/v1/contents
- Description: Create new content.
- Body:
{ "title": "Sample Content", "description": "Content description here" }
-
PUT /api/v1/contents/:id
- Description: Update existing content by ID.
- Parameters:
id
: Content ID
- Body:
{ "title": "Updated Content Title", "description": "Updated description" }
-
DELETE /api/v1/contents/:id
- Description: Delete content by ID.
- Parameters:
id
: Content ID
-
GET /api/v1/brain/share
- Description: Get brain-related data.
-
POST /api/v1/brain/:shareLink
- Description: Share a specific brain-related link.
- Parameters:
shareLink
: A shareable link (for example, a content link).
To run this project locally, follow the steps below:
-
Clone the repository:
git clone https://github.com/yourusername/brainly-backend-api.git cd brainly-backend-api
-
Install dependencies:
npm install
-
Set up environment variables:
- Create a
.env
file in the root of the project and configure the necessary variables, such as:PORT=3000 MONGODB_URI=mongodb://localhost:27017/brainly JWT_SECRET=your_secret_key
- Create a
-
Run the server:
npm run dev
-
Open the application in your browser:
- Visit
http://localhost:3000
to start interacting with the API.
- Visit
The API provides endpoints that handle user management, content creation, and brain-related functionality. You can interact with the endpoints through HTTP requests using tools like Postman, curl, or directly in your application.
- Node.js: Backend runtime environment.
- Express.js: Web framework for building REST APIs.
- MongoDB: NoSQL database for storing user and content data.
- Mongoose: ODM (Object Document Mapper) for MongoDB.
- JWT (JSON Web Token): For user authentication and authorization.
- TypeScript: JavaScript superset for building scalable and maintainable applications.
If you'd like to contribute to this project, follow these steps:
- Fork the repository.
- Create a new branch (
git checkout -b feature-name
). - Commit your changes (
git commit -am 'Add new feature'
). - Push to the branch (
git push origin feature-name
). - Open a pull request.
- Suraj Vishwakarma
Visit my portfolio: https://www.surajv.me
Email: your.email@example.com
Thank you for using the Brainly Backend API! Happy coding! 🚀