Code Monkey home page Code Monkey logo

vue-storyteller's Introduction

vue-storyteller

A Vue.js/Bootstrap 4 SPA boilerplate for Storyblok's headless CMS

An experiment by Team SI's developers

This project is a work in progress, created for evaluating the feasibility of using a decoupled, headless / API-first architecture at Team SI. The goal is for the content store (CMS) to declare all the layouts/components rendered by the SPA, making a headless CMS a real possibility for marketing websites where quick content and layout changes are often needed.

Vue.js makes this possible by binding the data source to dynamic components such as grid elements, carousels, call-to-actions and other reusable "blocks".

Demo Site

Concepts

  • Simply create your schemas and data in the CMS, then code reusable Vue.js components in this project with props to match the schema.
  • To use components this project already includes, just create your content schemas to match the props.
  • dist folder can be deployed directly to a CDN - no need for a full web server.
  • Site can be pre-rendered with Netlify's pre-rendering service to allow search engines to pick up content generated by Javascript (we plan to look into server-side rendering later).

Features (so far)

  • CI/CD support: we add the DEPLOY_PRIME_URL environment variable value to API requests as the env parameter to eliminate CORS issues that could arise from accessing the API from multiple environments. Works great with Netlify Deploy Previews!
  • Multi-site ready: just add each space's token to an API_TOKEN environment variable.
  • Dynamic navigation support, allowing the data store to define a custom navbar - or even a mega menu.
  • Several reusable content blocks. So far we have support for grid rows and columns, hero components, call-to-actions, markdown, images, and Youtube videos.
  • Reusable page templates.
  • Automatic lazy loading and in-place image optimization on image components via StoryBlok's Image Service (just specify the width and/or height on each component instance).

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

For a detailed explanation on how things work, check out the guide and docs for vue-loader.

Copyright and license

Code and documentation copyright 2017 by the authors and Team SI. Code released under the MIT License.

vue-storyteller's People

Contributors

jmotes avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Forkers

jmotes

vue-storyteller's Issues

Add reusable component layouts

  • use custom routes? That would be easiest - just add a path to the slug.
  • nested components? Really don't want to require that.
  • custom loader to nest components at the code level based on a "template" dropdown choice?
  • nest custom layouts within a folder so a different root block can be used?

Some of these options requires the components to be able to directly request data from the API. Do we have the endpoints to do that?

Add ImgIx example

We need to start this off right and always size images correctly.

Add serverless middleware / proxy for stories CDN invalidation

Add middleware (Azure or Lambda function) that sits between the API CDN and frontend apps and adds a new timestamp token to requests each time a webhook call indicates content has been updated.

The webhook will change an environment variable in the function.

This will enable us to make cached requests to the CDN (much better performance) and still have instant cache invalidation.

Create demo site

Investigate using https://www.netlify.com/ since they have a free option.

There are other companies that offer free hosting for open source projects too however.

Need to document the process to push to whatever host is chosen.

NOTE: Netlify offers prerendering. That would eliminate the need for SSR.

CORS issues with Deploy Previews

Deploy previews create a unique URL. This causes CORS issues with Storyblok/Cloudfront since they expect the configured PROD url.

This can be fixed by allowing the env parameter to be set to a matching environment variable on the preview instance.

resolveLinkById - add option to pull all links in one request

This option isn't a great idea for sites with hundreds of stories, but will speed up navbar loadup time on smaller sites.

In the future I want to add some middleware that will collect just the links used by the global nav lists and the current story and cache for quick access. When that's added, this option will make sense to use even on sites with a large number of pages.

Add dynamic nav

Maybe use a "pages meta" component to allow marking a page as "include in nav".

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.