Skip to content

Example web application demo project, that is implemented with the help of GenAI agents

License

Notifications You must be signed in to change notification settings

eficode/books-database-service

Repository files navigation

Books Database Service

A modern web application for managing a books database with a beautiful UI and API.

Features

  • RESTful API for managing books
  • Beautiful and responsive user interface
  • Real-time filtering and sorting of books
  • Pagination for large datasets
  • Categorization of books

Running the Application

Using Docker (Recommended)

The easiest way to run the application is using Docker Compose:

  1. Make sure you have Docker and Docker Compose installed
  2. Clone this repository
  3. Run the following command in the project directory:
docker-compose up -d

The application will be available at http://localhost:8000

To stop the application:

docker-compose down

Using Poetry

  1. Install Poetry:

    curl -sSL https://install.python-poetry.org | python3 -
  2. Install the Dependencies:

    poetry install
  3. Run the Application:

    poetry run dev-server

The application will be available at http://localhost:8000

Using Python virtual environment

  1. Create and activate a virtual environment:

    python -m venv .venv
    source .venv/bin/activate  # On Windows: .venv\Scripts\activate
  2. Install dependencies:

    pip install -r requirements.txt
  3. Run the application:

    python server.py

The application will be available at http://localhost:8000

API Documentation

The API documentation is available at http://localhost:8000/docs when the server is running.

Running Tests

API Tests

Run all API tests:

poetry run pytest

Run tests with verbose output:

poetry run pytest -v

Run a specific test:

poetry run pytest tests/test_books.py::test_create_book -v

UI Tests with Robot Framework

First, initialize the Browser library (only needed once):

poetry run python -m Browser.entry init

Run all Robot Framework UI tests:

poetry run robot --outputdir robot_results robot_tests/

Run a specific Robot test:

poetry run robot --outputdir robot_results -t "User Can Open Books UI" robot_tests/

Or use the provided script to run all UI tests:

./scripts/run_robot_tests.sh

The Robot Framework tests handle Docker automatically: they start the application with docker-compose up and clean up with docker-compose down when tests are complete.

Database Initialization

To generate sample books data:

python scripts/migrate_db.py
python scripts/generate_books.py

About

Example web application demo project, that is implemented with the help of GenAI agents

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published