---
title: "BYOK Host Project Report"
description: "BYOK Host Project Report This is the short version of the BYOK Host project. If you want the detailed narrative, read the technical deep dive. If you want the current state and the important boundarie…"
doc_version: 1
last_updated: 2026-11-15
canonical_url: "http://parc.yolo.scapegoat.dev/note/projects/2026/04/17/proj-byok-host-project-report"
---

# BYOK Host Project Report

BYOK Host Project Report This is the short version of the BYOK Host project. If you want the detailed narrative, read the technical deep dive. If you want the current state and the important boundarie…

## Tags

- `project`
- `byok`
- `keycloak`
- `sqlite`
- `oauth`
- `oidc`
- `broker`
- `report`

## Content

# BYOK Host Project Report

This is the short version of the BYOK Host project. If you want the detailed narrative, read the technical deep dive. If you want the current state and the important boundaries, read this note.

## What it is

BYOK Host is a local broker app for browser-facing BYOK inference. It keeps the broker as the place where consent, grants, provider-key custody, and broker-issued OAuth artifacts live.

Keycloak is only the broker login system.
SQLite is the first persistent broker storage backend.
The client site still delegates through the broker with Authorization Code + PKCE.

## Current state

Working now:
- Keycloak-backed broker login
- signed broker session cookie
- `return_to` routing after login
- broker-owned consent and grant flow
- persistent users, connections, grants, auth codes, access tokens, and audit events in SQLite
- in-memory and SQLite storage backends
- browser-validated end-to-end flow
- SQLite persistence survives broker restart

Still intentionally demo-level:
- fake upstream provider
- local secret storage in SQLite
- ticket-local workspace layout

## Architecture in one line

**Keycloak authenticates the user; the broker decides what the user’s stored provider connection may be used for.**

That separation is the whole point of the project.

## Important files

- `internal/auth/keycloak/oidc.go`
- `internal/app/broker.go`
- `internal/storage/interfaces.go`
- `internal/storage/sqlite/store.go`
- `deploy/docker-compose.yaml`
- `deploy/keycloak/realm-byok.json`
- `scripts/run_tmux_keycloak_demo.sh`

## Main limitations / next steps

- replace the fake provider with a real upstream integration
- harden secret handling
- decide whether the ticket-local layout should stay or be extracted
- keep the broker boundary intact as the project grows

## See also

- [[ARTICLE - Brokered BYOK with Keycloak and SQLite - A Technical Deep Dive]]
- [[PROJ - BYOK Host - Keycloak and SQLite Broker Intern Research Guide]]

## Related KB entries

These knowledge base entries provide orientation for the concepts this project depends on:

- [[Tribal/keycloak-oauth-in-go-services]] — the local JWT validation pattern, PKCE from CLI, and audience checking that this broker implements
- [[Tribal/application-native-authorization]] — broker-not-proxy architecture: Keycloak authenticates, broker decides what the connection may be used for
- [[Tribal/sqlite-as-application-database]] — WAL mode, embedded migrations, and the CGo-free modernc driver that this broker uses for persistence
- [[On-Ramp/oauth-2-oidc-flows]] — the Authorization Code + PKCE flow and Client Credentials flow that this project uses
- [[Fundamentals/access-control-models]] — the authn/authz/delegation separation that the broker-not-proxy architecture enforces

**Tribal candidates** (our-specific patterns not yet at 3-project threshold):
- Broker-not-proxy architecture (1/3) — broker makes authorization decisions, issues own tokens, stores grants
- Signed broker session cookies (1/3) — HMAC-signed cookies to avoid server-side session state
- SQLite persistence surviving broker restart (1/3) — WAL mode, schema migrations in Go, connection pooling
- Authorization Code + PKCE from Go CLI (2/3) — open browser → callback → exchange code; implemented in BYOK Host and Wish Git

## Wiki Links

- ARTICLE - Brokered BYOK with Keycloak and SQLite - A Technical Deep Dive
- PROJ - BYOK Host - Keycloak and SQLite Broker Intern Research Guide
- Tribal/keycloak-oauth-in-go-services
- Tribal/application-native-authorization
- Tribal/sqlite-as-application-database
- On-Ramp/oauth-2-oidc-flows
- Fundamentals/access-control-models

## Backlinks

- [research/kb/tribal/keycloak-oauth-in-go-services](http://parc.yolo.scapegoat.dev/note/research/kb/tribal/keycloak-oauth-in-go-services)
- [research/kb/tribal/app-config-vs-command-config-separation](http://parc.yolo.scapegoat.dev/note/research/kb/tribal/app-config-vs-command-config-separation)
- [research/kb/on-ramp/oauth-2-oidc-flows](http://parc.yolo.scapegoat.dev/note/research/kb/on-ramp/oauth-2-oidc-flows)
- [research/kb/tribal/application-native-authorization](http://parc.yolo.scapegoat.dev/note/research/kb/tribal/application-native-authorization)
- [research/kb/tribal/host-mediated-secret-delivery](http://parc.yolo.scapegoat.dev/note/research/kb/tribal/host-mediated-secret-delivery)
- [research/kb/fundamentals/access-control-models](http://parc.yolo.scapegoat.dev/note/research/kb/fundamentals/access-control-models)
- [research/kb/tribal/sqlite-as-application-database](http://parc.yolo.scapegoat.dev/note/research/kb/tribal/sqlite-as-application-database)

## Sitemap

- [Home](http://parc.yolo.scapegoat.dev/)
- [Home markdown mirror](http://parc.yolo.scapegoat.dev/index.md)
- [Markdown sitemap](http://parc.yolo.scapegoat.dev/sitemap.md)
