Skip to content

Chartbrew Docs

Prerequisites

NodeJS v20+ (use only even versions)

NPM

MySQL (v5+) or PostgreSQL (12.5+)

Getting Started

Installation & Setup

TIP

The setup doesn't work in Windows PowerShell or cmd.exe. If you're using Windows, please use a bash command line like Git Bash or cygwin

Create a Chartbrew database

Chartbrew works with both MySQL and PostgreSQL. You can use any of the two, but you need to create a database first.

Follow the instruction here >>

Get and setup the project

sh
git clone https://github.com/chartbrew/chartbrew.git
cd chartbrew && npm run setup

Set up the environmental variables

All the environmental variables that need to be set are found in the .env-template file in the root folder of the project. If you ran the setup above, you should already have a .env file there as well. If not, copy the template file and rename it .env.

Make sure you fill out the production and development sections accordingly.

See the full list of variables here

Run the project locally

Open two terminals, one for front-end and the other for back-end.

sh
# frontend
cd client/
npm run start

# backend
cd server/
npm run start-dev

Changing the docs

Chartbrew uses Vuepress and you can check their documentation to see how it works. You can start the documentation development using the command below:

sh
cd chartbrew
npm run docs:dev

Tech stack

Backend

Frontend

Docs

Environmental variables

The table below shows the production variables. The development variables have the same naming, but they are appended with _DEV (example: CB_DB_NAME -> CB_DB_NAME_DEV)

VariableDefault valueDescription
CB_DB_NAME

required
chartbrewThe name of the database
CB_DB_USERNAME

required
No defaultThe username of the user that has access to the database
CB_DB_PASSWORDNo defaultThe password associated with the database user
CB_DB_HOST

required
localhostThe host address where the database is located
CB_DB_PORT3306The port of the hosting address
CB_DB_DIALECT

required
mysqlWhich database to use between mysql and postgres
CB_DB_CERTNo defaultIf your DB requires an SSL connection, use this variable to provide the string value of the certificate
CB_ENCRYPTION_KEY

required
A key will be generate for you during the first runA secure 32 bytes string which is used to encrypt the data in the database. Click here to generate one
CB_API_HOST

required
localhostThe address where the server app is running from. This variable is used internally by the server app.
This value is overwritten by the PORT variable (if set)
CB_API_PORT

required
4019The port where the server app is running from. This variable is used internally by the server app
VITE_APP_CLIENT_HOST

required
http://localhost:4018The full address where the client app is running from. This variable is used in the client app and it's populated during the building process.

Note The app needs to be restarted/rebuilt when this value is changed.
VITE_APP_CLIENT_PORT

required
4018The port where the client app is running from. This variable is used in the client app and it's populated during the building process.

Note The app needs to be restarted/rebuilt when this value is changed.
VITE_APP_API_HOST

required
http://localhost:4019The full address where the server app is running. This variable is used by the client app.

Note The app needs to be restarted/rebuilt when this value is changed.
CB_MAIL_HOSTsmtp.gmail.comThe server host of the email provider
CB_MAIL_USERNo defaultThe username used to log in on the email server
CB_MAIL_PASSNo deafultThe password used to log in on the email server
CB_MAIL_PORT465The port used to connect to the email server
CB_MAIL_SECUREtruetrue - Use SSL to connect to the email server

false - Use TLS to connect to the email server
CB_ADMIN_MAIL[email protected]The email address used to send the emails from
CB_RESTRICT_TEAMS00 - New users will have their own team created on sign-up.

1 - New users don't have a team on signup and can't create their own.
CB_RESTRICT_SIGNUP00 - Anyone can create accounts from the signup page

1 - New users can only sign up using invite links
CB_GOOGLE_CLIENT_IDNo defaultGoogle app Client ID generated from the Console

(Needed for Google integrations)
CB_GOOGLE_CLIENT_SECRETNo defaultGoogle app Client Secret generated from the Console

(Needed for Google integrations)
CB_BACKEND_WORKERS4Some background tasks in Chartbrew will use workers to spread work on multiple threads. Still testing, but for best performance, set this to the number of threads your CPU has