This project has been deployed on AWS and can be accessed via the following link: BookNest Server
This project is a Flask application API designed to help librarians manage and track books issued to members. It allows librarians to track the quantity of books available, monitor book fees and also members registration update and deletion. The API also maintains records of transactions made; issuance and retrieval of books from members.
- Clone the repository
git clone https://github.com/SymonMuchemi/BookNest-Server.git
- Change directory to the project folder
cd BookNest-Server
- Create a virtual environment
python3 -m venv venv
- Activate the virtual environment
On Linux:
source venv/bin/activate
On Windows:
venv\Scripts\activate
- Install the project dependencies
pip install -r requirements.txt
- Set the environment variables
export FLASK_APP=app
export FLASK_ENV=development
- Run the application
flask run
python -m unittest discover tests
- Python3: The programming language used to build the application.
- Flask: The web framework used to build the application.
- SQLite: The database used to store the application data.
- SQLAlchemy: The ORM used to interact with the database.
- Unittest: The testing framework used to test the application.
- Pydantic: The data validation library used to validate the request data.
- Librarian can add, update, delete and view books in the library
- Librarian can add, update, delete and view members in the library
- Librarian can issue books to members
- Librarian can retrieve books from members
- Librarian can view all transactions made
- Member's debt increments after borrow period exceeds set borrow period (7 Days)
- Member's debt and transaction charge is capped at 500.
GET /api/get_books
: Get all booksPOST /api/books/create
: Create a new bookPUT /api/books/update/<int:book_id>
: Update a bookDELETE /api/books/delete/<int:book_id>
: Delete a bookGET /api/books/get_by_id/<int:book_id>
: Get a book by idGET /api/books/get_by_title/<string:book_title>
: Get a book by titleGET /api/books/get_by_author/<string:book_author>
: Get a book by authorGET /api/books/hello
: Test endpoint
GET /api/members/get_members
: Get all members.POST /api/members/create
: Create a new member.PUT /api/members/update/<int:member_id>
: Update a member.DELETE /api/members/delete/<int:member_id>
: Delete a member.GET /api/members/get_by_id/<int:member_id>
: Get a member by id.GET /api/members/hello
: Test endpoint.
GET /api/transactions/get_transactions
: Get all transactions.POST /api/transactions/issue_book
: Issue a book to a member.POST /api/transactions/retrieve_book
: Retrieve a book from a member.GET /api/transactions/hello
: Test endpoint.
The database design is shown in the image below: