How 42dotmk/klimentohridski works
Main Components
• Frontend (Astro): All files under the “astro” directory form the presentation layer. This includes:
– The “src” folder with “pages” (routing for different sections such as blog, services, contact, etc.), “components” (reusable UI blocks like Hero, Button, Navigation, Footer, etc.), and utility functions.
– Styling files (global.css) and configuration files (astro.config.mjs, tailwind.config.mjs, tsconfig.json).
• Backend / Headless CMS (Strapi): All files under the “strapi” folder provide the backend API and content management:
– “src/api” contains different APIs (for “blog”, “page”, “service”, “post”, “contact-information”, “text”, “image”), each with content types, controllers, services, and routes.
– Configuration files (config directory) for the admin panel, database, plugins, server settings, and middlewares.
– Supporting files for migrations, environment settings (.env), and deployment (data-export tarball).
• Database: Although not explicitly visible as a technical component, the Strapi configuration and migrations imply a backend database. (It could be PostgreSQL, MySQL, or SQLite based on your Strapi setup but is abstracted out here.)
• External Services/Environments: The Astro code references a “STRAPI_URL” (configured in an .env file) that establishes connectivity between the frontend and the backend CMS. This interaction is central to the application’s headless CMS model.
Relationships and Interactions
• The Astro Frontend fetches content from the Strapi backend via HTTP API calls (using the STRAPI_URL environment variable).
• The UI layer renders pages and components based on dynamic content retrieved from Strapi.
• Within Strapi, various API endpoints (organized under folders like “blog”, “page”, “service”, etc.) serve as the gateways between the underlying database and the frontend.
• Strapi also handles administrative and content management tasks (including data import with the provided tarball, admin account creation, etc.).
Architectural Patterns and Design Principles
• Separation of Concerns: A clear split between the frontend (presentation layer using Astro) and backend (content management using Strapi).
• Headless CMS Integration: The backend serves as a headless CMS where content management operations are decoupled from content presentation.
• Modular Design: Both folders are organized in a modular fashion. In Astro, components and pages are clearly separated, and in Strapi, the API endpoints follow a standardized structure (controllers, routes, services, and content-types) that often follows common REST or MVC-like principles.
• Environment Configuration: Utilizing .env to manage different endpoints ensures flexibility and security.
Relevant Technologies, Frameworks, and Libraries
• Astro: A modern static site generator for building fast, content-focused frontends.
• Strapi: The headless CMS powering the backend and providing an API for content.
• Tailwind CSS: Referenced by the tailwind.config.mjs and global.css, for styling the Astro frontend.
• TypeScript: Visible via tsconfig.json and type declarations, ensuring type safety across both projects.
• Node.js and npm: Both the Astro and Strapi projects are built upon Node.js, with dependencies managed via npm.
• Any additional libraries or utilities inside the “src/lib” and “src/util” directories within Astro which help manage content and utility tasks.