# secorto/secorto_web architecture

> Architecture diagram of the GitHub repository secorto/secorto_web, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-04-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/secorto/secorto_web
- Repository: https://github.com/secorto/secorto_web

## Overview

1. **What this repository is**
   - This is a static personal site for secorto.com built with **Astro** and deployed through **Netlify**.
   - The site is content-heavy rather than app-heavy: the core value comes from markdown content, localized pages, and generated listings for blog, talks, work, projects, and community.

2. **Primary architecture style**
   - The repo follows a **content-to-static-site pipeline**:
     - markdown and frontmatter live in `src/content`
     - domain and utility layers normalize that content
     - Astro pages and layouts render it into static HTML
     - small client-side scripts provide selective interactivity
   - This keeps most rendering server/build-time only, with minimal browser JavaScript.

3. **Content model and sectioning**
   - Content is organized by **section** and **locale**:
     - `blog`, `talk`, `community`, `projects`, `work`
     - each section has `en` and `es` variants
   - The site relies on Astro content collections and frontmatter processing to extract metadata such as dates, tags, translations, and slugs.
   - The `src/domain` layer defines the canonical shape of entries, tags, navigation, translations, and page detail behavior.

4. **Routing and localization**
   - The public URL structure is locale-aware:
     - localized pages under `src/pages/[locale]/...`
     - section detail pages under `src/pages/[locale]/[section]/[...id].astro`
     - localized tags and RSS endpoints as well
   - There is also root-level handling in `src/pages/index.astro` and `src/scripts/language-redirect.js` to steer users to the appropriate language.
   - `src/i18n` centralizes locale config, date formatting, root route mapping, and language picker behavior.

5. **Content loading and static path generation**
   - `src/utils/sectionLoader.ts`, `src/utils/staticPathsBuilder.ts`, and related adapters assemble the route list for Astro’s static generation.
   - These utilities are responsible for discovering content entries, pairing translations, and producing the paths used by section index pages, detail pages, and tag pages.
   - This is a key boundary: content is not hardcoded in page components; it is transformed into route data first.

6. **Rendering layer**
   - `src/pages` contains the route entry points, while `src/layouts` provides page scaffolding:
     - `BaseLayout.astro`, `SiteLayout.astro`, `MarkdownLayout.astro`
   - `src/components` contains reusable UI blocks like header, footer, sidebar, language picker, SEO head, post lists, tag chips, and special views for work/posts/talks.
   - The rendering pattern is mostly “page assembles layout + components + content data,” with little business logic in the views.

7. **Client-side enhancements**
   - `src/client` and `src/scripts` contain the browser-side behaviors:
     - theme toggle
     - sidebar interactions
     - Giscus comments integration
     - language redirect support
   - These scripts are isolated from the static rendering path and act as progressive enhancement only.
   - The project also includes a service worker at `public/sw.js`, which suggests offline/cache behavior is part of the published site.

8. **External integrations**
   - The main external service visible in the architecture is **Giscus** for comments.
   - Social/embedded media support exists through components like responsive iframes and mocked third-party embeds in tests.
   - Netlify is a first-class deployment target, and the repo includes custom scripts to wait for preview deploys during CI.

9. **Build and deployment concerns**
   - `astro.config.mjs`, `netlify.toml`, and the Netlify wait scripts show that build and preview deployment are tightly integrated.
   - CI appears to validate both the static site and preview deployment availability before running end-to-end tests.
   - The project targets Node 20+ behavior, which matters for tooling and the Netlify wait script runtime.

10. **Testing architecture**
   - The repo has a layered test strategy:
     - **Vitest** for unit tests on domain, i18n, utils, and client behavior
     - **E2E** tests for functional flows and accessibility
     - both a `tests/` suite and a `cypress/` suite are present, indicating a migration/history of E2E tooling
   - Tests focus on content rendering, locale switching, tags, RSS, robots, theme persistence, and accessibility, which reflects the site’s architecture priorities.

11. **Cross-cutting concerns**
   - SEO and discoverability are explicit via `SEOHead`, `robots.txt`, RSS generation, alternate links, and locale-aware routing.
   - Accessibility is also treated as a first-class concern, with dedicated a11y tests and reusable UI components designed for navigation, sidebar, and responsive content.

12. **How to think about the system diagram**
   - A useful architecture diagram would show:
     - **content sources** in `src/content`
     - flowing into **domain/utility normalization**
     - then into **Astro routes/layouts/components**
     - then into **static output** plus small **client-side enhancements**
     - with **Netlify/CI** wrapping build, preview, and test execution
   - The central architectural boundary is between build-time content generation and minimal runtime/browser interactivity.

