How instinctbits/astro-datanova works
Project type and purpose
• This is a full-stack, multi-page website template (“DataNova”) built with Astro. It serves marketing sites, docs hubs, and dynamic applications.
• Key features: SSR pages, static asset delivery, content collections (Markdoc), Keystatic CMS for content editing, Astro DB + Turso for data (feedback), Tailwind CSS + Preline UI for styling.
File structure
• Top-level:
• db/ – defines Astro DB schema (db/config.ts) and seeds (db/seed.ts).
• public/ – static assets served as-is (images, manifest).
• src/ – application code:
– assets/ (images, global styles)
– content.config.ts + content/ (Markdoc articles & reference)
– data/ (JSON collections)
– layout/ (BaseLayout.astro)
– pages/ – routing: SSR pages (index.astro, about.astro, contact.astro), dynamic support routes, API route (pages/api/feedback.ts), robots.txt.
– utils/ – nav, megaMenu, helpers
• config files: astro.config.mjs (integrations: React, Markdoc, Keystatic, Astro DB, adapter), tsconfig.json, svelte.config.js, vercel.json, .env.template.
• Architectural patterns:
• Server-Side Rendering (SSR) via Astro adapter on Vercel
• Content-driven: file-based routing + Markdoc collections + Keystatic admin UI
• API layer: single feedback endpoint writing to Astro DB/Turso
• Utility modules for navigation & mega menus
README for additional insights
• Integrations: Astro SEO, Astro Font, ClientRouter (view transitions), optional sitemap
• Deployment: Vercel SSR with environment variables for Astro DB & Keystatic
• Customization: navigation/megaMenu via utils, footers via layout import swap
a. Main components:
• Client (Browser)
• CDN / Static Assets (public/, Tailwind-built CSS, images)
• Astro SSR Server (Vercel)
– Routing Layer (file-based pages under src/pages)
– Markdoc Renderer (content.config.ts + src/content)
– API Layer (/api/feedback.ts)
– Keystatic CMS Admin UI (/keystatic)
– Integrations: Astro SEO, Astro Font, ClientRouter
• Database (Astro DB → Turso remote)
• GitHub (optional content storage for Keystatic in “github” mode)
• Dev Tools (local filesystem for Markdoc + Keystatic local mode)
b. Relationships & flows:
1. Browser → SSR Server: request pages → Astro reads content (local or GitHub via Keystatic) + JSON data → renders HTML + inlined CSS/JS → returns to client
3. Browser → API /api/feedback: fetch POST → SSR Server writes to Astro DB → pushes to Turso
4. Admin Editor ↔ Keystatic UI → reads/writes Markdoc files (local FS or GitHub repo) via SSR Server
5. SSR Server ↔ Turso: runs queries over Astro DB integration
6. CI/CD: GitHub → Vercel auto-deploy → environment variables set for SSR & DB
c. Architectural patterns & principles:
• Separation of concerns: clear static vs dynamic routes; content vs presentation vs data
• File-based routing for pages and API
• Content collections for scalability (articles, reference, data JSON)
• Single-responsibility components (common vs sections vs ui)
• Pluggable integrations for SEO, fonts, CMS, DB
d. Key technologies:
• Astro (core SSR & static builder)
• Tailwind CSS + Preline UI (styles, interactive UI)
• Markdoc (content authoring)
• Keystatic (CMS integration)
• Astro DB + Turso (feedback storage)
• Vercel adapter (deployment)
• Svelte (feedback component)
Capturing essential architectural elements
• You include every boundary: static assets CDN vs SSR dynamic, CMS UI routes vs public pages, API route vs page routes
• Don’t over-compartmentalize—focus on the six or seven primary blocks listed above for clarity.