apps/api/v2/README-PLATFORM.md
This setup will allow you to develop with api v2 locally and also test platform atoms with the examples app.
Open apps/api/v2/README.md and do all the steps except step 6 where you setup prisma.
We now need to setup platform OAuth client and OAuth 2.0 client that can be tested in the platform example app packages/platform/examples/base.
.env and in the platform examples app - open the root .env and set values for the platform OAuth client. The id and secret can be random values.SEED_PLATFORM_OAUTH_CLIENT_ID=
SEED_PLATFORM_OAUTH_CLIENT_SECRET=
Then you need to copy these values to the platform examples app environment.
packages/platform/examples/base/.env.example to packages/platform/examples/base/.env. There will be many environment variables already populated to make it easier for you.SEED_PLATFORM_OAUTH_CLIENT_ID into packages/platform/examples/base/.env NEXT_PUBLIC_X_CAL_IDSEED_PLATFORM_OAUTH_CLIENT_SECRET into packages/platform/examples/base/.env X_CAL_SECRET_KEYThen, we need to setup platform OAuth 2.0 client. We will need an id, and then hashed and plain secrets. To generate them you can:
cd apps/api/v2
yarn generate-secrets
and then the secrets will be written to apps/api/v2/.generated-secrets file containing:
plain - <PLAINTEXT_SECRET>
hashed - <HASHED_SECRET>
In the root .env set the following environment variables:
SEED_OAUTH2_CLIENT_ID=
SEED_OAUTH2_CLIENT_SECRET_HASHED=
where CLIENT_ID can be random but SECRET_HASHED is hashed secret above.
Then in the packages/platform/examples/base/.env set the NEXT_PUBLIC_OAUTH2_CLIENT_ID to be equal to SEED_OAUTH2_CLIENT_ID and OAUTH2_CLIENT_SECRET_PLAIN to the plain secret generated above.
{
"id": "clxyyy21o0003sbk7yw5z6tzg",
"name": "Acme",
"secret": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYW1lIjoiQWNtZSAiLCJwZXJtaXNzaW9ucyI6MTAyMywicmVkaXJlY3RVcmlzIjpbImh0dHA6Ly9sb2NhbGhvc3Q6NDMyMSJdLCJib29raW5nUmVkaXJlY3RVcmkiOiIiLCJib29raW5nQ2FuY2VsUmVkaXJlY3RVcmkiOiIiLCJib29raW5nUmVzY2hlZHVsZVJlZGlyZWN0VXJpIjoiIiwiYXJlRW1haWxzRW5hYmxlZCI6dHJ1ZSwiaWF0IjoxNzE5NTk1ODA4fQ.L5_jSS14fcKLCD_9_DAOgtGd6lUSZlU5CEpCPaPt41I",
"permissions": 1023,
"logo": null,
"redirectUris": "{http://localhost:4321}",
"organizationId": 1,
"createdAt": "2026-01-27 09:35:27.297",
"areEmailsEnabled": true,
"bookingCancelRedirectUri": null,
"bookingRedirectUri": null,
"bookingRescheduleRedirectUri": null,
"areDefaultEventTypesEnabled": true,
"areCalendarEventsEnabled": true
}
Then you need to copy id and secret to the platform examples app environment.
packages/platform/examples/base/.env.example to packages/platform/examples/base/.envpackages/platform/examples/base/.env NEXT_PUBLIC_X_CAL_IDpackages/platform/examples/base/.env X_CAL_SECRET_KEYThen, we need to setup platform OAuth 2.0 client. We will need an id, and then hashed and plain secrets. To generate them you can:
cd apps/api/v2
yarn generate-secrets
and then the secrets will be written to apps/api/v2/.generated-secrets file containing:
plain - <PLAINTEXT_SECRET>
hashed - <HASHED_SECRET>
Then in the packages/platform/examples/base/.env set the NEXT_PUBLIC_OAUTH2_CLIENT_ID to be equal to a random id and OAUTH2_CLIENT_SECRET_PLAIN to the plain secret generated above.
Then create a new entry in the OAuthClient table with the random id and hashed secret. It is important that the redirectUri is like below because that is where the examples app is running.
{
"clientId": "1c70be53f35aa480a5e3146d361fd993d265e564d2d86a203df3adbd05186517",
"redirectUri": "http://localhost:4321",
"clientSecret": "970db2cf14112013ba3a510b945294fef8737d42ee58c32031d2351692068ce7",
"name": "atoms examples app oauth 2 client",
"logo": null,
"clientType": "confidential",
"isTrusted": false,
"createdAt": "2026-01-27 09:35:26.731",
"purpose": "test atoms examples app with oauth 2",
"rejectionReason": null,
"status": "approved",
"userId": 10,
"websiteUrl": "http://localhost:4321"
}
I point userId to 10 aka [email protected].
Proceed to apps/api/v2/README.md step 6 to setup prisma and seed database if you need to.
If you want to test platform billing locally then please proceed to packages/platform/atoms/STRIPE.md tutorial.
If you followed steps above then examples app environment is setup.
If you also want to test apple connect calendar atom, then you need to create app specific password using your apple email and set the following variables:
ATOMS_E2E_APPLE_ID=
ATOMS_E2E_APPLE_CONNECT_APP_SPECIFIC_PASSCODE=
Finally, if you want that the examples app is tested using OAuth 2.0 client then you must set environment variable
NEXT_PUBLIC_OAUTH2_MODE="true" in packages/platform/examples/base/.env. If you want to test it using platform OAuth client then
comment this variable or set to false.
The dev-on command changes how atoms are built. Remember to run `yarn dev-off` when you are done testing atoms locally. If you update anything related to frontend, for example, Booker, then you need to run `yarn build-npm` again to rebuild atoms.
2. Start api v2:
Sometimes it happens that v2 api restarts because some unrelated log of build files changed, and if it makes examples app not wor you can just start it using:
cd apps/api/v2
yarn dev:build
yarn start
cd packages/platform/examples/base
rm -f prisma/dev.db && yarn prisma db push
cd packages/platform/examples/base
yarn dev
If you have set NEXT_PUBLIC_OAUTH2_MODE="true" then here is how to test it:
If you do test OAuth 2.0 using atoms then do below:
yarn dev in the root folder and login using any user into cal web app running locally.