How bgrusnak/stravidom-boilerplate works
Project Type and Purpose
• This is a full-stack web application environment that integrates multiple services. It features a Strapi-based backend (including an admin UI), a Vue3/Ionic frontend, a Telegraf-powered Telegram bot, and supporting services (PostgreSQL for the database, Redis for messaging, and Nginx for reverse proxy and SSL termination).
• Its primary goal is to offer an easy-to-develop and deploy environment for small-to-medium full-stack applications, with an emphasis on containerization (Docker/Docker Compose) and environment configuration.
Analyzing the File Structure
• Top-level Directories: You have separate directories for the backend, frontend, and bot. Additionally, you see configuration directories like "conf" (with Nginx configurations), "docker" (with Dockerfiles for development and production for each service), "cert" for SSL certificates, and shared configuration files (e.g. .env.example, docker-compose.yml).
• Backend: Contains multiple subdirectories including configuration files (admin.ts, database.ts, server.ts), API definitions (for example, the "terms" API), Strapi-specific files, and custom plugins (for instance, the "tgauth" plugin).
• Frontend: Contains Vue components, a Vite configuration, theme files and an API service.
• Bot: Contains a Node.js-based Telegram bot solution using Telegraf, with actions, server entry points, and utilities.
• Additional folders and files, such as those within "docker" and "conf", indicate that containerization, reverse proxy handling and certificate management are core concerns.
Guidance
a. Main System Components:
• Frontend: Vue3/Ionic application responsible for the user interface. It communicates with the backend via defined API endpoints.
• Backend (Strapi): The Strapi application acts as both an API server and an admin panel. It handles content management (including sample content types like Article, Terms, etc.), and integrates custom plugins (for instance, tgauth for Telegram authentication).
• Bot: The Telegraf-based Telegram bot that registers users and potentially drives other notifications or interactions via Telegram.
• Database: A PostgreSQL instance used by the backend (and possibly by the bot) for storing application data.
• Redis: Serves as a message broker and caching layer.
• Nginx Reverse Proxy: Manages HTTPS/SSL termination and routes incoming external requests to the appropriate service (frontend, backend, bot endpoints).
• Docker Infrastructure: Docker and Docker Compose orchestrate container deployment. Each component (backend, frontend, bot, nginx, database, and redis) runs in its own container (with separate Dockerfiles for development and production).
b. Relationships and Data Flow:
• The Frontend communicates with the Backend via RESTful API calls over secure routes through the Nginx reverse proxy.
• The Backend (Strapi) interacts with the Database (PostgreSQL) for content and user management, and may also interact with Redis if caching or messaging is involved.
• The Bot, running as a separate service, communicates either directly with the Backend or the Database, and interacts with the Telegram API.
• Nginx is positioned as the first point of contact: it routes external HTTPS requests to either the Frontend or the Backend based on URL paths and proxy settings, ensuring secure communication.
c. Architectural Patterns and Design Principles:
• Containerization: Each service is encapsulated in its own container following best practices (separate Dockerfiles for production vs. development).
• Microservices Elements: Even though it is a single repository, the services (frontend, backend, bot) operate nearly independently and communicate through well-defined interfaces.
• Use of Infrastructure Layers: Reverse proxy (Nginx) for security and SSL, environment configuration management for deploying across environments.
d. Technologies, Frameworks, and Libraries:
• Backend: Strapi v4, Node.js (v18-alpine), Yarn.
• Frontend: Vue3, Ionic, Vite, Typescript.
• Bot: Telegraf, Node.js (v16.10.0-alpine).
• Database: PostgreSQL (v15-alpine).
• Message Broker: Redis (v7.2.3-alpine).
• Reverse Proxy: Nginx.
• Containerization: Docker, Docker Compose.
Final Implementation
• External integrations such as SSL certificate management (cert folder) and how Docker Compose manages these containerized services.
• To capture the multiple Docker environments: drawing separate but similar blocks for production and development deployment scenarios may be useful if relevant details are necessary.