# Chartbrew Docs

# Prerequisites

NodeJS v12.17.0+

  • For M1 Macs you might need the latest v14
  • v15 is not fully supported

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 (opens new window) or cygwin (opens new window)

# Run your database instance and create the chartbrew database

Important! Make sure you have a MySQL or PostgreSQL instance running and you have created a database for Chartbrew. Follow the instruction here >>

# Quickstart

npx create-chartbrew-app chartbrew

The CLI tool creates a chartbrew/.env file which you can configure at any time if you want to change the database, API & client host, etc. The file contains comments explaining what each environmental variable is for.

# Developing and extending the application

If you plan on doing this, setup the app like so:

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

If you submit any PRs, please follow the guidelines here (opens new window).

# 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 database migrations

Running the migrations will ensure that you have the most up-to-date database schema. Ensure that all environmental variables are set before running the following command in the server folder:

cd server
npm run db:migrate

# Run the project in Development

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

# frontend
cd client/
npm run start

# backend
cd server/
npm run start-dev

# Changing the docs

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

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)

Variable Default value Description
CB_DB_NAME chartbrew The name of the database

required
CB_DB_USERNAME No default The username of the user that has access to the database

required
CB_DB_PASSWORD No default The password associated with the database user
CB_DB_HOST localhost The host address where the database is located

required
CB_DB_PORT 3306 The port of the hosting address
CB_DB_DIALECT mysql Which database to use between mysql and postgres

required
CB_SECRET change_to_random_string A secure string which is used to encrypt the data in the database

required
CB_API_HOST localhost The address where the server app is running from. This variable is used internally by the server app.

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

required
REACT_APP_CLIENT_HOST http://localhost:3000 The 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.

required
REACT_APP_API_HOST http://localhost:3210 The 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.

required
CB_MAIL_HOST smtp.gmail.com The server host of the email provider
CB_MAIL_USER No default The username used to log in on the email server
CB_MAIL_PASS No deafult The password used to log in on the email server
CB_ADMIN_MAIL [email protected] The email address used to send the emails from
CB_RESTRICT_TEAMS 0 0 - 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.