This repository is a template for Open edX frontend applications built on frontend-base: a library that plugs into the Open edX frontend shell, rather than a standalone micro-frontend bundled with its own webpack build. It is flagged as a Template Repository, meaning it can be used as a basis for new GitHub repositories by clicking the green "Use this template" button above. The rest of this document describes how to work with your new frontend application after you've created a new repository from the template.
The legacy standalone MFE template (pre-frontend-base) lives on the
legacy-mfe branch.
After copying the template repository, you'll want to do a find-and-replace
to replace all instances of frontend-template-application with the name
of your new repository. You should also pick a new appId and role name
in src/constants.ts, and a friendly title in public/index.html.
Tutor is currently recommended as the development environment for your new app. You can refer to the relevant tutor-mfe documentation to get started using it.
In the following steps, replace "[PLACEHOLDER]" with the name of the repo you created when copying this template above.
Clone your new repo:
git clone https://github.com/openedx/frontend-app-[PLACEHOLDER].gitUse the version of Node specified in the
.nvmrcfile.Using other major versions of Node may work, but is unsupported. This repository includes an
.nvmrcfile to help set the correct Node version via nvm.Install npm dependencies:
cd frontend-app-[PLACEHOLDER] && npm install(Optional) Update the port and public path used for local development by editing the
devscript inpackage.json. The default isPORT=8080 PUBLIC_PATH=/template.Start the dev server:
npm run dev
The dev server will be available at http://apps.local.openedx.io:8080 (or whatever port you configured), under the public path you configured.
To develop your app and a local checkout of frontend-base in tandem, use
the built-in npm workspace support:
mkdir -p packages/frontend-base
sudo mount --bind /path/to/frontend-base packages/frontend-base
npm install
npm run dev:packagesBind mounts are used instead of symlinks because Node resolves symlinks to
their real paths, which breaks hoisted dependency resolution. When you are
done, unmount with sudo umount packages/frontend-base.
Move README-template-frontend-app.rst to your project's README.rst
file. Please fill out all the sections - this helps other developers
understand your app, how to install it, and how to use it.
A repository created from a template inherits its files, but not its GitHub settings. Once your new repository exists, set up the following by hand:
- Branch protection on
main, requiring theDefault CIandLockfile Version checkjobs. Leave room for a maintainer to pushstablenon-fast-forward, which is how a major graduates. - Secrets.
CODECOV_TOKENfor coverage uploads, and publishing credentials forsemantic-release. Both.releasercand theRelease CIworkflow ship ready to use; the workflow publishes from any repository other than this template. - ``catalog-info.yaml``, so the component appears in Backstage with the right name, description, owner and links. See OEP-55.
- A ``stable`` branch, cut from
mainwhen the app is first ready for production use. Until thenmainpublishes alphas and there is nothing on thelatestdist-tag. The branch layout is described in your new repository's README, and settled in OEP-10 ADR 0002.
This section concerns development of frontend-template-application
itself, not the templated copy.
One of the goals of this repository is for it to function correctly as a
frontend-base application (npm install && npm run dev) even if no
modifications are made. This ensures that developers get a practical
working example, not just a theoretical one.
This also means, of course, that any committed code should be tested and subject to both CI and branch protection rules.
The same goes for the release setup: .releaserc and the Release CI
workflow are here so that copies get a working, OEP-10 ADR 0002-conformant
one without editing anything. This repository is not itself published, so the
workflow's job is gated on the repository name and never runs here. Keep both
in sync with the ADR rather than with whatever any one app repository happens
to be doing.
The layout follows the standard frontend-base app layout:
src/app.ts- the app configuration imported bysite.config.*.tsxsrc/constants.ts- the app'sappIdand role identifierssrc/index.ts- the package's public exports (this is a library)src/routes.tsx- the app's react-router routessrc/Main.tsx- the root component for the app's routessrc/slots.tsx- the slot operations the app applies to the shellsrc/slots/- the slots this app offers to consumerssrc/style.scss- app-scoped runtime styles
For more, see the frontend-base migration how-to.
Library build
npm run build compiles the library into dist/ via tsc and
tsc-alias. This is what gets published and consumed by sites.
CI build
npm run build:ci runs openedx build against site.config.ci.tsx
so webpack traverses the full app graph. This catches issues (like broken
lazy-loaded imports) that tsc and Jest would not surface.
Please refer to the frontend-base i18n howto for documentation on internationalization.
If you're having trouble, we have discussion forums at https://discuss.openedx.org where you can connect with others in the community.
Our real-time conversations are on Slack. You can request a Slack invitation, then join our community Slack workspace. Because this is a frontend repository, the best place to discuss it would be in the #wg-frontend channel.
For anything non-trivial, the best path is to open an issue in this repository with as many details about the issue you are facing as you can provide.
https://github.com/openedx/frontend-template-application/issues
For more information about these options, see the Getting Help page.
The code in this repository is licensed under the AGPLv3 unless otherwise noted.
Please see LICENSE for details.
Contributions are very welcome. Please read How To Contribute for details.
This project is currently accepting all types of contributions, bug fixes, security fixes, maintenance work, or new features. However, please make sure to have a discussion about your new feature idea with the maintainers prior to beginning development to maximize the chances of your change being accepted. You can start a conversation by creating a new issue on this repo summarizing your idea.
All community members are expected to follow the Open edX Code of Conduct.
The assigned maintainers for this component and other project details may
be found in Backstage. Backstage pulls this data from the
catalog-info.yaml file in this repo.
Please do not report security issues in public, and email security@openedx.org instead.