Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
F

Foundry

> 编程语言
Open source

A Markdown-first CMS written in Go with themes, plugins, and an integrated admin UI

188 stars0 likes0 views
WebsiteGitHub

About

A Markdown-first CMS written in Go with themes, plugins, and an integrated admin UI

Foundry

Foundry is a Markdown-first CMS written in Go. It keeps content in files, renders through themes, includes a Quill-powered rich text editor in the admin UI, and extends through both first-class compiled Go plugins and out-of-process RPC plugins.

The project is aimed at teams that want a file-based workflow without giving up CMS-style features such as taxonomies, theme-owned custom fields, feeds, plugin hooks, and an admin surface.

See more of Foundry here: Foundry Screenshots

What Foundry does

  • Stores pages and posts as Markdown with frontmatter
  • Supports language-aware routing and content grouping
  • Builds a normalized site graph in memory
  • Uses themes for layouts, partials, and theme assets
  • Supports first-class compiled Go plugins for deep CMS integration
  • Supports out-of-process RPC plugins for process-isolated extension points
  • Uses plugins for hooks, asset injection, admin pages, and runtime extensions
  • Generates RSS and sitemap output
  • Publishes static output to public/
  • Serves the site locally with live reload during development
  • Tracks document, template, data, and taxonomy dependencies for incremental rebuilds

Is Foundry primarily a static CMS?

No - Foundry is a Markdown-first, file-based CMS that supports two equally first-class runtime shapes:

  • Static site generation via foundry build, which writes the rendered site (and frontend SDK artifacts under public/__foundry/) to the public/ directory. Use this if you want a static deployment behind a CDN or object storage.
  • Live server mode via foundry serve, foundry serve-standalone, or foundry service install, which runs Foundry as a long-running process with the themeable admin UI mounted at /__admin and a live JSON API under /__foundry.

Either model is fully supported. Content is stored the same way in both cases: Markdown files with frontmatter under the content/ directory (pages under content/pages/, posts under content/posts/, media under content/images/, content/videos/, content/audio/, and content/documents/). That means you can move between static and server modes without changing how content is authored or versioned in Git.

If your goal is to manage content and publish a static site, Foundry fits that model well. If you also need a live API surface, an admin UI, or incremental rebuilds during development, those are first-class too.

Headless Mode

Content is exposed as JSON via two options:

1. Live API

