Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

P2Enjoy/OpenFoundry

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

1,003 Commits

Repository files navigation

OpenFoundry

OpenFoundry is an open-source operational data platform β€” a Go monorepo of microservices plus a React frontend, organized around the same capability model as Palantir Foundry's documentation (datasets, ontology, applications, AI/ML, governance, observability).

Working with this codebase as an AI agent? Start at CLAUDE.md. It's the canonical onboarding for agents (commands, conventions, security-critical zones, what NOT to read) and is kept tighter than this README on purpose.

Repository layout

openfoundry/
β”œβ”€β”€ apps/web/ React 19 + Vite + TypeScript frontend
β”œβ”€β”€ services/ 41 Go microservices (one binary per dir, copy services/template/)
β”œβ”€β”€ libs/ 32 shared Go packages (auth, observability, kernels, ...)
β”œβ”€β”€ proto/ Protobuf source of truth (Go generated to libs/proto-gen/)
β”œβ”€β”€ sdks/ Generated SDKs (TS/Python/Java)
β”œβ”€β”€ infra/ Helm, ArgoCD, Terraform, runbooks
β”œβ”€β”€ docs/ VitePress capability-oriented docs site
β”œβ”€β”€ docs/archive/ Historical migration logs (do not load by default)
β”œβ”€β”€ tools/ CLIs (of-cli, route-audit, lint helpers)
β”œβ”€β”€ go.mod Single module for the whole monorepo
β”œβ”€β”€ Makefile Canonical task runner
└── .golangci.yml Lint config (schema v2)

Per-service shape (uniform β€” copy services/template/):

services/<svc>/
 cmd/<svc>/main.go entrypoint
 internal/server/ chi router (/healthz, /metrics, /api)
 internal/handlers/ HTTP handlers
 internal/domain/ pure logic
 internal/repo/ data access (sqlc-generated when relevant)
 internal/repo/migrations/ goose-style SQL migrations
 internal/models/ wire types
 internal/config/ koanf-backed config

Single-module decision

The repository is intentionally a single Go module (go.mod at the root) rather than a go.work multi-module setup:

  • Mirrors the way Kubernetes, Grafana, and CockroachDB monorepos are organised.
  • Avoids version drift between libs/ and services/.
  • Faster builds (one module cache, one resolution graph).

Splitting individual services into their own modules is reversible.

Day-to-day commands

Run from the repo root. The Makefile is canonical; a justfile is provided as a thin shim over make for muscle memory.

make tools # one-off: install buf, golangci-lint, sqlc, gofumpt to ./bin
make ci # tidy + vet + lint + contract drift checks + test
make test # fast unit tests (-race + coverage, no Docker)
make test-integration # tests behind //go:build integration (needs Docker)
make gen # regen proto Go + sqlc + OpenAPI + SDKs
make contracts-check # verify OpenAPI + TypeScript/Python/Java SDK drift
make build # compile every package
make build-services # one binary per service into ./bin/
make lint # golangci-lint
make fmt # gofumpt + gci

Frontend (apps/web/):

pnpm --filter @open-foundry/web dev # vite dev server
pnpm --filter @open-foundry/web check # tsc -b --noEmit
pnpm --filter @open-foundry/web test # vitest

Conventions

  • Errors: errors.Is-style sentinels at package scope (ErrNotFound, ErrPreconditionFailed, ...); HTTP layer maps them.
  • Wire types: generic envelopes models.Page[T] and models.ListResponse[T]. Cursor pagination uses next_cursor.
  • Auth: every protected route goes through libs/auth-middleware. Read claims from r.Context() via the lib helpers; never parse JWT in handlers.
  • Observability: libs/observability for slog + OTel + Prometheus. Each service exposes /metrics; do not re-register globals.
  • Testing: unit tests next to source; anything needing Postgres/Cassandra/Kafka uses the integration build tag and the helpers in libs/testing/ (testcontainers).
  • Migrations: once shipped, immutable β€” add a new file rather than editing.
  • DI: state is held on a struct (*Handlers, *AppState); avoid package-level globals.

Wire-compatibility invariants

These contracts are pinned by golden tests in libs/core-models/**/*_test.go and must not drift:

  • /healthz payload shape (status, service, version, timestamp).
  • JWT claims field names and JSON tags.
  • Dataset RID format ri.foundry.main.dataset.<uuid-v7>.
  • Transaction state and type tokens (open|committed|aborted, snapshot|append|update|delete).
  • Marking source discriminator ({"kind": "direct"} / {"kind": "inherited_from_upstream", ...}).
  • Media reference camelCase keys (mediaSetRid, mediaItemRid, branch, schema).
  • Schema field type discriminator ({"type": "DECIMAL", "precision": ..., "scale": ...}).

Documentation

  • CLAUDE.md β€” agent-facing onboarding (concise).
  • ARCHITECTURE.md β€” high-level architecture overview.
  • docs/ β€” capability-oriented technical documentation (VitePress); start at docs/index.md.
  • docs/architecture/adr/ β€” numbered, dated architectural decisions with supersession tracking.
  • docs/archive/ β€” historical migration logs and superseded design docs. Do not load these by default; they exist for audit only.
  • Per-module CLAUDE.md files inside large libs and services (e.g. libs/ontology-kernel/CLAUDE.md).

Contributing

See CONTRIBUTING.md for the PR process, RFC requirements, and DCO policy. Security reports follow SECURITY.md.

License

OpenFoundry is licensed under AGPL-3.0-only (see LICENSE).

About

🏭 The open-source Palantir Foundry alternative. Connect any data source, build ontologies, create pipelines, visualize with dashboards, and make AI-powered decisions. Self-hosted. Built with Rust + Svelte.

Resources

License

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

Contributors

Languages

  • Go 59.8%
  • TypeScript 34.2%
  • Python 2.5%
  • Dockerfile 1.0%
  • CSS 0.6%
  • Shell 0.6%
  • Other 1.3%

AltStyle γ«γ‚ˆγ£γ¦ε€‰ζ›γ•γ‚ŒγŸγƒšγƒΌγ‚Έ (->γ‚ͺγƒͺγ‚ΈγƒŠγƒ«) /