How jethliya-balaji/billing-system works
Project Type and Purpose
• This is a full‑stack, monolithic web application: a “Billing System” built on Django (Python) for the backend and server‑side rendering, with Tailwind CSS + DaisyUI for styling and HTMX (plus jQuery/Select2) for dynamic front‑end behavior. It provides bill/product management, a sales dashboard, authentication/authorization, and real‑time UI updates.
File Structure
• Top‑level: manage.py, package.json, requirements.txt, tailwind.config.js
• src/core: Django project settings, URL routing (asgi.py, wsgi.py, settings.py, core/urls.py)
• src/billing: Main Django app (models.py, views.py, forms.py, filters.py, admin.py, urls.py), migrations, management/commands
• src/templates: HTML templates organized by app (billing), plus global 403/404
• src/static: Compiled CSS/JS, Tailwind source, HTMX, Select2 integration
• Configuration: .env for secrets, .gitignore, package-lock, pip/ npm lockfiles
README for Stack and Architecture Notes
• Backend: Django 4.2, SQLite
• Frontend: Tailwind CSS 3.4 + DaisyUI, HTMX 1.18, jQuery 3.7 + Select2
• Features: SSR templates with partial updates via HTMX, role‑based auth, responsive light/dark themes
Main Components
a. Client (Web Browser)
• UI Layer: HTML templates + CSS (Tailwind/DaisyUI) + JS (HTMX, jQuery/Select2)
• User interactions: form submissions, HTMX requests for partial updates
b. Web Server (Django Application)
• ASGI/WSGI entrypoint (asgi.py, wsgi.py)
• URL Dispatcher (core/urls.py → billing/urls.py)
• View Layer (views.py): handles HTTP/HTMX requests, applies business logic
• Form/Filter Layer (forms.py, filters.py)
• Admin Interface (admin.py)
c. Persistence Layer
• Models (models.py) → Django ORM → SQLite database
• Migrations (migrations/0001_initial.py)
d. Background/Management Processes
• Custom management command (delete_empty_bills.py)
e. External/Third‑Party Libraries
• Tailwind, DaisyUI (CSS styling pipeline via npm & tailwind.config.js)
• HTMX, jQuery, Select2 (dynamic front‑end)
Relationships & Data Flows
• Browser → HTTP/HTMX requests → Django URL router → appropriate view
• View → ORM queries → SQLite → returns data → render template or JSON fragment
• Rendered HTML → sent back → HTMX swaps partial or full page
• Static files (CSS/JS) served from /static/ via Django staticfiles or CDN
• Admin users → Django admin interface (URL /admin/) → manage products/bills
• Management commands → interact directly with Django ORM
Architectural Patterns & Design Principles
• MVC / MTV pattern (Models, Templates, Views)
• Server-side rendering with progressive enhancement via HTMX
• Separation of concerns: templates vs. business logic vs. data models
• Role‑based access control using Django’s auth system
• Responsive design & theme persistence via localStorage