You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ghostfolio/DEVELOPMENT.md

2.4 KiB

Ghostfolio Development Guide

Development Environment

Prerequisites

  • Docker
  • Node.js (version 20+)
  • Create a local copy of this Git repository (clone)
  • Copy the file .env.dev to .env and populate it with your data (cp .env.dev .env)

Setup

  1. Run npm install
  2. Run docker compose --env-file ./.env -f docker/docker-compose.dev.yml up -d to start PostgreSQL and Redis
  3. Run npm run database:setup to initialize the database schema
  4. Run git config core.hooksPath ./git-hooks/ to setup git hooks
  5. Start the server and the client (see Development)
  6. Open https://localhost:4200/en in your browser
  7. Create a new user via Get Started (this first user will get the role ADMIN)

Start Server

Debug

Run npm run watch:server and click Debug API in Visual Studio Code

Serve

Run npm run start:server

Start Client

Run npm run start:client and open https://localhost:4200/en in your browser

Start Storybook

Run npm run start:storybook

Migrate Database

With the following command you can keep your database schema in sync:

npm run database:push

Testing

Run npm test

Experimental Features

New functionality can be enabled using a feature flag switch from the user settings.

Backend

Remove permission in UserService using without()

Frontend

Use @if (user?.settings?.isExperimentalFeatures) {} in HTML template

Git

Rebase

git rebase -i --autosquash main

Dependencies

Angular

Upgrade (minor versions)

  1. Run npx npm-check-updates --upgrade --target "minor" --filter "/@angular.*/"

Nx

Upgrade

  1. Run npx nx migrate latest
  2. Make sure package.json changes make sense and then run npm install
  3. Run npx nx migrate --run-migrations

Prisma

Access database via GUI

Run npm run database:gui

https://www.prisma.io/studio

Synchronize schema with database for prototyping

Run npm run database:push

https://www.prisma.io/docs/concepts/components/prisma-migrate/db-push

Create schema migration

Run npm run prisma migrate dev --name added_job_title

https://www.prisma.io/docs/concepts/components/prisma-migrate#getting-started-with-prisma-migrate