Files
news-platform/docs/frontend.md
T
David SantosandPaperclip 7b7830263b docs: architecture document and project scaffold for news-platform
- docs/architecture.md: full architecture with Astro 5 SSR vs Next.js/Nuxt
  justification, component diagram, data flow, multi-domain routing, SEO
  strategy, performance targets, and caching strategy
- docs/frontend.md, bridge.md, domains.md, seo.md, deployment.md: stubs
  with implementation detail for each layer
- config/domains/newsproject.bitreport.pt.json: first domain config
- project skeleton: frontend/, bridge/, wordpress/, config/, deploy/

Covers BIT-348 deliverables. Push pending Gitea repo creation.

Co-Authored-By: Paperclip <[email protected]>
2026-03-23 14:11:39 +00:00

2.8 KiB

Frontend — Astro 5 SSR

Status: Stub — implementation in progress (BIT-345)


Overview

The frontend is an Astro 5 SSR application. It renders all pages server-side, resolves the active domain config at request time, fetches data from the Fastify bridge, and returns complete HTML to the client.


Tech Stack

Layer Choice
Framework Astro 5 (SSR mode, output: 'server')
Adapter @astrojs/node
UI components Astro components + minimal React islands
Styling Tailwind CSS v4
Fonts Self-hosted (no Google Fonts CDN)
Build astro build → Node.js server

Directory Structure

frontend/
├── src/
│   ├── pages/
│   │   ├── index.astro           # Homepage
│   │   ├── [category]/
│   │   │   ├── index.astro       # Category listing
│   │   │   └── [slug].astro      # Article page
│   │   ├── search.astro          # Search results
│   │   ├── sitemap.xml.ts        # Dynamic sitemap
│   │   └── robots.txt.ts         # Dynamic robots.txt
│   ├── components/
│   │   ├── layout/
│   │   │   ├── Header.astro
│   │   │   ├── Footer.astro
│   │   │   └── BaseLayout.astro
│   │   ├── article/
│   │   │   ├── ArticleCard.astro
│   │   │   ├── ArticleBody.astro
│   │   │   └── ArticleMeta.astro
│   │   ├── home/
│   │   │   ├── HeroBlock.astro
│   │   │   ├── TrendingBlock.astro
│   │   │   └── CategoryBlock.astro
│   │   └── islands/
│   │       ├── SearchWidget.tsx  # React island (client:load)
│   │       └── MobileMenu.tsx    # React island (client:load)
│   ├── lib/
│   │   ├── domain.ts             # Domain config loader
│   │   ├── bridge.ts             # Bridge API client
│   │   └── seo.ts                # Meta tag helpers
│   └── styles/
│       └── global.css
├── astro.config.mjs
├── tailwind.config.mjs
└── package.json

Domain Resolution

See architecture.md#4-multi-domain-routing.


Performance Notes

  • All pages are SSR — no client-side data fetching waterfalls
  • Interactive components are Astro Islands (only hydrate when needed)
  • Hero images use fetchpriority="high" and <Image /> for WebP/AVIF
  • Tailwind output is purged — CSS < 20 KB per page
  • Cache-Control: s-maxage=60, stale-while-revalidate=300 set on article pages

Development

cd frontend
npm install
npm run dev        # localhost:4321
npm run build      # production build
npm run preview    # preview production build

Environment variables:

BRIDGE_URL=http://localhost:3200