Giter Club home page Giter Club logo

lantern-core's Introduction

Lantern Core

A framework for building large vue.js applications. Many useful tools built in, but totally flexible to use or replace what you don't like or don't need.

Take the application for a spin: vue-lantern

Features

Dependency Container - Declare your dependencies for your application and let bottle.js manage your dependency tree.

app.bind('api', function (container) {
  return new Api(container.http, config)
})
app.make('events').fire('example.test', 'This is a test!')

Auth - Authenticate and authorize your users with ease. Supports firebase and laravel drivers.

import { auth } from 'app'

auth.attempt('[email protected]', 'password')
auth.allowed(user.scopes)
<button v-guard="['admin', 'submit_tickets']"></button>
<button v-guard:deny="['trial']"></button>

Database & Search - Support for laravel, firebase and algolia out of the box.

search('examples/foo', 'tag')
search.driver('algolia').searchIndex('examples_index', 'tag')

Blueprint - Define your data model once, bootstrap your access to data with ease!

export default {
  name: 'example',
  driver: 'laravel',
  events: {...},
  module: {...},
  transformRequest () {...},
  transformResponse () {...}
}
model('example').create({ name: 'test', message: 'Hello world!'})
model('example').driver('algolia').all()

Vuex - Use vuex-bootstrappers to reduce the time it takes to setup your modules.

module: {
  namespaced: true,
  bootstrap: [ 'getters', 'mutations' ],
  state: {
    'name': '',
    'message': ''
  }
}

Vue-Router - Write simple middleware to protect routes and reset data store.

export default {

  /**
   * Middlware before the user hits a route.
   * @param  {Lantern} app  The application.
   * @return {undefined}
   */
  handleBefore ({ auth }) {
    return (to, from, next) => {
      // If authenticated and accessing a guest only route, redirect to appropriate page
      if (auth.authenticated() && to.meta && to.meta.guest) {
        return next(config.redirect)
      }

      // If not authenticated and not accessing the guest path, redirect to the guest path
      if (!auth.authenticated() && to.path !== config.guest) {
        return next(config.guest)
      }

      // If the user does not have the given access permissions, throw an error
      if (!auth.routeGuard(to)) {
        return next(false)
      }

      return next()
    }
  }
}

Build Setup

# install dependencies
npm install

# serve with hot reload at localhost:8080
npm run dev

# build for production with minification
npm run build

# build for production and view the bundle analyzer report
npm run build --report

# run unit tests
npm run unit

# run e2e tests
npm run e2e

# run all tests
npm test

Version Roadmap

  • 0.1.0 Firebase Integrated
  • 0.2.0 Auth Drivers
  • 0.3.0 Vuex Cleanup
  • 0.4.0 Vue Cleanup
  • 0.5.0 Email / Username Example Login Page
  • 0.6.0 Final Check on Bugs
  • 0.7.0 Global Catch Block (Experimental)
  • 1.0.0 Released

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.