HomeFeaturesCommunityPricingContactDocumentation
Login
HomeFeaturesCommunityPricingContactDocumentation
  • Introduction
  • Help center
  • Common questions
  • Get Started
  • Localhost
  • Architecture
  • Structure
  • Pattern
  • Page
  • Layout
  • Content
  • Types
  • Config
  • Actions
  • Queries
  • Authorization
  • Validation
  • Form
  • Table
  • Detail
  • Card
  • Util
  • Hooks
  • List Params
  • Views
  • README.md
  • ISSUE.md
  • Technology Stack
  • Database
  • File
  • CDN Assets
  • Entry Points
  • Dashboard
  • Authentication
  • Credentials
  • OAuth
  • Flow Diagrams
  • Multi-Tenancy
  • Offline
  • Onboarding
  • Onboarding Videos
  • Add Values
  • Admission
  • Application
  • Attendance
  • Compliance
  • Profile
  • Exams
  • Exam Wizard
  • Timetable
  • Classrooms
  • Notifications
  • Conference
  • LMS (Lumos)
  • Finance
  • Fee Management
  • Invoice
  • Wallet
  • Salary
  • Payroll
  • Timesheet
  • Expenses
  • Budget
  • Receipt
  • Accounts
  • Banking
  • Reports
  • Dashboard
  • Permissions
  • Messages
  • Integration Flow
  • Provision
  • AI Document Processing
  • Document Intelligence
  • Internationalization
  • Translation
  • Translation Guide
  • Icons
  • Docs Factory
  • Inspiration
  • Listings
  • Teachers
  • Students
  • Catalog
  • Library
  • Contributing
  • Code of conduct
  • GitHub Workflow
  • Database Seeds
  • Database Safety
  • Test Accounts
  • Bulk import
  • Playwright
  • Prettier
  • Block Rebound
  • Transportation
  • PRD

CDN Assets

PreviousNext

Curated media on cdn.databayt.org — product media that mirrors the app's routes, plus app chrome through the asset() helper.

Every curated hogwarts asset lives under the hogwarts/ namespace of cdn.databayt.org (hogwarts is the internal name; balqalam is only the public brand). There are two tiers:

  1. Product media — the stills and videos /shoot and /record produce. The path mirrors the app's URL, language first, file names are fixed and never hashed, and pages and the support chat read them by id from src/components/docs/media-manifest.json, never by URL.
  2. App chrome — icons, illustrations, animations and photos, through asset() (flat, unhashed).

Chrome is cached immutable for one year; product media is overwritten in place on a re-shoot (an hour in browsers, a year at the edge, invalidated on overwrite) and its manifest URLs carry ?v=<sha8>. One origin helper, src/lib/cdn.ts (CDN_ORIGIN, cdn(key)), builds every URL; nothing else hard-codes the domain.

Infrastructure

ComponentValue
S3 bucketdatabayt-cdn (us-east-1; user uploads stay in hogwarts-databayt)
CloudFront CNAMEcdn.databayt.org (preferred)
CloudFront rawd1dlwtcfl0db67.cloudfront.net (still works — additive alias)
Cachechrome public, max-age=31536000, immutable · product media public, max-age=3600, s-maxage=31536000
Env varNEXT_PUBLIC_CDN_DOMAIN (build-time; read only by src/lib/cdn.ts)

Product media — the CDN mirrors the app URL

<school>.databayt.org/<lang>/<route>
cdn.databayt.org/hogwarts/<lang>/<route>[/<flow>]/<asset>

Route groups and s/[subdomain] never reach a URL, so they never reach a key. When one route hosts two flows (/school/bulk imports students and teachers) each gets a short subfolder. Every key names its language; English is the same path under en/.

