How netlify-moneytronic/rolandcreate works
Project type and purpose
• This is a headless-CMS–driven static site built with Next.js (React) that uses Contentful for content management, Stackbit for visual editing integration, and Netlify for hosting/deployment. It provides a repeatable demo workflow: import demo content into a Contentful space, run a local dev server for both the Next.js site and the Stackbit visual editor, then deploy to Netlify.
File structure
• Top-level config files: .env.example (environment variables), netlify.toml (build/deploy settings), next.config.js, stackbit.config.js, and various lint/prettier configs.
• contentful/ folder: import-export scripts and JSON asset dumps—used for seeding a Contentful space.
• src/ folder: Next.js “app” directory with dynamic routing ([...slug]), layout/page components, and a components/ subfolder (Button, Hero, Stats).
• src/utils/content.js: abstractions for fetching content from Contentful’s Delivery API.
• public/ and styles/: static assets and global CSS.
• package.json scripts: “import” (npm run import), “dev” (npm run dev), and “stackbit” for running the Stackbit visual editor locally.
README for additional insights
• Describes cloning, installing, setting up Contentful API tokens, seeding the Contentful space, and running local dev servers for Next.js and Stackbit.
• Mentions Netlify Create (Visual Editor) using data-sb-object-id annotations for in-page editing.
• Production site deployed on Netlify.
a. Main components:
• Developer Workstation
• Contentful Import Script (node script in contentful/import.js)
• Next.js Development Server (npm run dev)
• Stackbit Visual Editor Server (npm run stackbit)
• Contentful CMS (Content Delivery API + Content Management API)
• Next.js Application (React SSR/SSG)
• Static Assets (public/, images served via Contentful CDN and Netlify CDN)
• Netlify Build & Hosting
b. Relationships & data flow:
1. Developer triggers “npm run import” → import.js reads export JSON → Contentful Management API → seeds Contentful space.
2. Next.js at build time or runtime fetches content via Delivery API (src/utils/content.js) using environment variables.
3. Next.js build produces static HTML/CSS/JS (SSG) or server-rendered pages; assets are bundled.
4. Netlify CI/CD picks up the repo → runs build → deploys the static site + serverless functions if any.
5. End user’s browser requests pages & assets from Netlify CDN.
6. Stackbit Visual Editor injects editing overlays into the running Next.js site by leveraging data-sb-object-id attributes and communicating with Contentful.
c. Architectural patterns & design principles:
• Headless-CMS pattern: decoupled content layer (Contentful) vs. presentation layer (Next.js).
• JAMstack: pre-built markup, CDN distribution, client-side hydration.
• Import script as a one-time or repeatable seeding tool (infrastructure as code for CMS).
• Environment-driven configuration (.env).
d. Key technologies & frameworks:
• Next.js (React, SSG/SSR)
• Contentful (Delivery API, Management API)
• Stackbit (visual editor integration)
• Netlify (CI/CD, CDN hosting)
• Node.js scripts for import
Detail
• Environment variables (.env) driving API configuration.
• Location of key files (stackbit.config.js, next.config.js, contentful/import.js).
• Call out static asset hosting (public/, Contentful image CDN).