- Restful API for all endpoints.
- No matter who returns the book, it will be logged in to original lender in user_action_logs table.
- Laravel 8
- Laravel Sanctum for authentication system.
- Postgres
Run the following commands to setup. If you want to use local php server, given php 7.3+, composer postgres is available
- git clone [email protected]/amritms/books-library.git
- cd book-library
- cp .env.example .env
- php artisan key:generate
- update .env to change the database name and credentials
- composer install
- php artisan migrate --seed
- php artisan test -> to run the test
- php artisan serve
- you can access the api at http://localhost:8000/api
- visit API documentation
If you want to use docker instead of local php server, given you have docker available
- git clone [email protected]/amritms/book-library.git
- cd book-library
- cp .env.example.docker .env
- update .env to change the database name. The docker will create database by reading in the .env file.
- docker-compose run --rm library_composer install
- docker-compose run --rm library_artisan migrate --seed
- docker-compose run --rm library_artisan test -> to run the test
- you can access the api at http://localhost/api
- visit API documentation
If it was a bigger real project, doing the following would be better:
- Use Laravel fortify because it provides login, registration, password reset, email verification etc out of the box.
- Use Laravel sanctum SPA authentication instead of token based authentication because SAP authentication uses Laravel's built-in cookie based session authentication services which provides CSRF protection and session authentication.
- Use Repository Pattern while writing code to adhere SOLID principles.
- Write more tests.
- Implement Route 53 for DNS, AWS Lambda, RDS database with Multiple Availability Zones failover and Read replicas, S3 for storage, Elasticache for caching, SQS for queues, cloudwatch for logs as server infrastructure.