Installation

Everything needed to get the code, install all dependencies and run the project locally.

0. Prerequisites

  • Node Version Manager (NVM)

    With NVM (Node Version Manager), you can switch between different versions of Node.js and npm for different projects, ensuring that each project has the specific Node.js and npm environment it needs to run correctly. To install NVM on a Mac, you can use the curl command in your terminal:

    curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash

    After this close your terminal and open a new one. Verify the installation with:

    nvm --version

    This should display the version of NVM if the installation was successful.

    Please note that the version (v0.38.0) in the URL may change as new versions of NVM are released. Be sure to check the NVM repository for the latest version.

  • Docker Desktop for local development (https://docs.docker.com/desktop/install/mac-install/)

  • Account data of an email service (not required for local development)

  • Gitlab account to clone the repository (https://gitlab.com/)

1. Clone the repository

After purchase, you will be added to a private git repository on gitlab and will have permissions to clone the zauberstack repo. You will need to have a GitLab account for this.

Via SSH

git clone git@gitlab.com:juscheele/zauberstack.git

(If your SSH key isn't set - use HTTPS.)

Via HTTPS

git clone https://gitlab.com/juscheele/zauberstack.git

Then, remove the original origin:

git remote rm origin

This command removes the origin remote, which is the default name Git gives to the server from which you've cloned. The origin remote typically points to the repository on the server that you cloned from.

Add upstream pointing to this repository so you can pull updates

git remote add upstream git@gitlab.com:juscheele/zauberstack.git

This command adds a new remote called upstream that points to the original repository. This is useful if you want to pull updates from the original repository, which is common when you're working on a fork of the repository.

To pull updates

git pull upstream main

This command pulls updates from the main branch of the upstream repository. If there have been any changes to the main branch of the upstream repository since you last pulled, this command will update your local repository with those changes.

2. Enable Corepack

Corepack is a Node.js tool that allows you to use the local yarn from the repository without the need to install yarn globally. Enable it with the following command:

Ensure you have Node.js v16.9.0 or later installed:

node --version

Then run:

corepack enable

You can verify that Corepack has been enabled by running:

corepack --version

3. Set node version

Run the following command to use the Node.js version specified in the .nvmrc of the repository:

nvm use

3. Install dependencies

Use Yarn to install the project dependencies:

yarn install

4. Create .env files

Run the following commands from the project root to create the .env files for the api (zauberapi) and the client (zauberweb):

cp packages/api/.env.example packages/api/.env
cp packages/client/.env.example packages/client/.env

In the .env of the api, insert these stripe keys:

STRIPE_SECRET_API_KEY=STRIPE_SECRET_API_KEY

Stripe Webhook Secret

Create one here: https://dashboard.stripe.com/test/webhooks).After creation, go to the detail page of this hook and search "Signing secret" at the top.

STRIPE_WEBHOOK_SECRET=STRIPE_WEBHOOK_SECRET

5. Start docker services

Start the docker services required for local development with the following command in the project root:

docker-compose up -d

The services consist of a postgres database and "mailhog" that can be used to test emails.

6. Initialize and seed database

Migrate and seed the database with the following command from the project root:

yarn init-db

7. Start everything

Run the following command from the project root to start the entire zauberstack in development mode:

yarn start

Webapp:

http://localhost:3000

Marketing website:

http://localhost:5000

Backend server:

http://localhost:4000/

Mailhog dashboard for email testing

http://localhost:8025/

Last updated