There are a few options for running Playnite-Web for local development. The options are:
- via Docker and the included dev container (includes everything you need to run and develop).
- directly on your development machine (requires installing required tooling such as Node.js, yarn, etc.).
- via a GitHub codespace.
Install the following software on your local development machine:
- git
- Bash (this guide assumes a bash shell)
- vscode
- Docker (for Mongodb and MQTT dependencies)
- Node.js@>=20.9.0 (recommend using
nvm
to manage Node.js installations) - yarn@^4.0.0
- With Node.js installed, run
corepack enable && corepack prepare --activate yarn@^4.0.0 && yarn set version berry
- With Node.js installed, run
- Run
yarn nx run devenv:prepare
to ensure consistent developer experience with GraphQL, formatting, etc.
- Fork the playnite-web repo
- Clone your forked repo to your local development machine.
- Open the repo in vscode.
- Run
yarn
- Run
yarn nx run playnite-web-app:start
and navigate to https://localhost:3000- Note that MQTT and Mongo will be started via docker automatically.
- Mongo will restore a default database if no database already exists (if there are no files in
.data/mongodb
). - Note MQTT currently starts with no username/password configured.
- [Optional]: override environment variables when running locally via
cp apps/playnite-web/local.env apps/playnite-web/overrides.env
- REMEMBER: do not commit
overrides.env
or sensitive information inlocal.env
.
- REMEMBER: do not commit
Application | Command | Notes |
---|---|---|
Playnite-Web App | yarn nx run playnite-web-app:start |
Run Playnite-Web application locally. Navigate to https://localhost:3000 in a browser. Environment variables are pulled from ./apps/playnite-web/local.env . |
Playnite-Web App | yarn nx run playnite-web-app:test/components |
Run component tests for development. |
Playnite-Web App | yarn nx run playnite-web-app:test/components/visual |
Run visual regression component tests for development. |
Playnite-Web App | yarn nx run playnite-web-app:test/components/visual/update |
Run visual regression tests with intention to update a baseline screenshot. |
Playnite-Web App | yarn nx run playnite-web-app:test/e2e |
Run end-to-end (e2e) tests for development (including visual regression capabilities). A consistent database restored along with consistent game assets. This ensures a reliable data set to test against. |
Playnite-Web App | yarn nx run playnite-web-app:test/e2e/update |
Run end-to-end (e2e) tests with intention to update a baseline screenshot. |
Playnite-Web App | yarn nx run playnite-web-app:test/**/ci |
Suffix any test target with /ci to run the tests in CI mode; the same as what is run in CI. |
Install the following software on your local development machine:
- git
- Bash (this guide assumes a bash shell)
- vscode
- Docker
- vscode Devcontainers extension
- XServer (for running Cypress tests in container).
- For OSX, recommend: XQuartz
- For Windows, still need a recommendation.
- Fork the playnite-web repo
- Clone your forked repo to your local development machine.
- Open the repo in vscode.
- Run
yarn
- Ensure your XServer application is running (if running Cypress tests).
- Ensure your XServer is configured to Authenticate and Allow Connections from network clients
- Once in vscode, Devcontainers: Rebuild and Reopen in container.
- This can be done via the command palette (
Cmd + Shift + P
/Ctrl + Shift + P
) and typing inRebuild and reopen in container
. - This will build a docker image based on the repo's
.devcontainer/Dockerfile
, start, and then open the repo in that container.
- This can be done via the command palette (
Note that MongoDB and Mosquitto (MQTT) are already setup and installed for localhost when using a devcontainer. See the ./local.env
file for their connection details.