How vietnguyen2358/rankrealm works
Project type and purpose
• This is a monolithic, full-stack web application built with Flask (Python).
• It provides user authentication, event and leaderboard management, and user profiles (as seen in templates and models).
File structure
• main.py: the Flask app entry point.
• website/
• auth.py – authentication logic (Flask-Login + bcrypt)
• models.py – data schema definitions via SQLAlchemy
• views.py – HTTP route handlers (controllers)
• static/ – CSS, JavaScript, images (client assets)
• templates/ – Jinja2 templates (HTML views)
README
• Confirms Flask, Flask-SQLAlchemy, Flask-Login, bcrypt are core dependencies.
• Instructs how to launch the site via flask --app main run.
Main components
a. Client / Browser (front-end user interface)
b. Flask Application Server (main.py + website package)
• Controllers (views.py)
• Business logic (auth.py, any service modules)
• ORM layer (models.py)
c. Database (e.g., SQLite or other DB used via SQLAlchemy)
d. Static asset store (served by Flask’s static route)
e. External libraries/services
• Flask, Flask-SQLAlchemy, Flask-Login, bcrypt
Relationships & interactions
• Browser → HTTP(S) requests → Flask server
• Flask server routes requests to controllers (views.py)
• Controllers invoke authentication modules (auth.py) and ORM models (models.py)
• ORM communicates with the Database
• Controllers render Jinja templates, injecting data from models
• Static assets (CSS, JS, images) are served directly by Flask’s static endpoint
Architectural patterns & design principles
• Monolith with MVC-like separation:
• Models = website/models.py
• Views = website/templates + static
• Controllers = website/views.py + auth.py
• Dependency inversion: external libraries abstracted (SQLAlchemy for DB, Flask-Login for sessions)
• Single process for all components (no microservices)