3.0 KiB
						
					
					
				
			
		
		
		
		
	
	Ghostfolio Development Guide
Development Environment
Prerequisites
- Docker
 - Node.js (version 
>=22.18.0) - Create a local copy of this Git repository (clone)
 - Copy the file 
.env.devto.envand populate it with your data (cp .env.dev .env) 
Setup
- Run 
npm install - Run 
docker compose -f docker/docker-compose.dev.yml up -dto start PostgreSQL and Redis - Run 
npm run database:setupto initialize the database schema - Start the server and the client
 - Open https://localhost:4200/en in your browser
 - 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
English (Default)
Run npm run start:client and open https://localhost:4200/en in your browser.
Other Languages
To start the client in a different language, such as German (de), adapt the start:client script in the package.json file by changing --configuration=development-en to --configuration=development-de. Then, run npm run start:client and open https://localhost:4200/de 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
Component Library (Storybook)
https://ghostfol.io/development/storybook
Git
Rebase
git rebase -i --autosquash main
Dependencies
Angular
Upgrade (minor versions)
- Run 
npx npm-check-updates --upgrade --target "minor" --filter "/@angular.*/" 
Nx
Upgrade
- Run 
npx nx migrate latest - Make sure 
package.jsonchanges make sense and then runnpm install - Run 
npx nx migrate --run-migrations 
Prisma
Access database via GUI
Run npm run database:gui
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
SSL
Generate localhost.cert and localhost.pem files.
openssl req -x509 -newkey rsa:2048 -nodes -keyout apps/client/localhost.pem -out apps/client/localhost.cert -days 365 \
  -subj "/C=CH/ST=State/L=City/O=Organization/OU=Unit/CN=localhost"