Deploy multi-page Astro site with dark themes and CI data pipeline#4
Merged
Conversation
Co-authored-by: cywf <100837335+cywf@users.noreply.github.com>
Co-authored-by: cywf <100837335+cywf@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Create and deploy multi-page site with Astro and React
Deploy multi-page Astro site with dark themes and CI data pipeline
Nov 2, 2025
cywf
approved these changes
Nov 2, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves 404 at https://cywf.github.io/ctf-kit/ by deploying a modern static site built with Astro + React + Tailwind + daisyUI.
Architecture
Framework: Astro 4.16 with Islands architecture for zero-JS SSR pages, selective hydration for interactive components (Chart.js visualizations, Mermaid diagrams, theme switcher).
Base path: Configured
/ctf-kitbase with proper asset prefixing for GitHub Pages subdirectory deployment.CI data pipeline: Workflow fetches live repo data (stars/forks/languages, discussions, project boards) via GitHub APIs at build time, writes JSON snapshots to
site/public/data/, consumed client-side. Graceful fallbacks on rate limits.Theme System
7 dark/neon variants (nightfall, dracula, cyberpunk, dark-neon, hackerman, gamecore, neon-accent) with daisyUI tokens. localStorage persistence +
prefers-color-schemedetection. Keyboard-accessible dropdown with visual active state.Pages
/docs/**/*.mdwith inline code highlighting, GitHub edit linksCI Workflow
.github/workflows/pages.ymlruns on push tomain:fetch_repo_data.ts,fetch_discussions.ts,fetch_projects.ts,scan_scripts.tsactions/deploy-pages@v4Scripts use
GITHUB_TOKENserver-side only, never exposed client-side.Accessibility
prefers-reduced-motionsupportFile Structure
Additional Changes
mermaid/ctf-workflow.mmd,mermaid/contribution-flow.mmd.gitignore: Excludessite/node_modules,site/dist,site/.astroDeployment
Merge triggers automatic deployment. Site live at https://cywf.github.io/ctf-kit/ within 2-5 minutes. Requires GitHub Pages enabled with source set to "GitHub Actions" in repository settings.
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
https://api.github.com/graphql/usr/local/bin/node --require /home/REDACTED/work/ctf-kit/ctf-kit/site/node_modules/tsx/dist/preflight.cjs --import file:///home/REDACTED/work/ctf-kit/ctf-kit/site/node_modules/tsx/dist/loader.mjs scripts/fetch_discussions.ts(http block)/usr/local/bin/node --require /home/REDACTED/work/ctf-kit/ctf-kit/site/node_modules/tsx/dist/preflight.cjs --import file:///home/REDACTED/work/ctf-kit/ctf-kit/site/node_modules/tsx/dist/loader.mjs scripts/fetch_projects.ts(http block)https://api.github.com/repos/cywf/ctf-kit/usr/local/bin/node --require /home/REDACTED/work/ctf-kit/ctf-kit/site/node_modules/tsx/dist/preflight.cjs --import file:///home/REDACTED/work/ctf-kit/ctf-kit/site/node_modules/tsx/dist/loader.mjs scripts/fetch_repo_data.ts(http block)https://api.github.com/repos/cywf/ctf-kit/issues/usr/local/bin/node --require /home/REDACTED/work/ctf-kit/ctf-kit/site/node_modules/tsx/dist/preflight.cjs --import file:///home/REDACTED/work/ctf-kit/ctf-kit/site/node_modules/tsx/dist/loader.mjs scripts/fetch_projects.ts(http block)https://api.github.com/repos/withastro/astro/tarball/examples/minimalnode /home/REDACTED/.npm/_npx/abdb4b598af046c4/node_modules/.bin/create-astro site --template minimal --install --git false --typescript strictest --yes(http block)telemetry.astro.buildnode /home/REDACTED/work/ctf-kit/ctf-kit/site/node_modules/.bin/astro build(dns block)node /home/REDACTED/work/ctf-kit/ctf-kit/site/node_modules/.bin/astro preview(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
You are working in the public repository cywf/ctf-kit (default branch: main).
The current Pages URL https://cywf.github.io/ctf-kit/ returns 404.
Create and deploy a modern, multi-page site (no single static index.html) built with Astro + React + Tailwind + daisyUI.
Include selectable dark/neon themes and pages wired to this repo’s data via CI snapshots.
1) Framework & Project Layout
site/using Astro with React, TailwindCSS, and daisyUI.astro.config.mjs:site/package.jsonscripts:dev,build,preview,typecheck.2) Theme System (user-selectable, dark-first)
<ThemeSwitcher />(persists in localStorage; respectsprefers-color-schemeon first load).nightfall,dracula,cyberpunk(daisyUI built-in),dark-neon,hackerman,gamecore,neon-accent..envDEFAULT_THEMEwith safe fallback tonightfall.3) Routes / Pages (with shared layout: top nav, breadcrumbs, footer)
A)
/— Project InfoB)
/statistics— Statisticssite/public/data/stats.json.C)
/discussions— Discussionssite/public/data/discussions.json.D)
/development-board— Development Boardsite/public/data/projects.json.status:todo,status:doing,status:done) if Projects v2 not accessible.E)
/create-issue— Create Issuehttps://github.com/cywf/ctf-kit/issues/new/chooseF)
/docs— Docs/docs/**using Astro MD/MDX with dark code highlighting, TOC, and “Open in GitHub” buttons.G)
/visualizer— Project Visualizer (Mermaid).mmdfiles under/mermaid/**if present.site/public/diagrams/(or fetch raw via API at build-time).<MermaidViewer />initializes Mermaid with a dark theme and lets the user choose among diagrams (tabs/dropdown), with deep-linkable IDs..mmdfiles exist, render a helpful empty state that tells contributors to add diagrams under/mermaid/.(H) Optional bonus:
/scripts/scripts/**(CI writes an index JSON) with short descriptions pulled from file headers and links to raw files.4) CI/CD — GitHub Pages + Data Snapshots
Add
.github/workflows/pages.ymlthat:actions/checkout@v4actions/setup-node@v4(Node 20)npm ciinsite/site/scripts/(create these):fetch_repo_data.ts→site/public/data/stats.jsonfetch_discussions.ts→site/public/data/discussions.jsonfetch_projects.ts→site/public/data/projects.json(tolerate missing Projects v2; fallback to issues)scan_scripts.ts→ optional;site/public/data/scripts.jsonwith path + brief header commentsnpm run buildinsite/actions/configure-pages@v5actions/upload-pages-artifact@v3(path:site/dist)actions/deploy-pages@v4Workflow permissions:
contents: read,pages: write,id-token: write.Cache npm intelligently.
Script implementation notes
GITHUB_TOKENserver-side only. Never expose tokens client-side./scripts/**and read first comment block for description if present.5) UX, Accessibility, Performance
prefers-reduced-motion.6) 404 & Base-Path Fix
base: "/ctf-kit"and rel...✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.