Skip to content

Latest commit

 

History

History
130 lines (83 loc) · 2.73 KB

CONTRIBUTING.md

File metadata and controls

130 lines (83 loc) · 2.73 KB

Services

There are a few 3rd party services that are required to run the app:

Required

Optional

Tools

Setup

Unkey Repo

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_....

0.2 Install

pnpm install

1. Prepare databases

Push the database schema to Planetscale:

Make sure you replace user, password, host and db with your own values

cd internal/db
DRIZZLE_DATABASE_URL='mysql://{user}:{password}@{host}/{db}?ssl={"rejectUnauthorized":true}' pnpm drizzle-kit push:mysql

2. Clerk

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

3. Bootstrap Unkey

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.

Build

pnpm build

Run API

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

Run app

pnpm turbo run dev --filter=web

Run api

pnpm turbo run dev --filter=api

4. Tinybird (Optional)

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=