Spina CMS
Spina Academy
Home Guides

How to get started with Spina CMS

You've decided to try out Spina CMS. Awesome! Getting started is easy, the only thing you need is a terminal and a code editor.

In case you're new to Ruby and/or Rails, make sure you install all the necessary software first. It helps if you're familiar with Rails development, but it's not a hard requirement to get started with Spina CMS.

You can find many guides online on how to install Ruby/Rails, but it can be hard to find the right one. Instead of Googling and scouring Stack Overflow, you can skip all that and visit GoRails: Install Ruby On Rails.
Spina requires Ruby 2.7+, Rails 6+ and PostgreSQL

Installing Spina

All set? Nice.

Spina doesn't include its own project generator (yet). That means we'll begin by creating a new Rails app first. Open your terminal and use cd to navigate to your desired projects folder. After that run this command:
> rails new mywebsite --database=postgresql
Notice that I set the database to PostgreSQL when generating my new Rails app. It's possible to switch databases after generating a Rails app, but it's easier to do it all in one go.

Don't forget to run the next command to create your database:
> rails db:create
After your Rails app is generated, open your newly created project in your favourite code editor.

Open the Gemfile and add the spina gem on a new line.
# Spina
gem 'spina', '~> 2.18'
It's good practice to specify the version you'd like to install. In this case I'm making sure I'm installing the latest v2.18. When new versions are released I can run bundle update spina to update Spina up to v3. I also like to add comments to my Gemfile so I can keep track of everything I'm installing.
Upgrading to v3 will require a change in my Gemfile, because v3 will probably have breaking changes.
After adding Spina to your Gemfile, run bundle install in the terminal to install it.
> bundle install

Images and uploads (optional)

A website without images is kinda dull. Let's fix that!

Spina uses Rails' built-in ActiveStorage framework to handle uploads and image transformations. It isn't activated out of the box though. Run the following command in the terminal to activate ActiveStorage.
> rails active_storage:install
This command generates a couple of migrations, but you don't have to migrate your database yet. That will happen in the next step.

Installing Spina

In order to run Spina, your project will need the appropriate database tables and initializers. Luckily, you don't have to add those manually. We created a helpful generator!

Open the terminal and run the following command:
> rails g spina:install
Spina's database migrations will be added to your project and your database will be migrated automatically (including the ActiveStorage migrations). The install generator will ask you a couple of questions to setup your first account:
> What would you like to name your website?
> What theme do you want to use?
> Please enter an email address for your first user:
> Create a temporary password:
Don't worry too much about what to fill in here, this is used to get up and running in your development environment. You can change these anytime.
Spina includes two barebones themes: default and demo. The difference between the two is that the demo theme includes a view template with all the available content parts as an example. Both themes contain no custom HTML or CSS, that's all up to you!

You can change your theme later, or start with the default theme and edit that.

Boot up your server

It's time to take a look at what you've created! In your terminal run the following command to start your server:
rails s
Go to http://localhost:3000 in your browser to view your website for the first time. You can visit the admin panel by going to /admin and logging in with your email and temporary password.