How deathnet123/sparklers works
Project type and purpose
• This is a static/blog website built with Next.js (v13) that leverages Markdown/MDX content, custom layouts, and Tailwind CSS for styling. It’s intended as a personal cybersecurity blog (“Sparklers”) deployed (via Netlify) as a static site.
File structure
• Top-level directories:
• config/ – JSON data for menus, theme settings, social links
• content/ – Markdown/MDX articles and pages
• context/ – React context for global UI state (e.g., theme)
• hooks/ – Custom React hooks for window size, infinite-load, OS detection
• layouts/ – React components and templates (Base, Post, Partials, Shortcodes)
• lib/ – Build-time utilities (parsers, JSON generator, taxonomy, reading-time)
• pages/ – Next.js routing layer (including dynamic routes for posts, categories, pagination)
• public/ – Static assets (images, robots.txt, .htaccess)
• styles/ – Global SCSS and Tailwind config
• config files & scripts: next.config.js, postcss.config.js, tailwind.config.js, netlify.toml
Key insights from README
• Uses Next.js static SSG/SSG with live reload during development.
• Relies on Node/NPM scripts: npm run dev, npm run build.
• No backend API; all content is baked into static JSON + HTML at build time.
Main components
a. Developer Machine & CI/CD Pipeline
• Source Repo → Build step (Node.js, lib/* generators parse content/ + config/ → produce JSON + static pages) → Deploy to Netlify
b. Static Site Generation (SSG) Layer (Next.js)
• Input: content/*.mdx, config/*.json, layout templates → Next.js compiler → HTML, JSON, CSS, JS bundles
c. CDN/Hosting (Netlify)
• Hosts the output under public/; delivers assets via CDN
d. Client (Browser)
• Fetches index.html + JS bundles
• Hydrates React components
• Interactions: ThemeSwitcher (context), SearchModal (client-side JSON search), useLoadMore (fetch paginated JSON), share, newsletter form
Relationships & interactions
• Build Time: content & config feed into lib parsers → JSON generator → Next.js SSG → static files
• Runtime: Browser requests HTML & JS → React hydration → client-side routing (via next/router) & data fetching (from pre-generated JSON endpoints under /_next/data or public folder)
• External services: Netlify for hosting + CI/CD; third-party scripts for newsletter or analytics (if used)
Architectural patterns & principles
• Static Site Generation (SSG) for performance & SEO
• Component-based UI (layouts/components/partials/shortcodes)
• Unidirectional data flow: config → parsing → props → React UI
• Separation of concerns: content files vs. presentation (layouts) vs. data transforms (lib) vs. client logic (hooks & context)
Technologies & frameworks
• Next.js (Routing, SSG, Image, Data fetch), React (context, hooks), MDX/Markdown
• Tailwind CSS & SCSS, PostCSS
• Node.js build scripts, Netlify hosting