Contributing
I am happy that you want to contribute to Pocket ID and help to make it better! All contributions are welcome, including issues, suggestions, pull requests and more.
Getting started
You've found a bug, have suggestion or something else, just create an issue on GitHub and we can get in touch.
Submit a Pull Request
Before you submit the pull request for review please ensure that
-
The pull request naming follows the Conventional Commits specification:
<type>[optional scope]: <description>
example:
fix: hide global audit log switch for non admin users
Where
TYPE
can be:- feat - is a new feature
- doc - documentation only changes
- fix - a bug fix
- refactor - code change that neither fixes a bug nor adds a feature
-
Your pull request has a detailed description
-
You run
npm run format
to format the code
Development Environment
Pocket ID consists of a frontend and backend. In production the frontend gets statically served by the backend, but in development they run as separate processes to enable hot reloading.
There are two ways to get the development environment setup:
1. Install required tools
With Dev Containers
If you use Dev Containers in VS Code, you don't need to install anything manually, just follow the steps below.
- Make sure you have Dev Containers extension installed
- Clone and open the repo in VS Code
- VS Code will detect .devcontainer and will prompt you to open the folder in devcontainer
- If the auto prompt does not work, hit
F1
and selectDev Containers: Open Folder in Container.
, then select the pocket-id repo root folder and it'll open in container.
Without Dev Containers
If you don't use Dev Containers, you need to install the following tools manually:
2. Setup
Backend
The backend is built with Gin and written in Go. To set it up, follow these steps:
- Open the
backend
folder - Copy the
.env.development-example
file to.env
and edit the variables as needed - Start the backend with
go run -tags exclude_frontend ./cmd
Frontend
The frontend is built with SvelteKit and written in TypeScript. To set it up, follow these steps:
- Open the
frontend
folder - Copy the
.env.development-example
file to.env
and edit the variables as needed - Install the dependencies with
npm install
- Start the frontend with
npm run dev
You're all set! The application is now listening on localhost:3000
. The backend gets proxied trough the frontend in development mode.
Testing
We are using Playwright for end-to-end testing.
If you are contributing to a new feature please ensure that you add tests for it. The tests are located in the tests
folder at the root of the project.
The tests can be run like this:
-
Visit the setup folder by running
cd tests/setup
-
Start the test environment by running
docker compose up -d --build
-
Go back to the test folder by running
cd ..
-
Run the tests with
npx playwright test
If you make any changes to the application, you have to rebuild the test environment by running docker compose up -d --build
again.