How ramilevi1/website-template works
Main Components
• Client Layer: Represent the end-user devices (browsers) which interact with the website.
• Frontend: This includes static assets (HTML, CSS, JavaScript, images) served under the “static” and “templates” directories. The frontend is responsible for rendering the pages (e.g., index.html, blog.html, sign-in.html) and interacting with the backend via Ajax.
• Backend (Flask Application): The heart of the project, represented by app.py and other supporting modules like models.py, database.py, and migrations. This is where business logic, routing, user authentication, and REST API endpoints reside.
• Database: The SQLite databases (site.db in the project root, the “db” and “instance” directories) are managed via Flask’s SQLAlchemy and migrate scripts. This layer is crucial for user data, blog posts, newsletter subscribers, etc.
• Microservice Candidates/Future Services: Although currently all integrated, plan placeholders (or separate components) for:
• Newsletter Service: Indicated by newletterScript.py, which handles scheduled sending of newsletters.
• Blog Parsing Service: Handled via parse_blogs.py, dedicated to dynamically parsing blog content.
• Future Microservices for offerRide and searchRide: Mark these for later separation.
• Testing and CI/CD: Inclusion of the “my_playwright_tests” directory (e2e tests) and other unit tests (test_app.py, test_config.py) shows there is a testing framework. Also, GitHub Actions workflows (.github/workflows) tie into continuous integration setups.
Relationships and Data Flow
• Web clients issue HTTP/HTTPS requests to the Flask application.
• The Flask application serves dynamic pages by combining routes/components defined in app.py and templates.
• For authentication, the backend interacts with a user and session management mechanism.
• The Flask app interacts with the SQLite databases to persist user, blog, and newsletter data.
• Background processes (like newsletter dispatch and blog parsing) operate either directly or via asynchronous job queues (future RabbitMQ integration).
Architectural Patterns and Design Principles
• MVC (or “MVT” in Flask terminology): View templates in the “templates” folder, static frontend assets, and controllers in the Flask app.
• Separation of Concerns: Distinct modules for handling database interactions (models.py, database.py), migrations for database schema evolution (migrations folder), and frontend assets (static folder).
• Planned Microservices: Although not fully decoupled, the design anticipates an N-tier/microservices split, where authentication, content rendering, email handling, and possibly blog search functionalities could be split into distinct services.
Relevant Technologies
• Flask for the backend, with Flask extensions (Flask-Login, Flask-Migrate, Flask-Mail, etc.).
• SQLite3 as the database.
• HTML5, CSS3, JavaScript (vanilla and jQuery) for the frontend.
• Bootstrap and MixItUp for styling and interactive elements.
• Playwright for basic end-to-end tests.
• Future plans involving RabbitMQ, MongoDB, containerization techniques, and deployment options like uWSGI with Nginx/Apache should be noted.