Skip to content

feat: add frontend-base support#285

Draft
arbrandes wants to merge 16 commits intomainfrom
frontend-base
Draft

feat: add frontend-base support#285
arbrandes wants to merge 16 commits intomainfrom
frontend-base

Conversation

@arbrandes
Copy link
Copy Markdown
Collaborator

@arbrandes arbrandes commented Apr 3, 2026

Description

This PR adds support for @openedx/frontend-base, which takes a different approach to frontend architecture than traditional MFEs. Rather than independent webpack apps each with their own server, frontend-base uses an npm workspaces monorepo (via Turbo) where frontend apps are bundled together into a single site. The default site is defined in a new site/ template that ships with this plugin.

The build infrastructure mirrors the MFE pattern closely: multi-stage Dockerfile with -git, -src, -common, -dev, and -prod stages; image build/pull/push registration; and tutor mounts add mfe-site support for both build-time (--build-context) and runtime (docker-compose volume) bind mounts.

In dev mode, the mounted site gets its own mfe-site docker-compose service running npm run dev:packages, which delegates to Turbo to watch workspace packages and hot-reload the site. When unmounted, it falls back to the mfe Caddy service serving pre-built assets, exactly as unmounted MFEs do.

Individual frontend apps that are enabled and mounted also get dev mounts into the same site service.

Frontend apps (FRONTEND_APPS) are introduced as a new hook type alongside the existing MFE_APPS, with corresponding template helpers and LMS settings patches.

Parent issue: openedx/frontend-base#146

TODO

LLM usage notice

Built with assistance from Claude.

Introduces a new build path for @openedx/frontend-base apps using npm
workspaces. A default "frontend-site" is added alongside the existing
MFE build, with its own multi-stage Dockerfile, Caddy routing, and
site config files for both dev and production environments.

New FRONTEND_SITES and FRONTEND_APPS filter hooks allow plugins to
register additional sites and apps. The default site includes authn
and learner-dashboard, and supports slot injection via FRONTEND_SLOTS.
Wire up dev mode for frontend sites, mirroring the existing MFE
pattern: site-*-dev and site-*-prod Dockerfile stages, docker-compose
dev services for mounted sites (with fallback to the mfe Caddy service
for unmounted ones), image build/pull/push registration, and mount
support via `tutor mounts add frontend-site-<name>`. Makes the dev
server port configurable via the PORT env var.

Also simplifies and cleans up the frontend-base implementation.

Co-Authored-By: Claude <noreply@anthropic.com>
arbrandes and others added 14 commits April 4, 2026 10:25
Remove the FRONTEND_SITES filter and all multi-site abstractions. There
is now exactly one site, with its port, home role, repository, and version
exposed as MFE_SITE_* config variables.

Co-Authored-By: Claude <noreply@anthropic.com>
Route frontend app mounts to the mfe-site service workspace instead of
the MFE path. Each frontend app gets a -src Dockerfile stage (empty for
apps without a repository) as a build-time substitution point, replacing
git clone with COPY --from. Frontend app takes precedence over MFE when
both are registered for the same app name.

Co-Authored-By: Claude <noreply@anthropic.com>
Use is_frontend_app_enabled() instead of get_frontend_app() so that
disabled frontend apps don't override LMS URL settings.

Co-Authored-By: Claude <noreply@anthropic.com>
Without it, plugin slots don't work in dev mode.

Co-Authored-By: Claude <noreply@anthropic.com>
Let git use the default branch when unspecified.

Co-Authored-By: Claude <noreply@anthropic.com>
Production runs behind a reverse proxy, so URLs should not include
dev ports.

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Restructure app -repo/-src stages to always create both (fixing
mount support for repo-less apps), DRY out site COPY paths via
WORKDIR, serve site assets from / instead of /site, and add
index.html fallback to the site catch-all handler.

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Rename the image from mfe-site-dev to site-dev and the
docker-compose service from mfe-site to site. Extract the
mount directory name into a SITE_MOUNT_NAME constant.

Co-Authored-By: Claude <noreply@anthropic.com>
The previous node 24.11.0 (npm 11.6.1) was misresolving
pre-release semver ranges for frontend-base workspace
dependencies, picking alpha.4 instead of alpha.7.

Co-Authored-By: Claude <noreply@anthropic.com>
Replace iter_paths with iter_legacy_paths, which yields only MFE
names not superseded by an enabled frontend app. Frontend app
routes are now handled by the site catch-all. Also fix TS errors
in site utils.ts for possibly undefined config fields.

Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Pending Triage

Development

Successfully merging this pull request may close these issues.

3 participants