Developing Hive locally requires you to have the following software installed locally:
- Node.js (or
nvmorfnm): check thepackage.jsonenginesentry for the correct version - pnpm: check the
package.jsonenginesentry for the correct version - Docker version 26.1.1 or later(previous versions will not work correctly on arm64)
- make sure these ports are free: 5432, 6379, 9000, 9001, 8123, 9092, 8081, 8082, 9644, 3567, 7043,
10255 (OTEL collector
/metrics) - If using the optional observability profile (see below), additionally: 3030 (Grafana), 9090 (Prometheus)
- Clone the repository locally
- Make sure to install the recommended VSCode extensions (defined in
.vscode/extensions.json) - In the root of the repo, run
nvm use(orfnm use) to use the required Node.js version - Create
.envfile in the root, and use the following:
ENVIRONMENT=local- Run
pnpm iat the root to install all the dependencies and run the hooks - Run
pnpm local:setupto run Docker compose dependencies, create databases and migrate database
Solving permission problems on this step:
export UID=$(id -u)
export GID=$(id -g)Add "user" field to ./docker/docker-compose.dev.yml
clickhouse:
user: '${UID}:${GID}'
db:
user: '${UID}:${GID}'
- Run
pnpm generateto generate the typings from the graphql files (usepnpm graphql:generateif you only need to run GraphQL Codegen) - Run
pnpm buildto build all services - Click on
Start Hivein the bottom bar of VSCode (alternatively you can manually start the services you need) - Open the UI (
http://localhost:3000by default) and Sign in with any of the identity provider - Once this is done, you should be able to log in and use the project
We have a script to feed your local instance of Hive with initial seed data. This step is optional.
- Use
Start Hiveto run your local Hive instance - Make sure
usageandusage-ingestorare running as well (withpnpm dev) - (Optional) Seed a organization with many projects and users
pnpm seed:org - Open Hive app, create a project and a target, then create a token (or use the previously created one)
- Run the seed script:
FEDERATION=<0|1> TOKEN=<access_token> TARGET=<target_id> pnpm seed:schemas - This should report a dummy schema
- Run the usage seed to generate some dummy usage data to your local instance of Hive, allowing you
to test features e2e:
FEDERATION=<0|1> TOKEN=<access_token> TARGET=<target_id> pnpm seed:usage
Note: You can set
STAGE=<dev|staging|local>in order to target a specific Hive environment and seed a target there.TARGET=<target_id>can be obtained via target's Settings page → General → Resource ID.TOKEN=<access_token>is created on organization's Setting's page → Access Tokens
To send more operations with
seed:usage, and test heavy load on Hive instance, you can also setOPERATIONS(amount of operations in each interval round, default is10) andINTERVAL(frequency of sending operations, default:1000ms). For example, usingINTERVAL=1000 OPERATIONS=1000will send 1000 requests per second. And setBATCHESto set the total number of batches to run before the seed exits. Default: 10.
We recommend the following flow if you are having issues with running Hive locally:
- Stop all Docker containers:
docker kill $(docker ps -q) - Clear all local Docker environment:
docker system prune --all --force --volumes - Delete all generated local
.envfiles:find . -name '.env' | xargs rm - Delete local
docker/.hiveanddocker/.hive-devdir used by Docker volumes. - Reinstall dependencies using
pnpm install - Force-generate new
.envfiles:pnpm env:sync --force
The dev stack includes an opt-in observability profile that runs Grafana and Prometheus locally
with the production dashboards. It's useful when working on metrics, alerts, or anything that relies
on visualizing what services emit. The default pnpm local:setup and the VSCode Start Hive button
do not start it.
The observability profile runs alongside the default stack, not instead of it. Start the default stack first (either way works), then add the observability profile on top.
If you already started Hive via pnpm local:setup or the VSCode Start Hive button:
docker compose -f docker/docker-compose.dev.yml --profile observability up -dIf you're starting from scratch and want both at once:
docker compose -f docker/docker-compose.dev.yml --profile observability up -d --remove-orphansEither command is idempotent and safe to re-run.
- Grafana: http://localhost:3030 (anonymous admin enabled, local only). All dashboards from
deployment/grafana-dashboards/appear under the "Hive Monitoring (local)" folder. - Prometheus: http://localhost:9090, scrape targets at http://localhost:9090/targets.
- Datasource UID locally:
local-prom(clearly distinct from the prod UIDgrafanacloud-promso there's no ambiguity about which environment you're looking at).
A small grafana-dashboard-init container copies the JSON files from
deployment/grafana-dashboards/ into docker/.hive-dev/grafana/dashboards/ at startup, performing
the same parameter substitution Pulumi does (PROM_DATASOURCE_UID becomes local-prom,
TABLE_SUFFIX becomes dev). Grafana picks them up via file-based provisioning. The source JSONs
stay the single source of truth.
Prometheus is configured to scrape host.docker.internal:10254, which is where Hive services expose
/metrics by default (their PROMETHEUS_METRICS_PORT env var defaults to 10254). The compose
file sets extra_hosts: host.docker.internal:host-gateway on the prometheus service so this
resolves on Linux too (Docker Desktop on macOS/Windows provides it automatically).
The OTEL collector container internally listens on 10254 as well, but
docker/docker-compose.dev.yml publishes that container port on
host port 10255, not 10254, so the host's port 10254 stays free for any Hive service a developer
runs natively (via pnpm dev or the VSCode Start Hive button). Prometheus reaches the OTEL
collector via docker DNS (otel-collector:10254), which is unaffected by the host mapping choice.
If you run more than one Hive service natively at the same time, only the first can use port 10254.
For the others, set PROMETHEUS_METRICS_PORT to a different free port and add it as an extra target
in docker/configs/prometheus/prometheus.yml.
Grafana inside the container runs as UID 472. On Linux bind mounts that can produce
permission-denied errors when Grafana tries to write to docker/.hive-dev/grafana/data. The same
UID/GID workaround documented above for clickhouse/db applies: add user: '${UID}:${GID}' to
the grafana service entry in docker/docker-compose.dev.yml (and ensure those env vars are
exported in your shell). macOS does not need this.
-
Start Hive locally
-
Create a project and a target
-
Create a token from that target
-
Go to
packages/libraries/cliand runpnpm build -
Inside
packages/libraries/cli, run:pnpm start schema:publish --registry.accessToken "YOUR_TOKEN_HERE" --registry.endpoint "http://localhost:3001/graphql" examples/single.graphql
The registry endpoint is the GraphQL endpoint of your local
serverservice. You can also edit thehive.jsonfile in theclipackage to avoid passing theaccessTokenandendpointevery time.
- Download Loophole CLI (same as ngrok but supports non-random urls)
- Log in to Loophole
$ loophole account login - Start the proxy by running
$ loophole http 3000 --hostname hive-<your-name>(@kamilkisiela I usehive-kamil). It createshttps://hive-<your-name>.loophole.siteendpoint. - Message @kamilkisiela and send him the url (He will update the list of accepted redirect urls in Slack App).
- Update
APP_BASE_URLinpackages/web/app/.envto the proxy URL (e.g.https://hive-<your-name>.loophole.site) - Run
packages/web/appand openhttps://hive-<your-name>.loophole.site.
We have a special Slack channel called
#hive-teststo not spam people :)
- Follow first two steps from
Setting up Slack App for developing(download loophole and log in). - Start web app proxy:
$ loophole http 3000 --hostname hive-<your-name> - Start server proxy:
$ loophole http 3001 --hostname hive-<your-name>
- Go to
Settings->Developer settings->GitHub Apps, and click on theNew GitHub Appbutton. - Provide a name for your app, and set the
Homepage URLtohttps://hive-<your-name>.loophole.site. Then set the callback URL tohttps://hive-<your-name>.loophole.site/api/github/callback, and post installation's callback URL tohttps://hive-<your-name>.loophole.site/api/github/setup-callback. - Click on
Create GitHub App.
-
Server: Set the following env variables in
packages/services/server/.env:INTEGRATION_GITHUB=1 INTEGRATION_GITHUB_GITHUB_APP_ID=<your-github-app-id>
You'll find the GitHub App ID and private key in the
Generaltab of your GitHub App.Store the Github private key next to the
.envfile with the namegithub-app.pem(packages/services/server/github-app.pem) -
Web App: Set the following in
packages/web/app/.env:INTEGRATION_GITHUB_APP_NAME=<your-github-app-name>
Open Hive UI and go to your organization's settings page. Find Integrations section and click on
Connect GitHub. You should be redirected to GitHub where you can grant repository access. After
installing the app, you should be redirected back to Hive.
- Create a project and a target.
- Create a token from that target.
- Setup a GitHub repo with CI/CD actions like this one: https://github.com/n1ru4l/hive-federation-subgraph/.
- Add the token to the repo's secrets as
HIVE_TOKEN. - Add Hive endpoint to the repo's secrets as
HIVE_ENDPOINT(https://hive-<your-name>.loophole.site/graphql). - Make sure your GitHub app is installed on that repo.
- Push a commit to the repo and check if the CI/CD action is triggered.
The docker-compose.dev.yml files includes a mock OIDC server that can be used for testing the OIDC
login/logout flow locally. The server tuns on port 7043.
Please make sure to set the AUTH_ORGANIZATION_OIDC environment variables for the server and
app to "1".
You can use the following values for connecting an integration to an OIDC provider.
# Token Endpoint
http://localhost:7043/connect/token
# User Info Endpoint
http://localhost:7043/connect/userinfo
# Authorization Endpoint
http://localhost:7043/connect/authorize
# Client ID
implicit-mock-client
# Client Secret
client-credentials-mock-client-secret
For login use the following credentials.
# Username
test-user
# Password
password
- Click on Start Hive in the bottom bar of VSCode
- Open the UI (
http://localhost:3000by default) and register any email and password - Sending e-mails is mocked out during local development, so in order to verify the account find
the verification link by visiting the workflow server's
/_historyendpoint -http://localhost:3014/_historyby default.- Searching for
tokenshould help you find the link.
- Searching for