Giter Site home page Giter Site logo

eduardo76 / spa-starter-kit Goto Github PK

View Code? Open in Web Editor NEW

This project forked from codecasts/spa-starter-kit

0.0 1.0 0.0 930 KB

A highly opinionated starter kit for building Single Page Applications with Laravel and Vue.js

License: MIT License

JavaScript 20.15% HTML 2.76% Vue 15.28% CSS 0.76% PHP 60.70% ApacheConf 0.34%

spa-starter-kit's Introduction

Codecast's Single Page Application Starter Kit

Cover

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.

Demo

The live demo can be found in https://spa.codecasts.rocks/.

Features

  1. 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
  2. Server side
    • Laravel 5.3
    • Authentication with JWT
    • Web service RESTful with Dingo (planned)

Prerequisites

Make sure you have installed Node and Yarn (latest versions) as well as PHP 7 and MySQL.

Installation

  1. Client side - this is a Vue.js project created with vue-cli
    • With Terminal cd client && yarn && yarn run dev.
  2. 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 packages
      • touch database/database.sqlite to create an empty database file
      • cp .env.example .env to configure installation
      • php artisan key:generate to generate unique key for the project
      • php artisan jwt:secret to generate unique key for the project
      • php artisan migrate to create all the tables
      • php artisan db:seed to fill the tables with fake data
      • php artisan serve to serve application on localhost:8000

Usage

  1. Client side
  2. Server side
    • API endpoint is http://localhost:8000/api

Testing

Navigate to webservice folder and run the composer test script

$ composer test

Things worth mentioning

  1. 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;

  2. 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;

  3. 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;

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

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

Credits

Fábio Vedovelli

License

Licensed under the MIT license.

spa-starter-kit's People

Contributors

vedovelli avatar flyingluscas avatar vinicius73 avatar cristiano-pacheco avatar skoop avatar

Watchers

Eduardo Tavares avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.