Skip to content

Repository files navigation

Flixstack

A Contentstack starter template — a fully functional movie and TV streaming platform (Netflix-style) built to teach developers how to build on Contentstack.

Tech Stack: Next.js 16 · Contentstack · Tailwind CSS v4 · TypeScript · Lytics


Quick Start

npm install
npm run dev
# → http://localhost:3000

All content and images are served live from Contentstack — there is no mock-data fallback in the app itself. A Contentstack account and populated stack are required (see below). src/lib/mock-data.ts still exists purely as seed source data for scripts/seed.ts/scripts/upload-assets.mjs.


Connect Contentstack (10 minutes)

cp .env.local.example .env.local
# Fill in your Contentstack credentials — see /setup for a step-by-step guide
VariableWhere to find it
NEXT_PUBLIC_CONTENTSTACK_API_KEYStack → Settings → API Keys
NEXT_PUBLIC_CONTENTSTACK_DELIVERY_TOKENStack → Settings → Tokens → Delivery
NEXT_PUBLIC_CONTENTSTACK_ENVIRONMENTStack → Environments
NEXT_PUBLIC_CONTENTSTACK_REGIONUS (default), EU, AZURE_NA, AZURE_EU, GCP_NA, GCP_EU
NEXT_PUBLIC_CONTENTSTACK_LIVE_PREVIEWtrue to enable Live Preview / Visual Editor. This is the master switch — without it, edit tags and the editor bridge are never rendered, even with a valid preview token
CONTENTSTACK_PREVIEW_TOKENStack → Settings → Tokens → Delivery Tokens — enable the "Create Preview Token" toggle when creating the delivery token. Server-only, never prefix with NEXT_PUBLIC_
CONTENTSTACK_MANAGEMENT_TOKENStack → Settings → Tokens → Management Token — needed by every script below

Then build the content model, seed content, and publish:

# 1. Governed content_tags taxonomy + its 77 terms. Must run first: movie and# tv_series bind a taxonomy field to it, so it has to exist before them.
node scripts/migrate-v2.mjs terms
# 2. 8 global fields + 13 content types from content-models/export.json.# export.json is a plain schema document, NOT a `csdx cm:stacks:export` bundle,# so the Dashboard's Import Stack UI cannot accept it — it is POSTed to the CMA.
npm run import-model
# 3. Seed 77 sample entries (drafts), then upload + link 85 images
npm run seed
npm run upload-assets
# 4. Publish. The Delivery API only serves published content, so until this runs# the app renders empty. Publish after step 3 so artwork goes out attached.
npx tsx scripts/seed.ts --publish --update
# 5. Create + publish the /setup Developer Guide entry
node scripts/seed-setup-guide.mjs
# Optional: editor experience, validation rules, and editorial workflow
npm run customize-fields
npm run content-governance
npm run setup-workflow

Every script is idempotent and accepts --dry. Visit /setup in the running app for the full guided walkthrough — it is the same sequence, with an explanation of the Contentstack feature behind each step.


Pages & Features

PageURLContentstack Feature Shown
Home/Hero banners, modular block rails, Lytics personalization
Browse/browseTaxonomy filtering, multi-type queries
Title detail/watch/[slug]References, ISR revalidation, related content
Genre/genre/[slug]Dynamic routes from taxonomy entries
Search/searchContentstack full-text search API
Profile/profileLytics segment tracking and preference management
Dev Setup/setupGuided developer onboarding — driven entirely by the setup_guide singleton (JSON RTE, groups, governed enum icons)

Live Preview & Visual Builder

Open any entry in the Contentstack dashboard and launch Visual Builder — the running app loads in an iframe with every editable field highlighted via data-cslp tags (title, synopsis, images, etc.). Edits reflect on the page live via @contentstack/live-preview-utils, no manual refresh needed. Requires CONTENTSTACK_PREVIEW_TOKEN to be set and the environment's Visual Builder website URL configured in Contentstack Settings.

Themes

