QSApp Facebook Integration
This integration requires a full toolkit license. Please contact [email protected] for more information on how to register for our Enterprise Plan.
Developing the client
Setup
cd client
pnpm i
Common build tasks
| Task | Description |
|---|---|
gulp [default] | Build the client to dist/development, dist/staging or dist/production depending on flags |
gulp clean | Delete dist/development, dist/staging or dist/production depending on flags |
gulp dev-env | Run default build task, start watchers for live updates and host the game build locally |
gulp deploy | Deploy the client to Facebook Instant Games web hosting → shouldn't need to do manually |
Common flags for build / dev-env
| Flag | Description |
|---|---|
| Build or run the dev version of the client | |
--staging | Build or run the staging version of the client |
--production | Build or run the production version of the client |
--local | Build or run a special dev version that connects to the server running on localhost |
--bundle | Enable assets bundling → requires that bundler from @quicksave/build is used |
Common test tasks
| Task | Description |
|---|---|
pnpm lint | Run the linter for the project |
pnpm test | Run the tests for the project |
Developing the server
Setup
cd server
pnpm i
Common build tasks
| Task | Description |
|---|---|
gulp [default] | Build the server to dist/development, dist/staging or dist/production depending on flags |
gulp clean | Delete dist/development, dist/staging or dist/production depending on flags |
gulp dev-env | Run default build task, start watchers for live updates and run the server locally |
gulp deploy | Deploy the server to AWS using serverless → shouldn't need to do manually |
Common flags for build / dev-env
| Flag | Description |
|---|---|
| Build or run the dev version of the server | |
--staging | Build or run the staging version of the server |
--production | Build or run the production version of the server |
--db | Host and connect to a local instance of DynamoDB instead of connecting to AWS |
Common test tasks
| Task | Description |
|---|---|
pnpm lint | Run the linter for the project |
pnpm test | Run the tests for the project |
Different builds / App IDs
While there are three different build versions, there are only two different Apps (ie. Production / Staging) in Facebook. The dev builds' purpose is to allow local client development without having to run a local dev server.
| Client Build | Flags | Client App ID | Server Connection |
|---|---|---|---|
| dev | --local | staging | localhost |
| dev | staging | AWS dev | |
| staging | staging | AWS staging | |
| production | production | AWS production |
NOTE: All server requests are signed and authenticated using the App ID with
FBInstant.getSignedPlayerInfoAsync. This prevents accidentally using the wrong backend for any client. Make sure to use the correctTest URLfrom the gulp log when runninggulp dev-envsince the URL will decide which App ID the local dev client will use.