How therealstone-dev/oilskinofficialrepo works
Purpose and Runtime
Oil Skin is a server-rendered Python e-commerce application for skincare products. It runs from app.py, requires a Python virtual environment and packages in requirements.txt, and connects to MySQL through MYSQL_HOST, MYSQL_USER, MYSQL_PASSWORD, and MYSQL_DB.
Application Composition
The application is organized as route/controller modules, model-based database access, Jinja templates, and a billing service:
• Startup and likely Flask application/blueprint registration: app.py, src/routes/__init__.py
• Database connection boundary: src/database/db_mysql.py
• Domain persistence layer: src/models/ModeloProductos.py, src/models/ModeloPedido.py, src/models/ModeloUsuario.py
Public Storefront Flow
Public-facing routes serve the catalog, category listings, product detail, cart, checkout, and informational pages. Requests pass from route modules to product/category/cart/order models and render Jinja pages:
• Route boundary: src/routes/main_routes.py, src/routes/user_routes.py
• Storefront views: src/templates/index.jinja, src/templates/category.jinja, src/templates/detalle.jinja
• Purchase views: src/templates/carrito.jinja, src/templates/checkout.jinja
Authentication and Customer Accounts
Authentication is separated into dedicated routes, form definitions, and authorization utilities. Registered users access profile-oriented cart, checkout, and order-history views.
• Auth entry points: src/routes/auth_routes.py, src/forms/auth_forms.py
• Access-control helpers: src/utils/auth_utils.py
• User and cart persistence: src/models/ModeloUsuario.py, src/models/ModeloCarrito.py
• Account UI: src/templates/profile/profile.html, src/templates/profile/profile-pedidos.html
Order, Checkout, and Invoicing Boundary
Checkout converts cart and customer state into orders managed by the order model. Invoicing is isolated as a service, producing invoice-oriented rendering paths rather than being embedded directly in route/template code.
• Order/cart domain: src/models/ModeloPedido.py, src/models/ModeloCarrito.py
• Invoice service: src/services/facturacion_service.py
• Invoice output: src/templates/factura.html, src/templates/ver_factura.html
Administration and Reporting
Administrative routes operate separately from the public storefront and expose inventory, sales, user, and metric dashboards. The admin model and dedicated SQL views indicate reporting is substantially database-driven.
• Admin boundary: src/routes/admin_routes.py, src/models/ModeloAdmin.py
• Dashboard views: src/templates/admin/dashboard_inventario.html, src/templates/admin/dashboard_ventas.html
• Reporting SQL: database/vistas_admin.sql, database/vistas.sql
Database and Presentation Infrastructure
MySQL is the primary persistence and reporting platform. Database schema, queries, and views are versioned as SQL artifacts. Jinja uses shared Bootstrap and Tailwind layout/component families; static assets support both.
• Database artifacts: database/defiv.sql, database/queries.sql, database/vistas.sql
• Shared presentation shells: src/templates/components/boostrap/layout_boostrap.jinja, src/templates/components/tailwind/layout.jinja
• Styling infrastructure: package.json, tailwind.config.js, src/static/css/style.css
Main entry points: db_mysql.py MySQL connection · __init__.py Route registry · user_routes.py Customer routes · auth_routes.py Auth routes
Components 22
Application Runtime
- Flask startup · Creates the application and registers routes.
app.py - Route registry
src/routes/__init__.py
Storefront & Accounts
- Storefront routes
src/routes/main_routes.py - Customer routes · Handles customer-facing cart and checkout pages.
src/routes/user_routes.py - Auth routes
src/routes/auth_routes.py - Auth forms
src/forms/auth_forms.py - Access control
src/utils/auth_utils.py - Catalog views · Catalog, category, and product-detail pages.
src/templates/index.jinja - Cart & checkout views
src/templates/carrito.jinja - Account views · Profile and order-history pages.
src/templates/profile/profile.html
Domain & Billing
- Product catalog
src/models/ModeloProductos.py - Customer accounts
src/models/ModeloUsuario.py - Shopping carts
src/models/ModeloCarrito.py - Orders
src/models/ModeloPedido.py - Invoicing service · Produces invoice-oriented output from orders.
src/services/facturacion_service.py - Invoice views
src/templates/factura.html
Administration
- Admin routes
src/routes/admin_routes.py - Admin reporting
src/models/ModeloAdmin.py - Admin dashboards · Inventory and sales dashboards.
src/templates/admin/dashboard_inventario.html
Data & Presentation
- MySQL connection · Connects using MYSQL environment settings.
src/database/db_mysql.py - Schema & reporting SQL · Versioned schema, queries, and reporting views.
database/defiv.sql - Shared layouts · Bootstrap and Tailwind presentation shells.
src/templates/components/boostrap/layout_boostrap.jinja
Connections 27
- Flask startup → Route registry: loads
- Route registry → Storefront routes: registers
- Route registry → Customer routes: registers
- Route registry → Auth routes: registers
- Route registry → Admin routes: registers
- Storefront routes → Product catalog: reads catalog
- Storefront routes → Catalog views: renders
- Customer routes → Shopping carts: manages
- Customer routes → Orders: creates orders
- Customer routes → Cart & checkout views: renders
- Auth routes → Auth forms: validates
- Auth routes → Access control: uses
- Auth routes → Customer accounts: authenticates
- Customer routes → Account views: renders
- Orders → Invoicing service: supplies order data
- Invoicing service → Invoice views: renders
- Admin routes → Admin reporting: queries
- Admin routes → Admin dashboards: renders
- Product catalog → MySQL connection: persists to
- Customer accounts → MySQL connection: persists to
- Shopping carts → MySQL connection: persists to
- Orders → MySQL connection: persists to
- Admin reporting → MySQL connection: reads reports
- Schema & reporting SQL → MySQL connection: defines schema and views
- Catalog views → Shared layouts: extends
- Cart & checkout views → Shared layouts: extends
- Admin dashboards → Shared layouts: extends