Skip to content

xcodedi/booksclub-api

Repository files navigation

BookClub API (BACK_END)

Introduction

This API aims to be a book club management application, allowing users to perform various operations related to their book collections and accounts. It provides functionalities such as adding, updating, viewing, and deleting books, authors, genres, and user accounts. Additionally, it includes features for user authentication, including password reset via email, and managing user profile pictures.

Dependencies

To run the API, you need the following dependencies:

  • Docker - Containerization platform for developing, shipping, and running applications.
  • Node.js - JavaScript runtime environment.
  • Express - Web framework for Node.js.
  • PostgreSQL - Relational database management system.
  • Sequelize - Promise-based Node.js ORM for PostgreSQL, MySQL, MariaDB, SQLite, and Microsoft SQL Server.
  • Yarn - Package manager for JavaScript.
  • Nodemon - Utility that monitors for any changes in your source and automatically restarts your server.
  • Yup - JavaScript schema builder for value parsing and validation.
  • Bcrypt - Library to help you hash passwords.
  • Jsonwebtoken - Library to create and verify JSON Web Tokens.
  • Mailjet - Email sending service.
  • AWS SDK - Amazon Web Services SDK for JavaScript.

Steps to run the project

Configuration of the Database

To set up the database, follow these steps:

  1. Create a PostgreSQL instance using Docker:

    docker run --name postgres-bookclub -e POSTGRES_PASSWORD=docker -e POSTGRES_USER=docker -p 5432:5432 -d -t postgres
  2. Create a .env file in the project root directory like the example below:

db_user=docker db_password=docker db_name=bookclub db_host=localhost db_port=5432

Running the Project

To run the project.follow these steps:

  1. Git clone the repository

git clone https://github.com/xcodedi/bookclub-api.git

  1. Navigate to the project folder and install dependencies:

gitbash cd bookclub-backend -- yarn install

  1. Configure scripts to create the database and tables in PostgreSQL using Sequelize>

gitbash yarn sequelize db:migrate

4.Optional- Seed the database and tables in PostgreSQL using Sequelize:

gitbash yarn sequelize db:seed:all

  1. Run the project in development mode:

gitbash yarn start:dev

6.Run the project in production mode:

gitbash yarn start

Project Features

-User Authentication: Users can create an account using email and password, reset their password, and update their profile information including a profile picture using Base64 encoding and AWS S3.

-Books Management: CRUD operations for books including details like authors, genre, synopsis, pages, and book cover avatar.

-Categories and Authors: Manage categories and authors with relationships between tables using Sequelize associations.

-Favorites: Users can mark books as favorites.

-Search Functionality: Search for books by categories.

-Email Notifications: Password reset emails using Mailjet.

Documentation:

This README provides detailed instructions for setting up the project, configuring the PostgreSQL database, and running the API in development or production mode.

To test the API, use Insomnia to import the file below: Insomnia.json

About

API using Node.js, Express and Sequelize

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors