Getting started with the Bison SaaS Template

JM

Joshua Mitchell / September 01, 2020

2 min read

sad stone guy

Photo by Valdemaras D. on Unsplash

run

yarn create bison-app MyApp (or npx create-bison-app MyApp)

This will ask you to create a new GitHub repository:

create new github repository

At which point, you should create a new GitHub repository,

name new github repository

copy the URL,

copied github url

and paste it:

pasted github url

At which point, it will ask you for your database name:

database name request

Wait.. what database name?

Don't worry about it, yet. We'll set that up later. For now, just stick with the defaults (or whatever values you feel like, as long as you use the same ones in the next section).

use bison defaults

Once you hit enter and wait a few minutes, you should end up with a screen like this:

finished bison setup

To be clear, if I scroll back to the beginning, I did get a failure step:

install dependencies failure

But everything seemed to work OK anyway.

Okay, time to set up a database. I'll be using Docker to make our lives easier.

Postgres on Docker#

Create a new file named docker-compose.yaml in your project directory and put this stuff in there:

version: '3.7'
services:
  db:
    image: postgres:12.2
    restart: always
    environment:
      POSTGRES_DB: lm_dev
      POSTGRES_USER: postgres
      POSTGRES_HOST_AUTH_METHOD: trust # don't use this long term
      PGDATA: /var/lib/postgresql/data
    volumes:
      - ./pgdata:/var/lib/postgresql/data
    ports:
      - '5432:5432'

volumes:
  pgdata:

Now, do

docker-compose up

And wa-lah! You have a postgres instance.

postgres running in docker

PS: If you have Postgres installed, you might be running it in the background and that'll mean you might get this error:

port already in use

You just have to find the postgres process and stop it.

Okay, let's try and set up the data layer by running

yarn db:setup

postgres fully setup

Perfect! It works!

Finally, let's try running a development version of the site:

yarn dev

initial yarn dev error

Oops. To be continued...


Discuss on Twitter