mascam97 / laravel-inertia-notes

System with authentication to manage your notes.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Laravel Inertia Notes Status Tests

System with authentication to manage notes.

Project goal by mascam97 πŸ₯…

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.

Achievements 2021 🌟

  • 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.

Achievements 2023 🌟

  • 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

Getting Started πŸš€

These instructions will get you a copy of the project up and running on your local machine.

Prerequisites πŸ“‹

The programs you need are:

Installing πŸ”§

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.


Running the project πŸ’»

Javascript and CSS files

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/).


Code style

There are rules in pint.json about PHP-CS-Fixer to fix code style. You can run these rules with:

sail vendor/bin/pint

Static Analysis

In order to find errors in the code without running it. It is better before running the tests.

sail composer phpstan

Backend testing

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

Deployment πŸ“¦

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

Built With πŸ› οΈ

Authors

Contributing

You're free to contribute to this project by submitting issues and/or pull requests.

License

This project is licensed under the MIT License.

References πŸ“š

About

System with authentication to manage your notes.


Languages

Language:PHP 51.2%Language:Vue 47.1%Language:Dockerfile 1.3%Language:Blade 0.2%Language:Shell 0.1%