AssetKey
Tutorialvideo.mp4 · video.av1.mp4 · video.poster.webp · video.vtt
Still<step>.avif · <step>@2x.avif · <step>.webp · <step>@2x.webp
Phone stilliphone-16/<step>.avif
Reel, clipreel.mp4 · <clip>.mp4
Page stillpage.avif (home → hogwarts/<lang>/page.avif)
FlowApp routeCDN folder
add-student/studentshogwarts/ar/students/add/
add-teacher/teachers/addhogwarts/ar/teachers/add/
bulk-student/school/bulkhogwarts/ar/school/bulk/student/
bulk-teacher/school/bulkhogwarts/ar/school/bulk/teacher/
set-fees/finance/feeshogwarts/ar/finance/fees/
view-timetable/timetablehogwarts/ar/timetable/

So cdn.databayt.org/hogwarts/ar/school/bulk/student/video.mp4 is the Arabic bulk-import tutorial, and …/en/school/bulk/student/review.avif its English review step. A re-shoot overwrites the same key; the manifest's ?v=<sha8> makes browsers fetch the new bytes. A flow declares its folder as export const route in kun's shoot/flows/hogwarts/<flow>.mjs; media.sh prune lists keys nothing serves any more.

Render them by manifest id:

<FlowMedia flow="add-student" />
<Shot id="add-student/created-ar" />
<TutorialVideo id="add-student/video-ar" />

FlowMedia lists stills by their order (the step number they were shot in). The sources stay outside the repo in ~/media/hogwarts/<flow>/; see the kun shoot docs for the full grammar.

App chrome — asset()

import { asset } from "@/lib/asset-url"
 
<Image src={asset("/icons/logo.png")} />
<Image src={asset("/illustrations/attendance.png")} />
<img src={asset("/icons/visa.svg")} />
<source src={asset("/media/story.mp4")} />

asset("/icons/logo.png") → https://cdn.databayt.org/hogwarts/logo.png — only the file name is kept.

Chrome groups

The chrome objects sit flat at hogwarts/<file>; the groups below are how they are catalogued, not folders.

GroupPurposeCount
icons/Small functional SVGs, logos, small PNGs42
illustrations/Art, decorative, complex88
animations/Lottie JSON3
photos/Real photographs22
media/Video and audio1
Total155

Naming conventions

RuleExampleAnti-pattern
kebab-casedata-science.pngdataScience.png
Lowercasevisa.svgVisa.svg
No spaceshands-build.svgHands Build.svg
No prefixes by defaultvisa.svgpayment-visa.svg
Rename only on collisionsite-ball.pngPrefix everything

icons/ (42)

GroupKeys
Brandlogo.png, master-card.png, z.png
Anthropic UIgraduation-cap.svg, star-outline.svg, book-open.svg, anthropic-user.svg, users.svg, check-circle.svg, document.svg, news.svg
Paymentvisa.svg, mastercard.svg, amex.svg, apple-pay.svg, google-pay.svg, paypal.svg, mada.svg, stcpay.svg, fawry.svg
Exam typesmultiple-choice.svg, true-false.svg, short-answer.svg, essay.svg, fill-in-blank.svg, matching.svg, ordering.svg, multi-select.svg
Form attachmentsdegree.png, transcript.png, id.png, resume.png, files.png, image.png
Missionhands-build.svg, hands-stack.svg, objects-puzzle.svg
Sponsorsfaisal.png, mtdt.png, zain.png, khartoum.png, dal.png, 249.png, uok.png

illustrations/ (88)

