Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/wannacry081/bookstore-flask-api

Experience the Virtual Bookstore API: a powerful Flask-based solution for online bookstores. Seamlessly manage your inventory with features like book retrieval, addition, update, deletion, user authentication, and admin privileges.
https://github.com/wannacry081/bookstore-flask-api

api flask flask-bcrypt flask-cors flask-jwt-extended flask-marshmallow flask-restful flask-sqlalchemy

Last synced: 7 days ago
JSON representation

Experience the Virtual Bookstore API: a powerful Flask-based solution for online bookstores. Seamlessly manage your inventory with features like book retrieval, addition, update, deletion, user authentication, and admin privileges.

Awesome Lists containing this project

README

        

# Bookstore API

Welcome to the Virtual Bookstore API, a robust and user-friendly solution for managing your online bookstore. Built with Flask, Flask-SQLAlchemy, Flask-Restful, Flask-Marshmallow, Flask-Bcrypt, Flask-Cors and Flask-JWT-Extended, this RESTful API seamlessly integrates with SQLite and MySQL databases, providing a versatile and scalable platform. With features like book retrieval, addition, update, deletion, user authentication, and admin privileges, the Virtual Bookstore API empowers you to efficiently manage your inventory. Experience the power and flexibility of the Virtual Bookstore API today and create an exceptional online bookstore experience.

## Requirements

- Python 3.10.0
- Flask
- Flask-SQLAlchemy
- Flask-JWT-Extended
- SQLite (for local development)
- MySQL (for production)

## Installation

1. Clone the repository:

```
git clone https://github.com/TheDayDreamer01/Bookstore-Flask-API.git
cd bookstore-flask-api
```

2. Create a virtual environment:

```
virtualenv env
```

3. Activate the virtual environment:

- For Linux/Mac:

```
source env/bin/activate
```

- For Windows:

```
env\Scripts\activate
```

4. Install the dependencies:

```
pip install -r requirements.txt
```

5. Run the application:

```
python server.py
```

The default database used in this project is SQLite3. However, you can also use it in MySQL by configuring the `config.py` in the `Config/config.py` directory. Moreover, the API should now be accessible at `http://localhost:5000`.

## API Routes

- **POST /api/auth/signin**
- User sign-in with email and password.
- Returns a JWT token for authentication.

- **POST /api/auth/signup**
- User sign-up with username, email, and password.
- Creates a new user in the database.

- **POST /api/auth/signout**
- User sign-out.
- Invalidates the JWT token.

- **GET /api/book**
- Get a list of all books.
- No authentication required.

- **GET /api/book//**
- Get details of a specific book.
- No authentication required.

- **GET /api/book/user/**
- Get the authenticated user's book list.

- **POST /api/book/user/**
- Add a book to the authenticated user's book list.

- **DELETE /api/book/**
- Delete a book from the authenticated user's book list.

- **GET /api/user/**
- Get the authenticated user's profile.

- **PUT /api/user/**
- Update the authenticated user's profile.

- **POST /api/user/**
- Update the authenticated user's password.

- **DELETE /api/user/**
- Delete the authenticated user's account.

- **POST /api/admin/book**
- Add a book (admin only).

- **PUT /api/admin/book**
- Update a book (admin only).

- **DELETE /api/admin/book**
- Delete a book (admin only).

- **GET /api/admin/user**
- Get a list of all users (admin only).

- **DELETE /api/admin/user**
- Delete a user (admin only).

## Contributing

Contributions to the project are welcome. If you find any issues or have any suggestions for improvement, feel free to submit a pull request or open an issue on the repository.

## License

This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for more details.