Skip to content

Self-host lookaside CDN images under /public#3973

Open
imdreamrunner wants to merge 1 commit into
facebook:mainfrom
imdreamrunner:feat/self-host-lookaside-images
Open

Self-host lookaside CDN images under /public#3973
imdreamrunner wants to merge 1 commit into
facebook:mainfrom
imdreamrunner:feat/self-host-lookaside-images

Conversation

@imdreamrunner

@imdreamrunner imdreamrunner commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Summary

Astryx's demo imagery was split across two locations with different rules:

  • The docsite/CLI-template photos were streamed from a Meta-internal CDN (lookaside.facebook.com/assets/astryx/*) — invisible to external contributors, and impossible to reach without Meta network access.
  • 37 images were already self-hosted under apps/docsite/public/ — the docsite's own landing/marketing art and foundations diagrams, e.g. the 7 feature-*.png illustrations, 5 Foundations*.png diagrams, 6 theme-*-preview.png tiles, 4 discover-card-*.png, and the 6 neutral/preview-*.png product shots (plus hero-bg.png, favicon.svg, blog covers).

That meant an outside contributor couldn't see which images exist, couldn't add a new one, and couldn't run the site with real imagery. This PR fixes that by giving every demo image one home:

📁 Single source of truth: apps/docsite/public/images/

All demo imagery now lives in one committed directory. To use an image, browse the folder and reference it by path. To add one, drop the file in and reference it the same way. No CDN, no Meta network, no hidden asset set.

📄 Asset mapping (every image → original Asset Manager source + 2x asset ids): https://gist.github.com/imdreamrunner/1574db95a724d793e703036ee625e665

What changed

1. One self-hosted location for all images

  • Downloaded the full image set (previously on the internal CDN) and committed 122 images + 1 video (Nature-1.mp4) under apps/docsite/public/images/ — organized as template-assets/ (shared template images), per-theme folders (matcha/ butter/ stone/ gothic/ y2k/), avatars/, theme *-picker.png banners, and the brand Astryx-Banner.png.
  • All source references repointed to /images/... root-relative paths (docsite theme showcase + hero, 38 CLI template files, Lightbox.doc.mjs).
  • Everything is under /images/ (not the public root) so theme-name folders can't shadow Next.js app routes.

2. Retina variants ready for later

  • Committed 47 @2x variants (45 unique assets) alongside their 1x siblings for every image whose asset set provides a density=2 source (theme product photos, DATA avatars, theme-picker banners). Each @2x is exactly 2× its 1x sibling. Not referenced yet — ready for a future srcset/next/image pass without re-fetching.

3. Contributor-friendly + scaffold behavior preserved

  • .github/instructions/templates.instructions.md now explains the workflow: browse public/images/template-assets/ to find an image, drop a file there to add one, reference by /images/template-assets/<name>.png.
  • stripTemplateAssetRefs (the CLI scaffold step) still swaps these paths for a self-contained inline placeholder, so a generated project renders with zero setup / zero dependency. Sentinel + regex updated to /images/template-assets/ (excludes placeholder.svg); test suite 10/10.
  • Removed the CDN/NEUTRAL_CDN/PICKER_CDN base-path variables in favor of literal /images/... paths.

4. Guardrail

  • check-demo-media.mjs: image-backed Thumbnail examples must inline a same-origin, samplable data: URI (required by useImageMode's CORS pixel-sampling).

Result: zero lookaside.facebook.com references remain except the README banner (READMEs render on GitHub and need an absolute URL — will switch to https://astryx.atmeta.com/images/Astryx-Banner.png after merge) and a mocked, never-fetched URL in useImageMode.test.ts.

Verification

  • stripTemplateAssetRefs tests 10/10; full docsite suite 238/238; core useImageMode 5/5.
  • pnpm check:repo (sync, package-boundaries, changesets, demo-media, executable-bits): all pass (pre-commit).
  • Docsite (next dev): all /images/* assets 200, old paths 404.
  • Sandbox (dev:sandbox): mirror lands at public/images/template-assets/; template previews render with <img src="/images/template-assets/...">.
  • Storybook unaffected.

@vercel

vercel Bot commented Jul 15, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
astryx Ready Ready Preview, Comment Jul 15, 2026 6:14pm

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Jul 15, 2026
@github-actions github-actions Bot added the needs:design-review Affects visuals — Design should review label Jul 15, 2026
@github-actions

github-actions Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

PR Analysis Report

No new or modified components detected.

Bundle Size Summary

Package Size (ESM) Size (CJS) Gzipped
@astryxdesign/core N/A 4.6KB 0B

Accessibility Audit

Status: No accessibility violations detected.


Generated by PR Enrichment workflow | View full report

Astryx's demo imagery was split across two locations with different rules:
docsite/CLI-template photos streamed from a Meta-internal CDN
(lookaside.facebook.com/assets/astryx/*), while a few were already self-hosted
under apps/docsite/public/. External contributors couldn't see which images
exist, add new ones, or run the site with real imagery.

This gives every demo image one home: apps/docsite/public/images/.

- Downloaded the full set from the astryx Asset Manager set and committed 122
  images + 1 video (Nature-1.mp4) under apps/docsite/public/images/, organized
  as template-assets/, per-theme folders (matcha/butter/stone/gothic/y2k),
  avatars/, theme *-picker.png banners, and Astryx-Banner.png.
- Repointed all source references to /images/... root-relative paths (docsite
  theme showcase + hero, 38 CLI template files, Lightbox.doc.mjs).
- Committed 47 @2x retina variants (45 unique assets) alongside their 1x
  siblings for every image whose asset set provides a density=2 source; not
  referenced yet, ready for a future srcset/next-image pass.
- stripTemplateAssetRefs sentinel + regex now match /images/template-assets/
  (excl. placeholder.svg); still swaps to an inline placeholder at scaffold time
  so generated projects have zero dependency. Test suite updated (10/10).
- check-demo-media: forbid any remote http(s) src in Thumbnail examples.
- templates.instructions.md explains the single-location workflow.
- Inlined and removed CDN/NEUTRAL_CDN/PICKER_CDN base-path variables in favor
  of literal /images/... paths.
- Fixed the Lightbox playground test for the self-hosted path.

Everything under /images/ (not the public root) so theme-name folders can't
shadow Next.js app routes. Zero lookaside references remain except the README
banner (GitHub renders READMEs and needs an absolute URL; will switch to the
public astryx.atmeta.com/images/ URL after merge) and a mocked, never-fetched
URL in useImageMode.test.ts.

Asset mapping: https://gist.github.com/imdreamrunner/1574db95a724d793e703036ee625e665
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot. needs:design-review Affects visuals — Design should review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant