Prerequisites

Before getting started, you'll need these global packages installed:

  • Node.js (v12) - the easiest way to install is via nvm
  • pNpm - for managing dependencies
  • PostgreSQL (v12) - PostgreSQL database

You can read more about the engine requirements from the package.json on GitHub.

Fork repository

First, you'll need to make a fork of the LogChimp repository. Click on the fork button at the top right, wait for a copy to be created on your personal GitHub account, and you should be all set!

Tip

You'll also need a LogChimp theme as a client to interact with LogChimp APIs.

  • LogChimp Core APIs - https://github.com/logchimp/logchimp/tree/master/packages/server
  • LogChimp default theme (including dashboard) - https://github.com/logchimp/logchimp/tree/master/packages/theme

Install dependencies

pnpm install

Once you run the command at the root of the repository, it will install all the required dependencies for the client and backend.

Setup PostgreSQL database

There are a few ways to set up a database:

To spin up a database quickly and easily on your local machine, we recommend using the PostgreSQL Docker image.

docker run -d \
  --name db \
  -p 5432 \
  -e POSTGRES_DB=$database_name \
  -e POSTGRES_USER=$database_user \
  -e POSTGRES_PASSWORD=$strong_password \
  postgres:12.4

Once you take down the Postgres Docker container, all the data is also removed. To persist the data on your machine, you can add this line.

-v logchimp_db_data:/var/lib/postgresql/data

Configuration file

Warning

Starting from v0.4.0, .env has been replaced with logchimp.config.json.

Create a logchimp.config.json file in the root directory, which will contain all the configuration for the LogChimp site.

Start LogChimp

You need two separate terminal windows to run the client and backend separately.

# in terminal 1 - to run LogChimp core
cd ./packages/server
pnpm run dev

# in terminal 2 - to run LogChimp theme
cd ./packages/theme
pnpm run dev