The Flash App
Application responsible for generating the basics necessary to develop a Web application
Table of Contents
Objective
- High performance
- Boilerplate with master class application
- MVC + DDD architecture focused on small applications, with very low cost
Requirements
- Docker
- Node 13.*
- Composer
Resources
-
PHP
- Fast Route (Controllers and Handlers)
- JWT (Bigger Security of session user)
- Event Dispatcher (Events and Subscribers)
- Symfony/Console (Routines of cron)
- Phinx (Commands of manipulation database)
- Swift Mailer (Mail dispatcher)
- Sentry (Monitoring errors)
- DotEnv (Environments)
- Illuminate/Database (ORM)
- Twig Template (View layer)
-
TypeScript
-
Webpack
-
SASS
-
Docker
- MySQL
- MySQL Adminer
- Apache
- PHP 7.2
Setup
Docker
sh .bin/exec.shFront-End
Executing changes css and js
npm run watchBuild assets
npm run buildPhinx
Migration
Create a new migration
docker exec theflashapp_php vendor/bin/phinx create TestMigrationRuning all migrations
docker exec theflashapp_php vendor/bin/phinx migrate -e productionSeed
Create a new seeder
docker exec theflashapp_php vendor/bin/phinx seed:create TestSeedRuning all seeders
docker exec theflashapp_php vendor/bin/phinx seed:run -e productionRuning initial application
docker exec theflashapp_php vendor/bin/phinx seed:run -s User -s Role -s UserRole -s Action -s RoleAction -e production Events
Triggers that run in the background without affecting the user experience
- Enable the
fastcgi_finish_requestfeature for a better api experience - If not enabled, all events will be triggered at run time
- Example with three events
localhost:4000/api/v1/test/events
Token
Manages access to your application
Retrieve token
-
Util route for generate token per environment
localhost:4000/api/v1/util/token- iss - Issuer app
- exp - Expiration time token (the value informed above is to never expire). When not informed or null search in the environment
JWT_EXPIRATION - secret_key - The unique signature of your token for added security. When not informed or null search in the environment
JWT_KEY - algorithm - Generate token with base in algorithm. When not informed or null search in the environment
JWT_ALGORITHM - retrieve_token - Is used to ensure end-to-end between applications, in case leave it empty.
Example:
{ "iss": "The Flash App", "exp": 317125598072, "secret_key": null, "algorithm": null, "retrieve_token": null } -
After the response json, update your
.envfile with the new information, the ideal would beJWT_RETRIEVE_TOKENor evenJWT_KEY, but ensure that no user is accessing it at this time, but in the event it is logged out
Session token
It is generated in the api/v1/auth route based on the environment variables JWT_RETRIEVE_TOKEN, JWT_EXPIRATION, JWT_KEY and JWT_ALGORITHM
