Local Environment Setup
Setup
Required Software
Install the following software on your local development machine:
git
Bash (this guide assumes a bash shell)
Docker (for Mongodb and MQTT dependencies)
Node.js (see package.json for version; use
nvmto manage Node.js installations)yarn
With Node.js installed, run
corepack enablein the repo directory.
Preparing Codebase
Clone your forked repo to your local development machine.
Open the repo in vscode.
Run
yarnRun
yarn nx prepare devenv. This is only required for the first time working with the codebase.Run
yarn nx start playnite-web-appand navigate to http://localhost:3000Note an empty games database will be started automaticallk via Docker.
Restore a test database via
yarn nx use-snpashot playnite-web-app SNAPSHOT_NAME. See available snapshots.
[Optional]: override environment variables when running locally via
cp apps/playnite-web/local.env apps/playnite-web/overrides.envREMEMBER: do not commit
overrides.envor sensitive information inlocal.env.
Running Application/Services
Playnite Web App
Command | Notes |
|---|---|
| Run Playnite Web application locally. Will automatically start dependent services via docker-compose (Database and MQTT). Navigate to http://localhost:3000 in a browser. |
| Run only after Playnite Web is running; will seed database with demo data. To remove all data, simply delete the Database container that was started via the start target. |
| Run component tests for development. |
| Run component tests with intention to update a baseline screenshot. |
| Run component tests with intention to update baseline screenshots. Runs only tests matching glob CLI parameter; e.g. |
| Run end-to-end (e2e) tests for development (including visual regression capabilities). The database will be cleared and repopulated before every test to ensure a consistent dataset for testing. |
| Run end-to-end (e2e) tests with intention to update a baseline screenshot. |
| Run end-to-end (e2e) tests with intention to update a baseline screenshot. Runs only tests matching glob CLI parameter' e.g. |
| Build and package to run end-to-end (e2e) tests. Note updates to the source application will not be reflected after running this command and will require re-running the command. Tests packaged docker image. |
| Build and package to run end-to-end (e2e) tests, but for debugging CI failures. Note updates to the source application will not be reflected after running this command and will require re-running the command. Tests packaged docker image. |
| Run Jest-based unit tests. |
Sync Library Processor
Command | Notes |
|---|---|
| Starts service. |
| Runs Jest-based e2e tests, found in the |
Database/schema Changes
Changing the database schema (defined in the schema.prisma file) will require the changes to be tracked as a database migration. Make necessary changes to schema, then create a migration via yarn nx create-migration db-client. The generated migation files should be committed to the repo.
Playnite Web Plugin Development
To develop the Playnite Web plugin, a Windows machine is required. Playnite must be installed. Recommendation is to use Visual Studio Community edition for development.
Install required software
Playnite
Visual Studio
Open the solution file in Visual Studio; located in
apps/PlayniteWebPlugin/src/PlayniteWeb.sln.Build the solution.
Open Playnite and add the path to the bin directory as a local plugin. This setting is found under the Developer section in the settings.
Debugging opens Playnite with the plugin installed.