LibroShelf Backend API is a RESTful service designed to power the LibroShelf web application. It provides endpoints for managing books, users, authentication, and other core features. Built with Node.js, TypeScript, Express, and MongoDB, the API ensures scalability, security, and maintainability.
For the books database , i used GoogleBooksAPI.
- User authentication and authorization (JWT)
- CRUD operations for books and users
- Search and filter books
- Secure password hashing
- Error handling and validation
- Environment-based configuration
- Books info , with the thumbnail
Funtions:
- Follow sistem
- Save your books
- rate your own books and add comments
- Clone the repository:
git clone https://github.com/your-username/LibroShelf_Backend.git
cd LibroShelf_Backend- Install dependencies:
npm install- Configure environment variables:
- Copy
.env.exampleto.envand update the values.
- Run the development server:
npm run devBase URL: http://localhost:4000/api/users
- Endpoint:
/user - Method:
GET - Auth: Bearer Token required
- Description: Returns the authenticated user’s profile data.
- Endpoint:
/auth/login - Method:
POST - Auth: None
- Description: Authenticates a user and returns a token.
- Body (JSON):
{ "email": "victor@gmail.com", "password": "12345678" }
- Endpoint:
/auth/register - Method:
POST - Auth: None
- Description: Creates a new user account.
- Body (JSON):
{ "handle": "Paula", "name": "paula", "email": "paula@gmail.com", "password": "12345678" }
- Endpoint:
/follow - Method:
POST - Auth: Bearer Token required
- Description: Follows another user by their handle.
- Body (JSON):
{ "handle": "victor" }
- Endpoint:
/unfollow - Method:
POST - Auth: Bearer Token required
- Description: Unfollows a user by their handle.
- Body (JSON):
{ "handle": "paula" }
- Endpoint:
/feed - Method:
GET - Auth: Bearer Token required
- Description: Returns the feed of posts from followed users.
- Endpoint:
/add - Method:
POST - Auth: Bearer Token required
- Description: Adds a book to the authenticated user’s collection.
- Body (JSON):
{ "bookId": "8FjODwAAQBAJ" }
- Endpoint:
/search - Method:
GET - Auth: None
- Description: Searches for books by title.
- Body (JSON):
{ "title": "harry potter" }
- Endpoint:
/delete - Method:
DELETE - Auth: Bearer Token required
- Description: Deletes a book from the authenticated user’s collection.
- Body (JSON):
{ "bookId": "89tu0AEACAAJ" }
- Endpoint:
/list - Method:
POST - Auth: None
- Description: Lists all books belonging to a specific user by handle.
- Body (JSON):
{ "handle": "paula" }
- Endpoint:
/mybooks - Method:
GET - Auth: Bearer Token required
- Description: Returns all books in the authenticated user’s collection.
- Endpoint:
/update - Method:
PUT - Auth: Bearer Token required
- Description: Adds or updates a rating and review for a book.
- Body (JSON):
{ "id": "8FjODwAAQBAS", "rating": 3, "description": "me gusto muchoo" }
Contributions are welcome! Please open issues or submit pull requests for improvements.
