The official PureWeb template for Create React App
npx create-react-app my-app --template @pureweb/cra-template-pureweb-client
On Mac OS when running npm 8+ you might need to specify create-react-app version 5.0.0
npx create-react-app@5.0.0 my-app --template @pureweb/cra-template-pureweb-client
This will generate a typescript-based react application, ready for you to customize and configure to your needs.
- Sign in to https://console.pureweb.io.
- Create a project
In order to develop your client against a given project and model that is already hosted on the PureWeb platform you will need to configure client.json
, located in the generated client code under src/client.json
.
{
"projectId": "b1f3a842-42e1-40b5-9f04-480cf87b59c8",
"modelId": "72e23f8d-c68b-422d-9f81-004922bfc37a"
}
You can optionally specifiy a version
of the model to use.
{
"projectId": "b1f3a842-42e1-40b5-9f04-480cf87b59c8",
"modelId": "72e23f8d-c68b-422d-9f81-004922bfc37a",
"version": "abcefg"
}
Alternatively, the projectId
, modelId
, and optional version
can also be specified through query parameters:
http://localhost:3000?projectId=b1f3a842-42e1-40b5-9f04-480cf87b59c8&modelId=72e23f8d-c68b-422d-9f81-004922bfc37a&version=abcefg
To learn more about the local workflow for running the game and the PureWeb streaming agent on your own machine, see the getting started information here: https://www.npmjs.com/package/@pureweb/platform-streaming-agent