This project was written exclusively for the interview question of NAK corporation.
Despite the simplicity of this project, it was tried to present an advanced enterprise workflow in it. This project has 3 main Namespaces, including App, Domain and Support. The responsibility of these namespaces and the idea of this design are derived from this blog series.
Development of this app was based on TDD approach and there is a test for every core functionality.
Facade pattern and separation of concerns (SOC) was also considered in this project and can be found on both post and comments.
Last word: It is obvious that such a complex workflow is not necessary for a simple project like current app, and all of these attempts are just for presentation.
- Clone the project
git clone https://bitbucket.org/ashrafibabak/nak-interview-app.git
-
Enter root folder of the project and copy
.env.example
file as.env
and define database name and database credentials(username, password) inside.env
file. -
Install the project using composer
composer install
- Run below command to create the application key
php artisan key:generate --ansi
- Now, you need to create your database tables by running below command in terminal or cmd.
php artisan migrate
- Run the server
- You can run laravel's built-in server by running below command.
php artisan serve
- Or setup an external server and config it to read from the public folder of the project.
Notice:
Project tests can be run by running composer test
orphp artisan test
In this method, you don't need to create database and run migration, they will be run automatically.
Notice: You need to have enabled sqlite3
php module in your php.ini for running this setup.
- Run below command to create the project by composer
composer create-project nak/interview:dev-master interview --repository-url="{\"url\": \"https://bitbucket.org/ashrafibabak/nak-interview-app.git\", \"type\": \"vcs\"}" --stability=dev --keep-vcs --no-secure-http
- Run below command to enter the project folder and run the laravel server
cd interview && php artisan serve
In this method, you don't need to create database and run migration, they will be run automatically.
- Run below command to run the docker compose
docker compose up -d
- Run below command to enter the project folder and run the laravel server
docker compose exec app composer install && docker compose exec app composer post-docker-install && docker compose exec app php artisan serve --host="0.0.0.0"
- Enterprise laravel workflow (separate Domain, App and Support) namespace
- Showing list of posts.
- Post creation and deletion
- Comment for every post with rate
- Tinymce for post body with photo and video configuration
- Slug service for post
- Media service for post
- Model frontend workflow using laravel mix
ERD diagram of the current project is as follows:
1- Post creation form and index.
2- Submitting comment.
3- Adding media to tinymce.