This documentation provides a basic overview of how to develop and run this application. Each module has its own README file with more detailed information.
To install dependencies and perform initial setup, run the following command:
npm run initialize
This does the following:
- install dependencies of this template
- copies
.env.exampleas.env.localhostto the parent folder
If you're using Mac and run into installation issues you can add --target=esbuild-darwin-arm64 as a workaround to npm install. This installs the correct version of a problematic package. For example:
npm install --save-dev esbuild@latest --target=esbuild-darwin-arm64
To compile the Game Node into endpoints and gameCode entrypoints used by Paima Engine, use the following command:
npm run pack
To compile the JavaScript Bundle of the middleware for the game frontend, run the command:
npm run pack:middleware
Ensure that the paima-engine-{linux|mac} executable is located in the parent directory of this project. The directory structure should be as follows:
this-template
../paima-engine-linux
../.env
Config file .env.localhost is created during npm run initialize in the parent folder, based on .env.example in this project. This is an empty file that you need to fill in with your specific values, before running Paima Engine.
Feel free to use examples written in the file for initial testing.
- Start a local network using
npm run chain:start npm run chain:deploy
To reflect changes in the API, use the following command to regenerate all tsoa routes:
npm run compile:api
If there are any changes to the DB schema or queries, start the pgtyped watcher process using the following command. It will regenerate all the DB types used in the project:
npm run compile:db
To speed up the development cycle you can at any time completely reset the database and start syncing from the latest blockheight. Run this command, that will modify your .env.localhost and docker-compose.yml files:
npm run database:reset
To start the database, run the command:
npm run database:up
To run the Game Node, follow these steps:
- Change to the parent directory where the packaged folder was generated:
cd ..
- Execute the following command:
./paima-engine-linux run
You can set the NETWORK variable if you want to load a custom config for your Game Node. For example to load .env.localhost use:
NETWORK=localhost ./paima-engine-linux run
If you've got this far you're probably already familiar with our documentation. But if you need to refresh your knowledge you can copy the documentation files to your file system by using the standalone CLI command:
./paima-engine-linux docs
Or you can visit our Paima Documentation Website at any time.