LibraryFastApi is a project designed to manage a library system using FastAPI. It includes functionalities for managing books and users, with features such as user authentication, book creation, updating, and deletion.
- User Management: Create, read, update, and delete users.
- Book Management: Create, read, update, and delete books.
- Authentication: Secure user authentication using JWT tokens.
- Database Integration: Uses PostgreSQL for data storage.
- Testing: Comprehensive unit tests for services and routes.
-
Clone the repository:
git clone https://github.com/yourusername/LibraryFastApi.git cd LibraryFastApi
-
Create a virtual environment and activate it:
python -m venv venv source venv/bin/activate # On Windows use `venv\Scripts\activate`
-
Install the dependencies:
pip install -r requirements.txt
-
Set up the environment variables:
cp .env.example .env # Edit the .env file with your database and secret key configurations
-
Run the database migrations:
alembic upgrade head
-
Start the FastAPI server:
uvicorn main:app --reload
- Access the API documentation at
http://127.0.0.1:8000/docs
orhttp://127.0.0.1:8000/redoc
. - Use the provided endpoints to manage users and books.
To run the tests, use the following command:
pytest