How etoosamoe/eto-app works
Project Type and Purpose
• This is a full-stack web application designed as a learning tool to hone programming and DevOps skills. It comprises a Python-based backend API (using FastAPI, SQLAlchemy, and Pydantic), a React-based frontend, and a default local SQLite database (with options to configure alternative databases). The project also includes containerization (via Docker and docker-compose) and Kubernetes manifests, showing a multi-environment, multi-deployment approach.
Analyzing the File Structure
• Top-level key directories:
– backend: Contains the API code, models, database connections, environment configurations, and sample dataset files.
– frontend: Contains the React app source code, Docker configuration for a multi-stage build (where Nginx serves the built static files and proxies API calls to the backend), and environment configurations.
– k8s: YAML manifests for Kubernetes deployments, including backend, frontend, Postgres database, namespaces, and secrets.
– Other files such as docker-compose.yml, .env.example files, and CI/CD configurations under .github indicate that container orchestration and continuous integration are also integral parts.
Components
a. Main Components:
• Frontend Component:
• Built with NodeJS and React.
• Uses a multi-stage Docker build resulting in an Nginx container that serves static files.
• Proxies API requests (e.g., /api/servers, /api/docs, /api/version) to the backend.
• Backend API Component:
• Written in Python with FastAPI.
• Implements CRUD operations, healthchecks (/healthcheck), and special endpoints (e.g., /flaky).
• Uses SQLAlchemy and Pydantic for data models and schema validation.
• Connects to a database (default SQLite inside the container, configurable via environment variables for other DB options).
• Database:
• Default configuration uses a local SQLite file (ephemeral when using containers), but Kubernetes manifests indicate support for PostgreSQL.
• Container/Orchestration Layer:
• Docker & docker-compose: For running backend and frontend containers locally.
• Kubernetes (and even Helm in progress): For production or scalable deployments (containers for frontend, backend, and a DB service).
b. Relationships and Interactions:
c. Architectural Patterns & Design Principles:
• Separation of concerns: clear delineation between frontend (presentation layer) and backend (API and business logic).
• Containerization: Each component (frontend, backend, and optionally the database) is containerized and independently deployable.
• API Gateway/Reverse Proxy: Nginx in the frontend container is used to help route requests appropriately.
• Environment-based configuration: Use of .env files to manage different configurations for local, Docker, and Kubernetes deployments.
d. Relevant Technologies & Frameworks:
• Backend: Python, FastAPI, SQLAlchemy, Pydantic, Uvicorn.
• Frontend: NodeJS, React, Nginx.
• Database: SQLite (default) and alternatives like PostgreSQL (supported in Kubernetes).
• DevOps/Deployment: Docker, docker-compose, Kubernetes, GitHub Actions for CI.