Git Product home page Git Product logo

rubyblok-boilerplate's Introduction

Rubyblok Boilerplate

This repository is a demonstration of the Rubyblok gem, which provides integration between your Rails app and a Content Management System.

Context

Rubyblok is an easy way to integrate a visual CMS (Storyblok) into your Rails app, providing you with a proven integration path and quality of life features. With Rubyblok, you can edit your content online, preview it in real-time, and publish it with just the click of a button.

Why Rubyblok?

Rubyblok provides an abstraction layer and stores all your content locally, reducing data usage and enhancing performance. This enables new functionalities that leverage the local data, such as global content search, sitemaps, and listings. Ultimately, this setup increases resilience by eliminating dependency on external data sources.

Setup

This project requires the following setup:

  • ruby 3.2.2
  • nodejs 16.15.0
  • postgresql 14

Use the version managers of your preference to install.

Here is a simple way using asdf-vm to set them automatically:

brew install asdf
asdf plugin add ruby
asdf plugin add nodejs
asdf install
asdf current

Install the database:

brew install postgresql@14
brew services start postgresql

Add a .tool-versions file:

ruby 3.2.2
nodejs 16.15.0

Install the app dependencies:

bundle install

Create the database:

bundle exec rails db:setup

Click here to create a free acount at Storyblok, the platform where you will have access to the visual and real-time content editing.

Create the .env.local file and add your STORYBLOK_API_TOKEN:

mv .env .env.local

Get your Storyblok API token in your account, at Storyblok Space > Settings > Access token page.

Development

Build tailwind:

bundle exec rails tailwindcss:build

To continuously build the tailwind styles:

bundle exec rails tailwindcss:watch

This will watch for changes in your Tailwind CSS files and automatically recompile them as needed.

Run the Rails server:

bundle exec rails s

Open it at http://localhost:3000.

Local proxy to Storyblok

To connect with the Storyblok space we have to create a local proxy. For that, first create a PEM certificate for your localhost:

brew install mkcert
mkcert -install
mkcert localhost

This will create the localhost-key.pem and localhost.pem files.

To run the proxy, use the local-ssl-proxy tool:

npm install local-ssl-proxy -g
local-ssl-proxy --source 3333 --target 3000 --cert localhost.pem --key localhost-key.pem

This will start a proxy server.

Demo blocks creation

  1. Add your OAUTH token to the .env file storyblok.com > My account > Account Settings > Personal access token > Generate new token

  2. Create a new space for the template by running:

bundle exec rake storyblok:create_template_space

After the space is created (might need to refresh the page) select a plan according to your needs The region is set to EU by default which needs to ben changed based on your preference

  1. Login to the Storyblok CLI:
storyblok login

NOTE: The storyblok CLI tool is added via npm ( npm i storyblok -g ) and it needs nodejs 18 or above installed In some cases chmod -R 0600 /Users/{username}/.netrc is needed to be ran due to a known issue

  1. Add the template stories by running:
bundle exec rake storyblok:add_template_stories

Follow the rest of the readme to run and vie the project locally (proxy has to be setup and preview URL changed on Storyblok to your local one)

Now, just go to the Storyblok Space and it will be working! ๐ŸŽ‰

rubyblok-boilerplate's People

Contributors

mattmorvai avatar lkinas avatar jablajos avatar gabrielsods avatar

Stargazers

 avatar

Watchers

Alex Stubbs avatar Peter Green avatar Zoltan Iklodi avatar Willian Gustavo Veiga avatar Richie Viteri avatar  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.