/__foundry/api/*
  • Real-time JSON from running server

2. Static JSON

public/__foundry/*.json
  • Generated during build
  • No server required

Quick Start

The fastest way to get the project running locally is via Docker:

bash
sh scripts/docker-init.sh
docker compose up -d --build

The default docker-compose.yml is local-development oriented:

  • it bind-mounts the project source into the container
  • it keeps data/ and public/ on named Docker volumes
  • it reads .env when present
  • scripts/docker-init.sh creates a .env file with random local secrets for local use

For a harder production shape, use docker-compose.prod.yml:

bash
export FOUNDRY_ADMIN_SESSION_SECRET="$(openssl rand -hex 32)"
export FOUNDRY_ADMIN_TOTP_SECRET_KEY="$(openssl rand -base64 32)"
docker compose -f docker-compose.prod.yml up -d --build

The production compose setup:

  • uses explicit required secrets
  • runs with a read-only root filesystem
  • drops Linux capabilities
  • enables no-new-privileges
  • uses a tmpfs for /tmp
  • uses named volumes for content/, themes/, plugins/, data/, and public/

Before using the production overlay in anything real, update content/config/site.docker.prod.yaml so base_url matches your deployed HTTPS origin.

Otherwise, see the Getting Started section for how to install the foundry command, run Foundry locally, or run it in portable standalone mode without Docker.

Foundry will run on http://localhost:8080/ by default, and the admin panel is reachable at http://localhost:8080/__admin. The default login on a new install is admin:admin.

Production note: set admin.session_secret in content/config/site.yaml or FOUNDRY_ADMIN_SESSION_SECRET in the environment. Foundry stores only hashed session tokens at rest, and an explicit session secret strengthens that hashing.

Project layout

…

Architecture

Managed runtime integrations are optional and provider-neutral. See docs/managed-runtime-boundary.md for the configuration and Cloud boundary.

For portable content and media transfers, see docs/content-bundles.md.

Foundry keeps a clean separation between content loading, route assignment, rendering, and runtime orchestration.

The main pipeline is:

config -> content/data load -> site graph -> route assignment
      -> dependency graph -> renderer -> build output or preview server

Two graph types matter:

  • SiteGraph: the in-memory representation of documents, routes, taxonomies, config, and loaded data
  • DependencyGraph: the rebuild graph used to decide which outputs must be regenerated after a change

The dependency graph includes taxonomy archive outputs, so incremental rebuilds can target both document pages and taxonomy pages.

Formatting

Foundry uses:

  • go fmt for Go code
  • prettier for JS, CSS, HTML, and Markdown assets/docs

Install the formatter tooling once:

bash
npm install

Then run:

bash
make fmt
make fmt-web
make fmt-all

Local UI testing

Foundry now includes local-only browser coverage using Playwright for:

  • the shipped default frontend theme
  • the shipped default admin theme

Install the tooling once:

bash
npm install
npx playwright install

Then run:

bash
make test-e2e

Useful variants:

bash
npm run test:e2e
npm run test:e2e:full
npm run test:e2e:headed
npm run test:e2e:ui

Notes:

  • these tests start a real local Foundry server against a disposable temp workspace, so content/, data/, public/, and backup output are isolated from the repo during the run
  • they are intended for local development only right now; there is no GitHub Action for them yet
  • make test-e2e and npm run test:e2e:full run pre/post cleanup so e2e-* documents, media, users, backups, and lifecycle artifacts do not accumulate
  • admin tests default to admin/admin, but you can override credentials with:
    • FOUNDRY_E2E_ADMIN_USER
    • FOUNDRY_E2E_ADMIN_PASS

Official JavaScript SDKs

Foundry now ships two official framework-agnostic JavaScript SDKs under sdk/:

  • sdk/admin
  • sdk/frontend

They exist to give admin frontends, plugin UIs, and JS-powered themes a supported client contract instead of forcing each consumer to hand-roll fetch logic against unstable internal endpoints.

The Admin SDK targets the authenticated admin API under admin.path + /api.

The Frontend SDK targets the public Foundry platform surface under /__foundry, with a live JSON API in preview/server mode and generated static artifacts under public/__foundry/ for built sites.

The shared SDK core handles:

  • request construction
  • normalized JSON/error handling
  • capability discovery helpers
  • common client configuration

The current official browser entrypoints are:

/__foundry/sdk/admin/index.js
/__foundry/sdk/frontend/index.js

Example:

javascript
import { createAdminClient } from '/__foundry/sdk/admin/index.js';
import { createFrontendClient } from '/__foundry/sdk/frontend/index.js';

const admin = createAdminClient({ baseURL: '/__admin' });
const frontend = createFrontendClient({ mode: 'auto' });

Current capability discovery endpoints:

  • admin: /api/capabilities
  • frontend: /__foundry/api/capabilities

Built sites also emit frontend SDK data artifacts under:

public/__foundry/
  capabilities.json
  site.json
  navigation.json
  routes.json
  collections.json
  search.json
  preview.json
  content/.json
  sdk/...

The shipped themes use these SDKs too:

  • the default admin theme imports the Admin SDK from /__foundry/sdk/admin/index.js
  • the default frontend theme boots a small SDK-based runtime from /theme/js/foundry-theme.js

Plugin-defned admin pages and widgets can also target a stable shell contract now. A plugin can declare admin page and widget bundles in plugin.yaml, Foundry exposes those bundles under /extensions//..., and the default admin shell will automatically import them when their page or widget slot is active. Admin pages can also declare nav_group (dashboard, content, manage, or admin) so they land in the right sidebar group. The shell dispatches foundry:admin-extension-page and foundry:admin-extension-widget and exposes window.FoundryAdmin so plugin code can mount against a supported runtime surface instead of private admin internals. The built-in Extensions admin page itself uses a separate route, /a-extensions, so it does not collide with the plugin asset namespace.

Theme and plugin security

Foundry now treats themes and plugins as different security surfaces.

  • Themes are restricted through theme.yaml -> security
  • Plugins declare intended power through plugin.yaml -> permissions

Theme security currently covers:

  • a curated public-safe template context instead of raw config
  • CSP generation for public pages
  • validation of undeclared remote assets in theme HTML, CSS, and JS
  • explicit declaration of outbound frontend request origins

Plugin permissions currently cover declaration and visibility, not true sandboxing. In-process plugins are still trusted Go code today, but Foundry now also has a working out-of-process RPC host for the first migrated hook family (OnContext). Foundry can now:

  • load and validate structured permission declarations
  • surface plugin risk and approval requirements in the admin UI
  • report declared permissions with foundry plugin security
  • run foundry plugin validate --security for explicit security validation
  • statically analyze plugin source for risky imports, hooks, and calls
  • compare detected capabilities against declared permissions
  • require explicit approval for risky or mismatched plugins during CLI and admin install, enable, and update flows
  • record security-oriented plugin approval actions in the audit log
  • execute runtime.mode: rpc plugins out of process when they use the supported RPC protocol and hook family

See the full authoring guides for details:

  • docs/themes/ for theme.yaml -> security
  • docs/plugins/ for plugin.yaml -> permissions
  • docs/plugins/ also includes the full structured permission reference for plugin authors

Plugin runtime metadata now supports a real runtime block. The current RPC host supports the context hook family over a JSON RPC transport, with a sanitized environment and no host-granted filesystem, network, or process capability channels. Broader hook migration and stronger OS-level sandboxing still build on that foundation.

Getting Started

Prerequisites

  • Go 1.22 or newer
  • A working PATH that includes $(go env GOPATH)/bin if you install with go install

Install

Install the CLI:

bash
go install github.com/sphireinc/foundry/cmd/foundry@latest

Verify the install:

bash
foundry version

That prints runtime-aware version metadata, including the current version, commit, build date, install mode, target platform, and executable path.

If you are working from a local checkout instead of a global install, you can run:

bash
go run ./cmd/foundry version

Start a site from the repo layout

Foundry expects a file-based project layout. The quickest way to get running is to start with this shape:

content/
  con

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Gocmscontent-management-systemmarkdownwordpress

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 18, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言