This app provides a list of books with reading progress history in RESTful API based on specs listed in assessment docs prepared by [email protected].
Apart from providing a book listing API, this app was created primarily to show an example how to write testable codes and the use of best practices to minimize technical debt.
If you are interested in exploring this app, you can check to start from routes/api.php
, app/
folder & tests/
folder.
You can read the API documentation on the following page.
Basic steps:
- Clone this repository
git clone https://github.com/wakjoko/books-xentral.git
- Change directory
cd laravel-books-api
- Copy environment file
cp .env.example .env
(and for testingcp .env.example .env.testing
) - Set the db connection in
.env
(and.env.testing
if it's copied) - Continue installation steps with either one of below options..
Requirements: PHP 8.1, Composer, RDBMS (such as: MySQL, SQLite, PostgreSQL, etc).
Continue installation:
- Install composer dependencies
composer install
- Generate the app key with
php artisan key:generate
- Run db migration using
php artisan migrate
- Start the app with
php artisan serve
Requirements: Docker
Continue installation:
- You may need to change
DOCKER_FORWARD_*
in.env
to prevent port conflicts - Build container with
docker compose up -d --build
- Install composer dependencies
docker compose run --rm composer install
- Generate the app key with
docker compose run --rm artisan key:generate --force
- Run db migration using
docker compose run --rm artisan migrate --force
composer optimize:clear
: clear all cachephp artisan test --filter=TestClassName
: run specific feature or unit test./vendor/bin/pint
: auto style codes based onpint.json
settingsdocker compose up -d
: start dockerized appdocker compose down --remove-orphans
: shutdown dockerized appdocker rm -vf $(docker ps -aq)
: remove all docker containersdocker rmi -f $(docker images -aq)
: remove all docker images
- Laravel 10 - Core framework
- PHP 8.1 - Language syntax
- Docker - Container platform
- Greatly inspired by https://github.com/yusuftaufiq/laravel-books-api
This application is licensed under the MIT license.