Light mode / dark mode toggle in the header. Defaults to OS preference. Green accent (#16A34A / #4ADE80) is WCAG AA compliant in both themes.


Project Structure

src/
├── app/ # Next.js App Router pages + API routes
├── components/
│ ├── ui/ # Button, Badge, Skeleton
│ ├── layout/ # Header, Footer, ThemeToggle, Providers
│ ├── streaming/ # TitleCard, Rail, Hero
│ ├── cms/ # ModularBlockRenderer
│ └── contentstack/ # LivePreviewInit (Visual Builder bridge)
└── lib/
├── contentstack/ # SDK client, normalize (editable tags + RTE), typed queries
├── lytics/ # CDP event tracking + server-side segments
├── mock-data.ts # Seed source for scripts/seed.ts + upload-assets.mjs only
├── setup-fallback.ts # Fallback content for /setup when the stack is unconfigured
├── types.ts # TypeScript types matching content models
└── utils.ts
content-models/export.json # Contentstack stack schema (13 types, 8 global fields)
scripts/import-model.mjs # Creates the schema in an empty stack from export.json
scripts/seed.ts # Seed script (Management SDK)
scripts/upload-assets.mjs # Uploads + links images to seeded entries
scripts/migrate-v2.mjs # Structured-content migration (global fields, taxonomy, enums)
scripts/seed-setup-guide.mjs # Creates + publishes the setup_guide content type & entry
docs/ # Deep-dive guides for each feature

Contentstack Content Models

Flixstack uses a structured-content model: fields shared across types are extracted into reusable global fields, tags are a governed taxonomy (not free text), and rich text uses JSON RTE. The full, importable schema lives in content-models/export.json. 13 content types:

TypeKey Fields
movietitle, synopsis (JSON RTE), runtime, genres/cast/director (Ref), title_metadata + artwork (Global Fields), content_tags (Taxonomy)
tv_seriestitle, synopsis, seasons (Modular Block → episodes), genres/cast/creator (Ref), status, title_metadata + artwork + seo
episodetitle, episode_number, duration, synopsis, thumbnail, air_date
genretitle, slug, description, color_accent, hero_image, seo
personname, bio, photo, role (multi-select: actor/director/producer/writer)
hero_bannertitle, subtitle, cta (Global Field), background_image, linked_title (Ref)
homepage_railtitle, rail_type, items (Ref), layout
pagetitle, slug, seo, sections (Modular Blocks)
navigationtitle, links (nav_link Global Field, repeatable)
headerlogo, main_navigation (Ref), cta, show_search, show_profile
footercolumns (group → navigation Ref), legal_text
site_configsite_name, feature_flags (group)
setup_guideSingleton driving /setup: intro, steps, feature deep-dives, doc links (JSON RTE + groups + link Global Field)

Global Fields (8):title_metadata (rating, tier, release date, score), artwork (hero/thumbnail), playback (video source, captions), cta, link (all subfields optional), nav_link (label + href mandatory), seo, availability_window

Taxonomy:content_tags — governed tag vocabulary applied to movies & TV series

Modular Blocks (page.sections): hero_block, rail_block, promo_block, genre_spotlight_block


Lytics Segments

SegmentLogicSite Effect
action_fanWatched ≥ 3 action titlesAction hero banner served
binge_watcher≥ 5 episodes in one sessionContinue Watching at top
new_userAccount < 7 daysOnboarding promo shown
premium_subscribertier = premiumUpsell rail hidden
lapsed_userNo activity in 30+ daysWelcome Back hero

Automation Hub Workflows

  1. Auto-tagging — On entry publish → AI agent writes back SEO metadata
  2. Availability expiry — Daily cron → unpublishes titles past their window
  3. Episode notifications — New episode published → notify watchlisted users

See docs/automations.md for webhook schemas and setup steps.


Accessibility

WCAG 2.1 Level AA. See docs/accessibility.md.

Key implementations:

  • Skip to main content link
  • aria-label on all icon-only controls
  • Keyboard-navigable rails and hero carousel
  • prefers-reduced-motion support
  • Focus-visible rings in green on all interactive elements

License

MIT — use freely as a starting point for your Contentstack projects.

About

Movie streaming platform starter for Contentstack AXP

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages