How wirtzdan/website works
Main Components
• Frontend UI Layer:
• Pages (located under the pages directory): These include static pages (e.g., about, index, 404) as well as dynamic routes (like [slug] for blog posts).
• Components (in the components folder): Smaller building blocks such as headers, footers, blog cards, navigation components, etc.
• Layouts (in the layouts folder): These provide page structure for sections like blogs, legal pages, newsletters, etc.
• Backend / API Layer:
• API Endpoints (in pages/api): The endpoints (e.g., addSubscriber.js, sendSuggestion.js) that handle server-side logic and integrations.
• Library (in the lib folder):
▪ Integration with Airtable (lib/airtable.js) to serve as the backend for pages like blog, books, and tools.
▪ Notion-related functionality (under lib/notion) to handle additional content or rendering style.
▪ Helper libraries such as lib/rss.js and lib/usePagination.js that support content delivery.
• Data Management:
• Local JSON files (in the data folder) used to store structured data (e.g., experience, interests) that may be used in pages such as the portfolio.
• External Services:
• Airtable: Used as a backend data store.
• Raindrop: Mentioned in the README as a possible integration (and others like Notion APIs).
• Configuration & Static Assets:
• Configuration files (e.g., next.config.js, next-seo.config.js, .env.example) and styling/theme files (theme.js).
• Public assets (static images, favicons, sounds, and the RSS XML) are located under the public folder.
Relationships and Interactions
• The Pages in Next.js serve as entry points that tie the UI components, layouts, and API endpoints together.
• Components are reused across pages to build the UI, and they fetch or display data provided by the API endpoints.
• The API layer (in pages/api) receives requests (triggered by client-side actions) and makes external calls (e.g., to Airtable via the lib/airtable module) to pull or update data.
• The lib directory acts as an abstraction over external integrations (Airtable, Notion, etc.) and provides utilities used by both pages and API endpoints.
• Static assets (public folder) and environmental configuration allow for seamless local development and production deployment.
Architectural Patterns and Design Principles
• Component-Based Architecture: The use of React components and dedicated directories for components/layouts illustrates a strong separation of UI concerns.
• API-First Interaction: The usage of API routes in Next.js to handle backend interactions fits well with modern full-stack Next.js applications.
• External Service Integration: Airtable is used as a simple backend, and its integration is abstracted out in the lib folder.
• Configuration Management: Environment variables (with .env.example and .env.local) separate configuration settings from code.