40227-vm/backend/docs/content-catalog.md
Dmitri d4a5378adf Refactor: migrate frontend to Vite/React, add product backend modules
Frontend:
- Replace Next.js with Vite + React + TypeScript
- Add new component architecture (app-shell, sidebar, dashboard modules)
- Implement product modules: FRAME, safety protocols, walkthrough checkin,
  campus/staff attendance, personality quiz, sign language, classroom timer
- Add shadcn/ui component library with Tailwind CSS
- Remove legacy generated components, stores, and pages

Backend:
- Add product migrations: frame_entries, user_progress, safety_quiz_results,
  walkthrough_checkins, communication_events, personality_quiz_results,
  campus_attendance_config/summaries, staff_attendance_records, content_catalog
- Add corresponding models, services, and routes
- Implement cookie-based auth with refresh token rotation
- Add content catalog seeder with product content
- Migrate to ESLint flat config
- Switch from yarn to npm

Infrastructure:
- Update .gitignore for new tooling
- Add project documentation (CLAUDE.md, docs/)
- Remove deprecated config files and yarn.lock

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-06-09 15:18:23 +02:00

4.4 KiB

Content Catalog

Purpose

content_catalog stores backend-owned seeded product content that the frontend renders through backend APIs.

This keeps the database and backend seeds as the source of truth for domain/content records instead of duplicating those records in frontend runtime constants.

Files

  • Migration: backend/src/db/migrations/20260608102000-create-content-catalog.js
  • Model: backend/src/db/models/content_catalog.js
  • Service: backend/src/services/content_catalog.js
  • Route: backend/src/routes/public_content_catalog.js
  • Management route: backend/src/routes/content_catalog.js
  • Seed payloads: backend/src/db/seeders/content-catalog-data/content-catalog-seed-payloads.js
  • Seeder: backend/src/db/seeders/20260608103000-content-catalog.js

API

Public read endpoint:

  • GET /api/public/content-catalog/:contentType

The response returns one active content payload for the requested contentType.

Authenticated management endpoints:

  • GET /api/content-catalog
  • POST /api/content-catalog
  • GET /api/content-catalog/:contentType
  • PUT /api/content-catalog/:contentType
  • DELETE /api/content-catalog/:contentType

Management endpoints are restricted to global access users and content managers. They allow runtime configuration for catalog-backed modules such as QBS quiz content, while the frontend runtime continues to consume active records through the public read endpoint.

Seeded Content Types

  • classroom-strategies
  • safety-qbs-quiz
  • sign-language-items
  • sign-language-page-content
  • regulation-zones
  • zones-of-regulation-page-content
  • dashboard-teacher-images
  • dashboard-encouraging-quotes
  • dashboard-compliance-items
  • dashboard-sign-of-week
  • parent-message-templates
  • community-organizations
  • vocational-opportunities
  • emotional-intelligence-assessment-questions
  • emotional-intelligence-weekly-topics
  • emotional-intelligence-growth-tips
  • emotional-intelligence-team-wellness-metrics
  • emotional-intelligence-weekly-focus
  • personality-quiz-questions
  • personality-types
  • personality-workplace-content
  • esa-funding-content
  • safety-protocols
  • classroom-timer-backgrounds
  • classroom-timer-sounds
  • classroom-timer-presets
  • classroom-timer-tips
  • personality-quiz-features

Rules

  • Add production content records to backend seed payloads, not frontend constants.
  • Keep frontend constants limited to UI config, labels, query keys, timing values, and presentation tokens.
  • If a catalog needs complex workflow state, approvals, or per-campus variants, replace the generic catalog entry with typed backend tables and tenant-scoped CRUD APIs.
  • Missing content types fail explicitly through the service instead of returning silent empty payloads.
  • Do not duplicate catalog payload copy in frontend constants. Frontend may define TypeScript contracts and UI-only labels, but editable content belongs to the backend.

Classroom Strategies

classroom-strategies stores strategy records rendered by the classroom support page. Titles, descriptions, images, categories, age groups, zones, and implementation tips are backend-owned content fields and should be edited through catalog management APIs or backend seeds.

Sign Language

sign-language-items stores sign records rendered by the sign language page. Teaching tips, video URLs, GIF URLs, and step instructions are backend-owned content fields.

sign-language-page-content stores page-level teaching reminders for the sign language page. This keeps editable instructional copy out of frontend runtime constants.

Zones Of Regulation

regulation-zones stores zone records rendered by the zones of regulation page. Zone descriptions, behaviors, strategies, matching signs, and zone presentation classes are backend-owned content fields.

zones-of-regulation-page-content stores page-level safety connection copy and quick de-escalation flow content for the zones page. This keeps editable instructional copy out of frontend runtime constants.

ESA Funding

esa-funding-content stores editable ESA funding content rendered by the ESA funding page. Approved uses, key points, state checklist items, school impact items, staff role guidance, parent conversation script, and resource records are backend-owned content fields. Static ESA intro copy and FAQs live in frontend constants because they are stable training copy rather than editable runtime records.