GroupHighlights
Anthropic arthands-build.svg, hands-stack.svg, objects-puzzle.svg, category-01.svg … category-14.svg, claude-code-best-practices.svg, think-tool.svg, eng-long-running-agents.svg, anthropic-abstract.svg
Feature (32)student.png, teacher.png, fees.png, exam.png, assigment.png, attendance.png, gradebook.png, timetable.png, library.png, events.png, video.png, payroll.png, invoicing.png, wallet-3.png, credit-card.png, app-store.png, email.png, offer.png, canteen.png, parent.png, transport.png, headphone.png, notifications.png, calendar-2.png, id-cards.png, phone.png, messaging.png, graduate.png, blackboard.png, download.png, role-based.png, cover-letter.png, admission.png
Site artsite-ball.png, hat.png, glass.png, tent.png, teleport.png, community.png, champion.png, world.png, light-bulb.png, ball.png, robot.png, ai-fluency-hero.webp
Lumosteach.jpg, inspire.jpg, reward.jpg, generative-ai.png, it-certifications.png, data-science.png
Onboardingprivate.png, onboarding-public.png, international.png, techincal.png, espical.png, onboarding-step2.svg
GitHub achievementsstarstruck-detail.png, galaxy-brain-detail.png, pull-shark-detail.png, yolo-detail.png, pair-extraordinaire-detail.png, quickdraw-detail.png, public-sponsor-detail.png

Feature illustrations are used by feature-tabs.tsx and dream-section.tsx.

animations/ (3)

KeyUsed by
confetti.jsonsuccess modal, completion modal
anthropic-hero.jsonhero illustration
education.jsoneducation animation

photos/ (22)

GroupKeys
Contributorscontributors-h.jpeg, contributors-d.jpeg, contributor-1.jpg … contributor-6.jpg, mazin.jpg
Siteharry-potter.png, site-h.jpeg, trian.jpeg, site-a.jpeg, site-b.jpeg, map.jpeg
Facultydumbledore.jpeg, snape.jpeg, mcgonagall.jpeg, hagrid.jpeg
Housesgryffindor.jpeg, ravenclaw.jpeg, hupplepuff.jpeg, slytherin.jpg

media/ (1)

KeyUsed by
story.mp4legacy flat copy, served application/octet-stream; nothing reads it any more

The story video and the school hero loop are product media now: hogwarts/story.<hash>.mp4 and hogwarts/hero-3d.<hash>.mp4 (route /), listed with their codecs and posters in media-manifest.json. The lumos lesson-player fallback plays the story's H.264 source.

Pre-existing CDN systems (do not touch)

SystemS3 prefixHelper
Catalog imagescatalog/subjects/{id}/thumbnail-{size}.webpgetCatalogImageUrl()
Video uploadslumos/{schoolId}/video/{timestamp}_{name}getCloudFrontUrl()
Subject fallbackspublic/subjects/ (local)image-map.ts

What stays in public/

ItemReason
service-worker.jsBrowser same-origin requirement
leaflet/ (3 files)Leaflet CSS hardcodes relative paths
logo.pngPWA manifest fallback
exams-main/ (666 PDFs)Arabic exam papers, local access
us-curriculum/ (1,023 images)Deferred
courses/ (57 PNGs)Deferred
books/ (20 images)Deferred
subjects/ (17 PNGs)Catalog pipeline fallback

Adding new assets

Product media (screens, flows, videos): shoot or record it, then publish.mjs --flow <flow> — never upload by hand.

App chrome:

  1. Upload to hogwarts/<file>.
  2. kebab-case, lowercase filenames.
  3. Set Content-Type and CacheControl: "public, max-age=31536000, immutable".
  4. Reference with asset("/category/filename.ext").

Or use the migration script.

pnpm tsx scripts/migrate-assets-to-s3.ts            # dry run
pnpm tsx scripts/migrate-assets-to-s3.ts --upload   # upload
pnpm tsx scripts/migrate-assets-to-s3.ts --manifest # output JSON manifest

Future

  • Move us-curriculum/, courses/, books/ to a content/ prefix in S3.
  • Multi-tenant branding at schools/{schoolId}/brand/.

See also

  • File
  • Multi-Tenancy
FileEntry Points

On This Page

InfrastructureProduct media — the CDN mirrors the app URLApp chrome — asset()Chrome groupsNaming conventionsicons/ (42)illustrations/ (88)animations/ (3)photos/ (22)media/ (1)Pre-existing CDN systems (do not touch)What stays in public/Adding new assetsFutureSee also

Built by Databayt ·