{"id":28766105,"url":"https://github.com/mdn/fred","last_synced_at":"2026-04-01T20:02:11.678Z","repository":{"id":282405243,"uuid":"947853014","full_name":"mdn/fred","owner":"mdn","description":"MDN's frontend since late 2025, built with Web Components, Lit, and SSR for a fast, clean documentation experience. Fred = /fr(ont)e(n)d/.","archived":false,"fork":false,"pushed_at":"2026-02-28T10:27:27.000Z","size":18641,"stargazers_count":82,"open_issues_count":144,"forks_count":32,"subscribers_count":4,"default_branch":"main","last_synced_at":"2026-02-28T15:14:28.699Z","etag":null,"topics":["lit","ssr","web-components"],"latest_commit_sha":null,"homepage":"https://developer.mozilla.org","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mdn.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-03-13T10:54:18.000Z","updated_at":"2026-02-28T10:27:06.000Z","dependencies_parsed_at":"2025-03-14T13:29:29.161Z","dependency_job_id":"e8d43231-8f30-4edf-ab29-a184b96fcfb7","html_url":"https://github.com/mdn/fred","commit_stats":null,"previous_names":["mdn/fred"],"tags_count":34,"template":false,"template_full_name":null,"purl":"pkg:github/mdn/fred","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdn%2Ffred","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdn%2Ffred/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdn%2Ffred/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdn%2Ffred/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mdn","download_url":"https://codeload.github.com/mdn/fred/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdn%2Ffred/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30231640,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-07T19:01:10.287Z","status":"ssl_error","status_checked_at":"2026-03-07T18:59:58.103Z","response_time":53,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["lit","ssr","web-components"],"created_at":"2025-06-17T11:41:03.944Z","updated_at":"2026-04-01T20:02:11.656Z","avatar_url":"https://github.com/mdn.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Fred\n\nMDN's next fr(ont)e(n)d.\n\n## Getting started\n\n1. Copy `.env-dist` to `.env` and update values as needed. The file contains comments for guidance:\n\n```bash\n   cp .env-dist .env\n```\n\n2. Install dependencies `npm install`\n3. Bring up the dev environment with `npm run start`\n\n## Commands\n\n- `npm run start`\n  - runs the rari server and the live-reloading development server together\n  - run with `NODE_ENV=production` to run rari with the preview server, you'll need to have run `npm run build` first\n- `node --env-file=.env --run rari -- serve`\n  - runs the rari server\n  - necessary for `npm run dev` and `npm run preview`\n- `npm run dev`\n  - brings up the live-reloading development server, likely what you want for doing local development\n- `npm run build`\n  - builds the production js/css/asset bundles\n  - must be run at least once for `npm run preview` to work\n- `npm run preview`\n  - runs the preview server: using the production bundles with the rari server: useful for testing our prod rspack config\n- `npm run test`\n  - runs linting and tests with various options, read more in [the testing README](./test/README.md)\n\n## L10n\n\nSee [the l10n README](./l10n/README.md).\n\n### Accessing from non-localhost\n\nIf you want to access fred from a different machine, you'll need to run with certain options:\n\n- `HTTPS=true` to enable HTTPS with a self-signed certificate, allowing Web APIs requiring a secure context to work\n- `ORIGIN_MAIN=your.local.ip.address` to allowlist your address in the playground\n\nSo a full command might look like:\n\n```\nHTTPS=true ORIGIN_MAIN=192.168.0.99 npm run start\n```\n\nThis is useful to test changes on mobile, tablets and other platforms.\n\n## Development principles\n\n### Supported Browsers\n\n_tl;dr_ For visitors to MDN, we support the _Baseline widely available browser set_, with some minor modifications.\n\n#### Browsers\n\nThe [_Baseline widely available browser set_](https://developer.mozilla.org/en-US/docs/Glossary/Baseline/Compatibility) is defined as browsers from the _Core browser set_ whose initial release date is on or before 30 months prior to today's date, plus long-term support releases.\n\nMDN supports these browsers, along with Firefox for iOS and all currently active Firefox ESR versions:\n\n- Apple Safari (iOS, macOS) — released within the last 2½ years\n- Google Chrome (Android, Desktop) — released within the last 2½ years\n- Microsoft Edge (Desktop) — released within the last 2½ years\n- Mozilla Firefox (Android, Desktop, iOS) — released within the last 2½ years\n- Mozilla Firefox ESR — currently supported by Mozilla\n\n#### \"Supported\"\n\nIn this context, _supported_ means that any issues with rendering or functionality are considered bugs and will be addressed as soon as reasonably possible.\n\nFor issues encountered while using unsupported browsers, we decide on a case-by-case assessment of whether the issue will be addressed; however, these issues may have lower priority. Issues with screen readers and other accessibility aids are likely to carry higher levels of importance.\n\nWe make our best efforts to design MDN to degrade gracefully; however, there are no guarantees of any level of functionality outside the supported browser set.\n\n### Environment variables\n\nSee [the environment variables README](./components/env/README.md).\n\n### Inline JS\n\nWe need to run some JS as soon as possible at page load, to avoid layout shifts and flashes.\nWe place this JS in `entry.inline.js`, and it's inlined on page load.\nRspack also generates the necessary CSP hash when doing a prod build with `npm run build`.\n\nIf this code is component-specific, it can be [imported with `?source\u0026csp=true`](#custom-imports) and used to set the value of `static inlineScript` in a Server Component.\nRemember to add an additional entry to the CSP hashes in yari when doing so.\n\n### Custom Imports\n\nWe support a range of non-standard imports in our JavaScript. This includes:\n\n#### `?source`\n\nImports the raw source of the file as a string.\n\n```js\nimport text from \"./some-file.txt?source\";\n```\n\n#### `\u0026csp=true`\n\nLogs a CSP hash for the source of the file during the production build.\nMost commonly used alongside `?source` to import the source of a file for inlining in a component, which needs to be allowlisted in our CSP:\n\n```js\nimport inlineScript from \"./inline.js?source\u0026csp=true\";\n```\n\n### Layout\n\nSee [the layout README](./components/layout/README.md).\n\n### Media queries\n\nSee [the media queries README](./components/media/README.md).\n\n### Sandbox\n\nWe have a basic sandbox for testing and styling components in isolation at http://localhost:3000/sandbox\n\nTo add a component to the sandbox, add a `sandbox.js` file to the component, which exports a class named like `MyComponentSandbox` which extends the `SandboxComponent` exported from `components/sandbox/class.js`.\n\n### Components and Elements\n\n- Components should live in the `components/` folder, with reserved names which cause certain behavior, explained further below:\n  - `component-name/`\n    - `global.css` - (reserved): automatically added to global styles\n    - `element.js` - (reserved): custom element, automatically imported client side, always imported server side\n    - `element.css` - (recommended): styles for custom element's shadow dom\n    - `server.js` - (reserved): server component, will automatically load the adjacent `server.css` file when used\n    - `server.css` - (reserved): automatically added to page styles when its server component is used in that page\n- `global.css`: components which have CSS which should be loaded on _all_ pages should expose that through a `global.css` file:\n  - This should be used sparingly, use it for things needed in almost all components, like colors, fonts, etc.\n  - Or, when creating a custom element, use it to set the \"browser default\" styles on that custom element: usually as simple as just `mdn-component-name { display: block; }` or similar\n- `element.js`: custom elements should be defined in `components/component-name/element.js`\n  - The class should be exported, and named `MDNComponentName`\n    - Acronyms should be kept all caps, to match the naming of `HTMLElement` class names, and added to `ACRONYMS` in `build/plugins/generate-element-map.js` to allow the correct types to be generated\n  - The element should be registered with a name of `mdn-component-name`\n  - If all this is done:\n    - The element will be automatically loaded client side if it's present in the DOM at page load\n      - Elements inserted client side (i.e. in a hook, or another custom element) won't be automatically loaded, and the hook should handle loading them: probably with an async `import()`\n    - The element will be automatically loaded server side for SSR\n    - The element will automatically be added to `types/element-map.d.ts` to provide proper types in e.g. `querySelector(\"mdn-component-name\")`\n- `server.js`: server components should be defined in `components/component-name/server.js`\n  - The class should extend `ServerComponent` from `components/server/index.js`, and be named `ComponentName`\n- `server.css`: server component styles should be placed in `components/component-name/server.css`\n  - These will be automatically loaded server side when the adjacent `ServerComponent` is used\n    - Therefore, these styles should be scoped to the component, usually with a wrapping class\n\n### Typing\n\n- We use [TypeScript in JSDoc annotations](https://www.typescriptlang.org/docs/handbook/jsdoc-supported-types.html) for typing, so we can write and directly execute JavaScript (with no transpilation step)\n- We occasionally use TypeScript files directly for writing types/interface which are too complex to easily write in JSDoc\n- Eventually we'll have a fully typed codebase, with no errors: while we're in active development we can ignore errors in the interest of development speed/pragmatism:\n  - If we do so, we should use `// @ts-expect-error` so we get an error when we fix the error and don't leave unnecessary `// @ts-ignore` comments lying around. While we're in active development these can lack a comment, but eventually we'll require an explanatory comment on each.\n\n### Hydration errors\n\nIf our server side rendered custom elements are different to the initial state of our custom elements when rendered client side, Lit will error out during hydration, stopping the execution of our client side JS.\n\nTo avoid this, don't compute things that are server/client dependent in `connectedCallback` (or run functions which do this). Instead you must run these in `firstUpdated` (despite the warning lit will raise in development about the element scheduling an update after an update completed).\n\nThis issue is tracked upstream: https://github.com/lit/lit/issues/1434\n\n### Simplified HTML\n\n`entry.ssr.js` exports a top-level `renderSimplified` function: the purpose of this is to render a very basic HTML page for a particular path, which is useful for embedding MDN content as templated HTML in other contexts.\n\nAny server component can define a `renderSimplified` method to define the simplified form of that component. When in the top-level `renderSimplified` context, any calls of `ServerComponent.render()` will automatically call the `renderSimplified` method of that component, falling back to the `render` method. This is so we can nest components with a `renderSimplified` method (\"simplified components\") within ones without.\n\nThere shouldn't be standalone simplified components: the nesting of components should be defined by the requirements of the `render` method. `renderSimplified` should only be added to a component which already exists with a `render` method to give a simplified view of it. This is especially important as, in the future, we may need to add options of what is/isn't rendered within `renderSimplified` for use in different contexts (one context may require a sidebar, another may not, for instance).\n\nYou can preview the rendering locally by setting `FRED_SIMPLE_HTML`:\n\n```\nFRED_SIMPLE_HTML=true npm run start\n```\n\nThen visit a documentation path directly, e.g. http://localhost:3000/en-US/docs/Web/\n\nIf you're loading a path which isn't rendering anything (like the homepage), check if it's defined in `renderSimplified` in `entry.ssr.js`: we \"opt-in\" routes as we need them.\n\n### Testing\n\nSee [the testing README](./test/README.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmdn%2Ffred","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmdn%2Ffred","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmdn%2Ffred/lists"}