Skip to main content

Set up the local Graph lab

This guide starts the separate Graph experiment dashboard on http://localhost:5090. Use a trusted development machine and designated mailbox. Dashboard authentication is disabled.

Prerequisites​

Prepare Node.js, pnpm, OpenSSL, and Graph application credentials and consent. The test workflow also uses Bun. Webhooks need a public HTTPS callback because Microsoft cannot reach a private localhost URL.

The lab has its own configuration and callback paths. Production MailGen settings do not automatically configure it.

Configure the environment​

src/env.js defines the required contract. .env.example is not a complete list. Supply these values through the lab's local configuration:

VariableFormat and purposeRequired/default
DATABASE_URLSQLite URL, for example file:./db.sqliteRequired
NODE_ENVdevelopment, test, productionDefaults to development
TENANT_IDEntra tenant identityRequired, nonempty
CLIENT_IDApplication client identityRequired, nonempty
CLIENT_SECRETApp-only credentialRequired, confidential
GRAPH_WEBHOOK_CLIENT_STATEStable random validation secretRequired
GRAPH_WEBHOOK_URLPublic HTTPS callback, for example https://<your-public-host>/graphWebhookRequired URL
GRAPH_WEBHOOK_ENCRYPTION_CERTIFICATE_PATHPublic certificate file or supported directoryRequired
GRAPH_WEBHOOK_ENCRYPTION_PRIVATE_KEY_PATHMatching private-key file or supported directoryRequired, confidential
GRAPH_WEBHOOK_ENCRYPTION_CERTIFICATE_IDCertificate identifier or supported file/directory referenceRequired, 1–128 characters in environment validation
DELTA_LINK_ENCRYPTION_KEYStable Base64 encoding of 32 random bytesRequired for stored continuation links

The certificate helpers resolve configured files/directories. Preserve the delta key with the database. Replacing it can make saved links unreadable. Generate a new key only for a new prepared configuration:

openssl rand -base64 32

Install and start​

From the motherrepo root:

cd Architecture/GraphSyncExperimenter/graph-call-dashboard
pnpm install
pnpm cert:generate
pnpm db:push
pnpm dev

db:push changes the configured SQLite schema. Check that it targets the disposable lab database before running it. Open http://localhost:5090 after startup.

Certificate generation creates a self-signed certificate, private key, and certificate ID. It resolves paths from configuration and preserves an existing complete set unless --force is explicit. Do not replace keys used by active subscriptions without planning the matching subscription update.

Script reference​

CommandAction
pnpm devNext.js development server with --turbo --port 5090
pnpm cert:generateGenerate certificate/key/ID
pnpm db:pushApply Prisma schema to the configured database
pnpm db:migrateDeploy migrations
pnpm db:studioOpen database inspection UI
pnpm testRun the repository's database-prepared test workflow
pnpm checkESLint and TypeScript checks

Check the result​

  1. Open Diagnostics and inspect Graph configuration and certificate status.
  2. List users/folders for the designated mailbox.
  3. Open the delta explorer and execute a read, or create a subscription for the configured callback.
  4. Inspect the stored response or webhook arrival.

Missing configuration fails validation before normal startup. Invalid certificate paths prevent rich-content decryption. A broken public callback can prevent subscription validation or later arrivals. An invalid database URL prevents database access. Use troubleshooting for these cases.