A highly opinionated Single Page Application starter kit built on top of Vue.js and Laravel.
This package contains two separate projects to act as a starting point for a Single Page Application: a Vue.js project (created with vue-cli + webpack template) and a Laravel 5.3 project.
They're not just freshly created projects but a fully working application that can be modified and expanded to become your own application.
The live demo can be found in https://spa.codecasts.rocks/.
- Client side
- Vue.js 2.0 project create with vue-cli + webpack template
- Centralized state management with Vuex
- Route management with Vue-router
- Authentication with JWT
- Keep user signed in using local stored info
- HTTP requests with Axios
- ESLint
- Pagination integrated with Laravel's LengthAwarePaginator
- Alerts and Confirmation Alerts provided by SweetAlert
- Server side
- Laravel 5.3
- Authentication with JWT
- Web service RESTful with Dingo (planned)
Make sure you have installed Node and Yarn (latest versions) as well as PHP 7 and MySQL.
- Client side - this is a Vue.js project created with vue-cli
- With Terminal
cd client && yarn && yarn run dev
.
- With Terminal
- Server side - this is a Laravel 5.3 project
- With Terminal:
- Navigate to webservice folder and then:
composer install
to install Laravel and third party packagestouch database/database.sqlite
to create an empty database filecp .env.example .env
to configure installationphp artisan key:generate
to generate unique key for the projectphp artisan jwt:secret
to generate unique key for the projectphp artisan migrate
to create all the tablesphp artisan db:seed
to fill the tables with fake dataphp artisan serve
to serve application on localhost:8000
- With Terminal:
- Client side
- Your application will be available on http://localhost:8080
- Server side
- API endpoint is http://localhost:8000/api
Navigate to webservice folder and run the composer test script
$ composer test
-
Error handling is done globally by making use of Axios' interceptors. But you can still .catch() errors within components to perform actions related to that scope. See /client/src/plugins/http.js;
-
The same way error messages lives in one single component (/client/src/modules/general/alerts.vue) and their visibility is controlled by a Vuex property. So to show/hide messages it is just a matter of dispaching a Vuex action from within any component;
-
The spinner displayed during server requests (see top right close to user indentification) is also controlled by a Vuex property. The procedure to show/hide it is the same as outlined in the item 2 above;
-
routes and Vuex modules live close to the modules they work for. Always look for routes.js and store.js inside a module directory. See /client/src/modules/categories.
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -am 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request :D
Licensed under the MIT license.