There are a few 3rd party services that are required to run the app:
Required
- Planetscale: Database
- Clerk: Authentication
Optional
- Tinybird: Time series database
- Upstash Kafka: Cache invalidation
Set environment variables in /apps/web/.env
and/or /apps/agent/.env
respectively and populate the values from the services above.:
cp apps/web/.env.example apps/web/.env
cp apps/agent/.env.example apps/agent/.env
For Planetscale the following variables will be used after you create your database:
DATABASE_HOST=aws.connect.psdb.cloud
DATABASE_USERNAME=...
DATABASE_PASSWORD=pscale_pw_....
pnpm install
Push the database schema to Planetscale:
Make sure you replace
user
,password
,host
anddb
with your own values
cd internal/db
DRIZZLE_DATABASE_URL='mysql://{user}:{password}@{host}/{db}?ssl={"rejectUnauthorized":true}' pnpm drizzle-kit push:mysql
Create a new application via their dashboard.
Once you have created the application, you need to create a single user from the UI and then enable and create an organization.
You need the organization ID for step 3
Unkey uses itself to manage its own API keys. To bootstrap the app, run the following command:
You need to provide the database credentials as well as the organization ID from clerk as TENANT_ID
export DATABASE_HOST=
export DATABASE_USERNAME=
export DATABASE_PASSWORD=
export TENANT_ID=org_xxx
pnpm bootstrap
This sets up the workspace and gets everything ready to run the app.
pnpm build
Add a .env
file in /apps/agent/.env
and populate the values from the services above.:
cp apps/agent/.env.example apps/agent/.env
Then run the api via the agent:
cd apps/agent
go run . agent --env ./.env
pnpm turbo run dev --filter=web
pnpm turbo run dev --filter=api
Download the Tinybird CLI from here and run the following command after authenticating:
cd packages/tinybird
tb push ./*.datasource
tb push
Add your auth token to the .env
file in /apps/agent/.env
and /apps/web/.env
respectively:
TINYBIRD_TOKEN=