Main entry points: [`src/pages`](https://github.com/secorto/secorto_web/tree/master/src/pages) (Localized routes), [`src/utils/sectionLoader.ts`](https://github.com/secorto/secorto_web/blob/master/src/utils/sectionLoader.ts) (Section loader), [`src/components/Header.astro`](https://github.com/secorto/secorto_web/blob/master/src/components/Header.astro) (Site chrome), [`tests/unit`](https://github.com/secorto/secorto_web/tree/master/tests/unit) (Unit tests)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_content["Content pipeline"]
  node_content_collections["Content collections<br/>astro content"]
  node_content_config["Content config<br/>collection schema<br/>[content.config.ts]"]
  node_domain_model["Domain model<br/>content model"]
  node_utils_loader["Section loader<br/>content assembly<br/>[sectionLoader.ts]"]
  node_utils_paths["Path builder<br/>route generation"]
  node_utils_rss["RSS builder<br/>feed generation<br/>[rssBuilder.ts]"]
  node_i18n_core["I18n core<br/>locale config"]
end

subgraph group_site["Astro site"]
  node_pages_routes["Localized routes<br/>astro pages"]
  node_layouts["Layouts"]
  node_components_shell["Site chrome<br/>ui components<br/>[Header.astro]"]
  node_components_content["Content views<br/>ui components<br/>[PostList.astro]"]
end

subgraph group_runtime["Browser runtime"]
  node_client_theme["Theme toggle<br/>client script<br/>[themeToggle.ts]"]
  node_client_sidebar["Sidebar script<br/>client script<br/>[sidebar.ts]"]
  node_client_giscus["Giscus bridge<br/>client script<br/>[giscus.ts]"]
  node_script_lang_redirect["Lang redirect<br/>browser script"]
  node_service_worker["Service worker<br/>pwa cache<br/>[sw.js]"]
end

subgraph group_ops["Build and delivery"]
  node_astro_config["Astro config<br/>build config<br/>[astro.config.mjs]"]
  node_netlify_config["Netlify config<br/>deploy config<br/>[netlify.toml]"]
  node_netlify_wait["Wait scripts<br/>ci helper<br/>[wait-netlify.js]"]
end

subgraph group_qa["Testing"]
  node_unit_tests["Unit tests<br/>vitest"]
  node_e2e_tests["E2E tests<br/>browser tests"]
  node_cypress_suite["Cypress suite<br/>legacy e2e"]
end

node_content_collections -->|"validated by"| node_content_config
node_content_collections -->|"normalized into"| node_domain_model
node_domain_model -->|"feeds"| node_utils_loader
node_content_collections -->|"loaded by"| node_utils_loader
node_utils_loader -->|"drives"| node_utils_paths
node_utils_loader -->|"feeds"| node_utils_rss
node_utils_loader -->|"localized with"| node_i18n_core
node_i18n_core -->|"routes"| node_pages_routes
node_utils_paths -->|"prerenders"| node_pages_routes
node_utils_rss -->|"renders"| node_pages_routes
node_pages_routes -->|"assembles"| node_layouts
node_layouts -->|"uses"| node_components_shell
node_layouts -->|"uses"| node_components_content
node_components_shell -->|"enhanced by"| node_client_theme
node_components_shell -->|"enhanced by"| node_client_sidebar
node_components_content -->|"enhanced by"| node_client_giscus
node_pages_routes -->|"redirected by"| node_script_lang_redirect
node_pages_routes -->|"cached by"| node_service_worker
node_astro_config -->|"builds"| node_pages_routes
node_netlify_config -->|"deploys"| node_astro_config
node_netlify_wait -->|"verifies"| node_netlify_config
node_unit_tests -->|"covers"| node_domain_model
node_unit_tests -->|"covers"| node_i18n_core
node_unit_tests -->|"covers"| node_utils_loader
node_unit_tests -->|"covers"| node_client_theme
node_e2e_tests -->|"exercises"| node_pages_routes
node_e2e_tests -->|"exercises"| node_components_shell
node_cypress_suite -->|"exercises"| node_pages_routes
node_cypress_suite -->|"exercises"| node_components_shell

click node_content_collections "https://github.com/secorto/secorto_web/tree/master/src/content"
click node_content_config "https://github.com/secorto/secorto_web/blob/master/src/content.config.ts"
click node_domain_model "https://github.com/secorto/secorto_web/tree/master/src/domain"
click node_utils_loader "https://github.com/secorto/secorto_web/blob/master/src/utils/sectionLoader.ts"
click node_utils_paths "https://github.com/secorto/secorto_web/blob/master/src/utils/staticPathsBuilder.ts"
click node_utils_rss "https://github.com/secorto/secorto_web/blob/master/src/utils/rssBuilder.ts"
click node_i18n_core "https://github.com/secorto/secorto_web/tree/master/src/i18n"
click node_pages_routes "https://github.com/secorto/secorto_web/tree/master/src/pages"
click node_layouts "https://github.com/secorto/secorto_web/tree/master/src/layouts"
click node_components_shell "https://github.com/secorto/secorto_web/blob/master/src/components/Header.astro"
click node_components_content "https://github.com/secorto/secorto_web/blob/master/src/components/PostList.astro"
click node_client_theme "https://github.com/secorto/secorto_web/blob/master/src/client/themeToggle.ts"
click node_client_sidebar "https://github.com/secorto/secorto_web/blob/master/src/client/sidebar.ts"
click node_client_giscus "https://github.com/secorto/secorto_web/blob/master/src/client/giscus.ts"
click node_script_lang_redirect "https://github.com/secorto/secorto_web/blob/master/src/scripts/language-redirect.js"
click node_service_worker "https://github.com/secorto/secorto_web/blob/master/public/sw.js"
click node_astro_config "https://github.com/secorto/secorto_web/blob/master/astro.config.mjs"
click node_netlify_config "https://github.com/secorto/secorto_web/blob/master/netlify.toml"
click node_netlify_wait "https://github.com/secorto/secorto_web/blob/master/.github/scripts/wait-netlify.js"
click node_unit_tests "https://github.com/secorto/secorto_web/tree/master/tests/unit"
click node_e2e_tests "https://github.com/secorto/secorto_web/tree/master/tests/e2e"
click node_cypress_suite "https://github.com/secorto/secorto_web/tree/master/cypress"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_content_collections,node_content_config,node_domain_model,node_utils_loader,node_utils_paths,node_utils_rss,node_i18n_core toneBlue
class node_pages_routes,node_layouts,node_components_shell,node_components_content toneAmber
class node_client_theme,node_client_sidebar,node_client_giscus,node_script_lang_redirect,node_service_worker toneMint
class node_astro_config,node_netlify_config,node_netlify_wait toneRose
class node_unit_tests,node_e2e_tests,node_cypress_suite toneIndigo
```

## Components

### Content pipeline

Markdown source, normalization, and route data generation.

- [Content collections](https://github.com/secorto/secorto_web/tree/master/src/content): astro content · Sectioned markdown content organized by locale and collection. · `src/content`
- [Content config](https://github.com/secorto/secorto_web/blob/master/src/content.config.ts): collection schema · Defines Astro content collection rules and frontmatter validation. · `src/content.config.ts`
- [Domain model](https://github.com/secorto/secorto_web/tree/master/src/domain): content model · Canonical types for posts, sections, tags, navigation, translations, and page detail behavior. · `src/domain`
- [Section loader](https://github.com/secorto/secorto_web/blob/master/src/utils/sectionLoader.ts): content assembly · Loads section entries, pairs translations, and normalizes content for routes. · `src/utils/sectionLoader.ts`
- [Path builder](https://github.com/secorto/secorto_web/blob/master/src/utils/staticPathsBuilder.ts): route generation · Builds static route lists and adapters for Astro prerendering. · `src/utils/staticPathsBuilder.ts`
- [RSS builder](https://github.com/secorto/secorto_web/blob/master/src/utils/rssBuilder.ts): feed generation · Produces feed data and XML output for localized sections. · `src/utils/rssBuilder.ts`
- [I18n core](https://github.com/secorto/secorto_web/tree/master/src/i18n): locale config · Locale definitions, root route mapping, date formatting, and UI language helpers. · `src/i18n`

### Astro site

Pages, layouts, and reusable components that render the static site.

- [Localized routes](https://github.com/secorto/secorto_web/tree/master/src/pages): astro pages · Locale-aware entry points for home, sections, tags, RSS, robots, and detail pages. · `src/pages`
- [Layouts](https://github.com/secorto/secorto_web/tree/master/src/layouts): astro layouts · Page scaffolding for base shell, site chrome, and markdown content. · `src/layouts`
- [Site chrome](https://github.com/secorto/secorto_web/blob/master/src/components/Header.astro): ui components · Header, footer, sidebar, navigation, language picker, and theme UI. · `src/components/Header.astro`
- [Content views](https://github.com/secorto/secorto_web/blob/master/src/components/PostList.astro): ui components · Lists, post views, tags, dates, SEO head, embeds, and specialized section views. · `src/components/PostList.astro`

### Browser runtime

Small client-side enhancements loaded after the static render.

- [Theme toggle](https://github.com/secorto/secorto_web/blob/master/src/client/themeToggle.ts): client script · Browser-side theme state and icon behavior. · `src/client/themeToggle.ts`
- [Sidebar script](https://github.com/secorto/secorto_web/blob/master/src/client/sidebar.ts): client script · Client interactions for sidebar and menu behavior. · `src/client/sidebar.ts`
- [Giscus bridge](https://github.com/secorto/secorto_web/blob/master/src/client/giscus.ts): client script · Progressive enhancement for the comments integration. · `src/client/giscus.ts`
- [Lang redirect](https://github.com/secorto/secorto_web/blob/master/src/scripts/language-redirect.js): browser script · Steers visitors to the appropriate locale root route. · `src/scripts/language-redirect.js`
- [Service worker](https://github.com/secorto/secorto_web/blob/master/public/sw.js): pwa cache · Static asset caching and offline behavior for the published site. · `public/sw.js`

### Build and delivery

Configuration, deployment hooks, and test orchestration.

- [Astro config](https://github.com/secorto/secorto_web/blob/master/astro.config.mjs): build config · Top-level Astro build and integration settings. · `astro.config.mjs`
- [Netlify config](https://github.com/secorto/secorto_web/blob/master/netlify.toml): deploy config · Deployment and preview build configuration for Netlify. · `netlify.toml`
- [Wait scripts](https://github.com/secorto/secorto_web/blob/master/.github/scripts/wait-netlify.js): ci helper · CI helpers that wait for preview deploy availability before tests run. · `.github/scripts/wait-netlify.js`

### Testing

Unit, functional, and end-to-end verification layers.

- [Unit tests](https://github.com/secorto/secorto_web/tree/master/tests/unit): vitest · Fast verification of domain, i18n, utils, client code, and deployment helpers. · `tests/unit`
- [E2E tests](https://github.com/secorto/secorto_web/tree/master/tests/e2e): browser tests · Functional, accessibility, smoke, and content-flow coverage. · `tests/e2e`
- [Cypress suite](https://github.com/secorto/secorto_web/tree/master/cypress): legacy e2e · Older browser test suite kept alongside the newer E2E coverage. · `cypress`

## Connections

- Content collections → Content config: validated by · Markdown collections are defined and checked through the content schema.
- Content collections → Domain model: normalized into · Raw frontmatter and entry data are shaped into canonical domain types.
- Domain model → Section loader: feeds · Domain rules guide how entries and translations are assembled.
- Content collections → Section loader: loaded by · Section loaders discover localized entries and metadata.
- Section loader → Path builder: drives · Normalized section data becomes route sets for static generation.
- Section loader → RSS builder: feeds · Loaded content powers localized RSS output.
- Section loader → I18n core: localized with · Locale and language helpers shape route and display behavior.
- I18n core → Localized routes: routes · Locale mapping determines public URL structure and language selection.
- Path builder → Localized routes: prerenders · Static path builders supply Astro with section, detail, and tag paths.
- RSS builder → Localized routes: renders · RSS XML endpoints are exposed through page routes.
- Localized routes → Layouts: assembles · Route entry points compose the shared site layouts.
- Layouts → Site chrome: uses · Layouts bring in shell components for site-wide chrome.
- Layouts → Content views: uses · Layouts render lists, detail views, SEO, and content-specific UI.
- Site chrome → Theme toggle: enhanced by · Theme UI is activated and persisted in the browser.
- Site chrome → Sidebar script: enhanced by · Navigation and sidebar interactions are handled client-side.
- Content views → Giscus bridge: enhanced by · Comments are injected through a small client bridge.
- Localized routes → Lang redirect: redirected by · Root-level language steering is handled outside the page render path.
- Localized routes → Service worker: cached by · Published assets can be cached for offline-like behavior.
- Astro config → Localized routes: builds · Astro configuration governs route compilation and site build behavior.
- Netlify config → Astro config: deploys · Netlify is the primary deployment target for the Astro build.
- Wait scripts → Netlify config: verifies · CI waits for preview deploy availability before test execution.
- Unit tests → Domain model: covers · Unit tests validate domain rules and computed entry behavior.
- Unit tests → I18n core: covers · Locale helpers and formatting are tested directly.
- Unit tests → Section loader: covers · Content loading and route assembly are validated in isolation.
- Unit tests → Theme toggle: covers · Browser enhancement logic is unit tested.
- E2E tests → Localized routes: exercises · Functional browser tests cover localized pages, feeds, tags, and accessibility.
- E2E tests → Site chrome: exercises · E2E flows verify navigation, footer, and sidebar behavior.
- Cypress suite → Localized routes: exercises · Legacy Cypress coverage still targets key site flows.
- Cypress suite → Site chrome: exercises · Legacy browser tests focus on navigation and interactive chrome.
