System with authentication to manage notes.
Personal project to learn Tailwindcss and Laravel 8 and its new feature and Jetstream with Inertia + Vue.
Due to I have another project with Jetstream Laravel Livewire Publications, this project is no longer maintained.
- Install all the package from Jetstream and Sail.
- Learn better practices with Docker compose.
- Learn Inertia to work with a Single Page Application.
- Create a basic CRUD, each user manages its data.
- Create a Middleware to allow request about notes just from its owner.
- Tested with PHPUnit (Test-Driven Development) to Models, CRUD implemented and Middleware.
- Refactored some code with best practices
- Implemented some design patters: QueryBuilder, Data Transfer Object and Actions
- Implemented a simple API for managing notes
- Ordered the project according to some theory about Domain Driven Design
These instructions will get you a copy of the project up and running on your local machine.
The programs you need are:
First duplicate the file .env.example as .env.
cp .env.example .env
Then install the PHP dependencies:
docker run --rm --interactive --tty \
--volume $PWD:/app \
composer install
Then create the next alias to run docker commands with Laravel Sail.
alias sail='bash vendor/bin/sail'
Note: Setting this alias as permanent is recommended.
Create the images and run the services (laravel app, mysql, redis, and mailhog):
sail up
With Laravel Sail you can run commands as docker-compose (docker-compose up -d = sail up -d) and php(e.g php artisan migrate = sail artisan migrate). To run Composer, Artisan, and Node / NPM commands just add sail at the beginning (e.g sail npm install). More information here.
Then install javascript dependencies.
sail npm install
Then generate symbolic link to storage files.
sail artisan storage:link
Then generate the application key.
sail artisan key:generate
Finally, generate the database with fake data:
sail artisan migrate --seed
Note: You could refresh the database any time with migrate:refresh
.
Each time SASS and JavaScript files are updated you need to run:
sail npm run dev
To make it automated run:
sail npm run watch
And now you have all the environment in the port 80 (e.g. http://127.0.0.1:80/).
There are rules in pint.json
about PHP-CS-Fixer to fix code style. You can run these rules with:
sail vendor/bin/pint
In order to find errors in the code without running it. It is better before running the tests.
sail composer phpstan
There are some unit testing in Models and some feature testings in controllers, all these test guarantee functionalities from Jetstream, authorization and actions as create, read, update and delete notes.
sail artisan test
For production environment you need extra configurations for optimization and security as:
Generate optimized JavaScript files.
sail npm run production
Set in the file .env the next configuration.
APP_ENV=production
APP_DEBUG=false
- Laravel 8 - PHP framework.
- Laravel Jetstream - Started kit.
- Laravel Pint - PHP code style fixer for minimalists.
- Larastan - PHP tool to find errors in your code.
- Vue 2 - JavaScript framework.
- Tailwindcss - CSS framework.
- Martín S. Campos mascam97
You're free to contribute to this project by submitting issues and/or pull requests.
This project is licensed under the MIT License.