How bc1pzzfnxl/eurometrics works
1. What this repository is
- EuroMetrics is a client-side Vue dashboard for Eurozone economic and financial indicators.
- The app is mostly a single-page frontend that fetches data from official public APIs, renders interactive comparisons, and is deployed as static assets.
2. Top-level runtime and build boundary
- The stack is Vue 3 + TypeScript + Vite, managed with Bun.
- src/main.ts bootstraps the app, and src/App.vue is the composition root for the UI.
- The dist/ output and public/ assets indicate static-site deployment rather than a traditional server-rendered backend.
3. Primary external data boundary
- The main external integration is src/services/ecbApi.ts, which is the repository’s API access layer.
- The README says data comes from the ECB and Eurostat APIs, so the app’s core data flow is:
- UI interaction → store/filter state changes → API/service fetches → normalized domain data → chart/UI rendering.
- This is the main boundary between the app and the outside world.
4. State management layer
- src/stores/bondDataStore.ts and src/stores/filtersStore.ts hold the central application state.
- filtersStore likely tracks user-selected country, maturity, period, and other comparison controls.
- bondDataStore likely caches fetched datasets and derived market data so charts and selectors can share a single source of truth.
- These stores form the hub between data fetching, computed views, and the UI.
5. Derived data and chart configuration
- src/composables/useBondData.ts and src/composables/useChartOptions.ts are the main view-model/computation layer.
- They likely translate raw store data into chart-ready series, labels, formatting, and options.
- This keeps the rendering components simpler and separates “data shaping” from “presentation.”
6. Core UI composition
- src/components/BondChart.vue is the main visualization surface.
- ControlBar.vue, CountrySelector.vue, MaturitySelector.vue, PeriodSelector.vue, and QuickCompare.vue are the interaction controls that drive the dashboard state.
- ThemeToggle.vue provides a UI-level presentation setting rather than data filtering.
- App.vue probably arranges these into the dashboard layout and connects them to the stores.
7. Specialized feature area: AI chat
- src/components/AiChatDock.vue and src/agent.js define a separate assistant/chat subsystem.
- Architecturally, this appears to be an optional overlay or sidecar feature rather than part of the core charting pipeline.
- It should be treated as a secondary interaction path that may query or explain dashboard data, not as the primary data source.
8. Domain model and shared constants
- src/types/bond.ts defines the core financial data structures used across services, stores, and charts.
- src/constants/countries.ts centralizes Eurozone country metadata.
- These shared definitions reduce duplication and keep the dashboard’s comparison logic consistent across components.
9. Reusable UI primitive layer
- src/components/ui/* contains low-level building blocks such as button, command palette, popover, and select components.
- These are infrastructure for the dashboard controls rather than business logic.
- The app’s higher-level selectors and menus are built on top of these primitives, which helps keep the dashboard styling and behavior consistent.
10. Worker and off-main-thread boundary
- src/worker.js and worker-configuration.d.ts indicate a dedicated worker-based execution path.
- This suggests some processing is moved off the main UI thread, likely for data transformation, computation, or another performance-sensitive task.
- For an architecture diagram, this is a useful separate lane from the main Vue render thread.
11. Presentation and static assets
- src/style.css and src/assets provide app-wide styling and local assets.
- index.html is the Vite entry shell, and public/ contains deployment-facing files like robots.txt, sitemap.xml, and _headers.
- These point to a polished static frontend with SEO/hosting configuration baked into the repository.
12. Deployment and hosting signals
- wrangler.jsonc and public/_headers suggest Cloudflare-oriented deployment or edge/static hosting configuration.
- This matters architecturally because the app is designed to be served as a static SPA with edge-friendly headers, not from a custom application server.
13. Testing and validation
- src/eurometrics.test.ts provides a focused test entry point, likely for core calculation or data-shaping behavior.
- This suggests the most important logic to validate is in the data/composable/store layer rather than in network or server code.
14. Mental model for the diagram
- Draw the app as:
- User interaction layer: selectors, chart, theme toggle, AI dock.
- State/logic layer: stores + composables.
- Data access layer: ECB/Eurostat service calls.
- Render layer: chart and UI primitives.
- Auxiliary execution layer: worker.
- External systems: official APIs and static hosting/CDN.
Main entry points: App.vue App.vue · useBondData.ts useBondData · ControlBar.vue ControlBar · filtersStore.ts filtersStore
Components 24
App runtime
Vue/Vite client application and its composition root.
Data and state
External API access, shared state, and derived view-model logic.
- bondDataStore · Shared cache for fetched bond data and derived market state.
src/stores/bondDataStore.ts - filtersStore · Central user-selection state for dashboard filters.
src/stores/filtersStore.ts - useBondData · Shapes store data into chart-ready series and display data.
src/composables/useBondData.ts - useChartOptions · Builds chart options and formatting from domain data.
src/composables/useChartOptions.ts - ecbApi · Fetches official ECB/Eurostat data and normalizes responses.
src/services/ecbApi.ts - bond types · Shared financial data structures and payload shapes.
src/types/bond.ts - countries · Eurozone country metadata used across selectors and comparisons.
src/constants/countries.ts
Dashboard UI
Main visualization surface, controls, and reusable UI primitives.
- BondChart · Primary charting surface for Eurozone comparisons.
src/components/BondChart.vue - ControlBar · Container for the main user filters and actions.
src/components/ControlBar.vue - CountrySelector · Selects countries for comparison.
src/components/CountrySelector.vue - MaturitySelector · Selects bond maturities and related views.
src/components/MaturitySelector.vue - PeriodSelector · Selects the date range or period window.
src/components/PeriodSelector.vue - QuickCompare · Shortcut interactions for fast side-by-side comparisons.
src/components/QuickCompare.vue - ThemeToggle · Toggles presentation theme.
src/components/ThemeToggle.vue - UI primitives · Reusable button, command, popover, and select building blocks.
src/components/ui
Auxiliary paths
Secondary execution and assistant features.
- AiChatDock · Optional chat/assistant overlay for explanations and guidance.
src/components/AiChatDock.vue - agent.js · Chat/agent-side execution path for the assistant feature.
src/agent.js - worker.js · Off-main-thread processing lane for performance-sensitive work.
src/worker.js
Platform
Static entry, hosting, and deployment-facing assets.
- style.css · App-wide styling for the dashboard.
src/style.css - index.html · Vite entry shell for the single-page app.
index.html - public · Deployment-facing files such as headers, robots, and sitemap.
public - wrangler.jsonc · Cloudflare-oriented deployment and edge hosting configuration.
wrangler.jsonc
Connections 32
- main.ts → App.vue: mounts · Bootstraps the Vue application and renders the root component.
- App.vue → ControlBar: composes · Places the primary dashboard controls in the layout.
- App.vue → BondChart: composes · Renders the main visualization surface.
- App.vue → ThemeToggle: composes · Includes presentation settings in the shell.
- ControlBar → CountrySelector: contains · Groups the country comparison selector.
- ControlBar → MaturitySelector: contains · Groups the maturity selector.
- ControlBar → PeriodSelector: contains · Groups the period selector.
- ControlBar → QuickCompare: contains · Groups the fast comparison controls.
- CountrySelector → filtersStore: updates · Changes selected countries in shared filter state.
- MaturitySelector → filtersStore: updates · Changes maturity filter state.
- PeriodSelector → filtersStore: updates · Changes selected time window.
- QuickCompare → filtersStore: updates · Applies comparison presets and shortcuts.
- filtersStore → useBondData: drives · Feeds selected filters into derived data shaping.
- bondDataStore → useBondData: supplies · Provides cached and fetched bond data.
- useBondData → useChartOptions: feeds · Provides chart-ready series and labels.
- useChartOptions → BondChart: configures · Supplies display options to the chart view.
- useBondData → BondChart: renders · Provides transformed data for visualization.
- useBondData → ecbApi: fetches · Requests updated official market and macro data.
- ecbApi → bond types: maps to · Normalizes API responses into shared domain shapes.
- bond types → bondDataStore: shapes · Defines the store's core data model.
- countries → CountrySelector: populates · Supplies country metadata to the selector.
- App.vue → UI primitives: uses · Builds controls from reusable UI primitives.
- CountrySelector → UI primitives: uses · Relies on select and command primitives.
- MaturitySelector → UI primitives: uses · Relies on select primitives.
- PeriodSelector → UI primitives: uses · Relies on select/popover primitives.
- QuickCompare → UI primitives: uses · Relies on button, popover, and command primitives.
- AiChatDock → agent.js: uses · Delegates assistant interactions to the agent path.
- worker.js → useBondData: accelerates · Supports off-main-thread processing for data shaping.
- index.html → main.ts: loads · Entry shell loads the application bootstrap.
- style.css → App.vue: styles · Provides global application styling.
- public → index.html: served by · Deployment-facing static files accompany the SPA shell.
- wrangler.jsonc → public: configures · Sets hosting behavior for static delivery.