Tax-app is a simple tax calculation application build with Php Laravel REST API in the backend and ReactJS for the frontend. Laravel sail is used to setup docker environment for the application (React app excluded).
Sail is the docker-compose.yml file and the sail script that is stored at the root of your project. The sail script provides a CLI with convenient methods for interacting with the Docker containers defined by the docker-compose.yml
file.
Please follow the steps to build the application.
-
If the application is being cloned for the first time, then, none of the application's Composer dependencies, including Sail, will be installed after you clone the application's repository to your local computer. This command uses a small Docker container containing PHP and Composer to install the application's dependencies:
docker run --rm \ -u "$(id -u):$(id -g)" \ -v "$(pwd):/var/www/html" \ -w /var/www/html \ laravelsail/php81-composer:latest \ composer install --ignore-platform-reqs
-
The
tax-app
directory has a.env.example
file which need to be duplicated and renamed as.env
. This file contains all the environment variables necessary to run the application. -
In order to run the docker containers,
./vendor/bin/sail build
. Alternatively, after setting up the alias forvendor/bin/sail
onlysail build
command will work. Create an alias by addingalias sail='[ -f sail ] && sh sail || sh vendor/bin/sail'
line to your shell configuration file in your home directory, such as ~/.zshrc or ~/.bashrc, and then restart your shell. The documentation will assume that you have added the alias and includesail
instead of./vendor/bin/sail
. -
Run
sail up
to run docker containers -
Now, our backend is up and running on docker containers. The database migration need to run. Run
sail artisan migrate:fresh
to migrate the tables in the database. A demo data seeder can be used to test the application. Runsail artisan db:seed
to seed demo data. -
The
frontend
directory have the ReactJs application inside it. Go inside this directory and runnpm install && npm start
-
Now you can visit Localhost and use the application.
Backend Test: Run sail artisan test
command in your terminal inside project directory
Frontend Test: Inside frontend
directory in your terminal run npm test
If you want to take a quick look at the app with it's functionality and review the code, access the demo video HERE