How raflibangsawan/sipeta-api-dev works
Main Components
• Client Layer: Show external clients (web browsers, API clients, mobile apps) that connect over HTTP/HTTPS.
• Web Server / Reverse Proxy: In production one would typically have a reverse proxy (like Nginx) to handle incoming requests and static assets though this might not be explicitly in the file tree. It may be noted as a “deployment artifact.”
• Application Server: Represent the Django application. Highlight the “config” folder (which holds URL routing, settings across various environments, and the WSGI entry point) as the core entry point for request handling.
• Django Apps: Break down the monolithic backend into its modular apps (users, proposal, semester, topik, pengumuman, etc.). Each of these can be visualized as individual components handling specific domain logic.
• Database Layer: Indicate a PostgreSQL database (as referenced by the instructions for starting a PostgreSQL server) that stores all the persistent data.
• Caching Layer: Include a cache system if applicable (as indicated by the “create cache table” command). Use a component for the caching mechanism.
• Utility & Configuration Services: Represent the utility scripts (for installing OS and Python dependencies) and settings management (with separate configurations for local, production, and test).
Specify Relationships and Interactions
• From the entry point, show the URL router (from “config/urls.py” and “config/api_router.py”) directing requests to various Django apps.
• For each Django app (e.g., “users”, “proposal”, etc.), indicate the internal MVC flow – the view layer processing the HTTP requests, models interacting with the database, and serializers/forms used for data validation and representation.
• Optionally, illustrate that static assets (from “sipeta_backend/static” and “templates”) are served either through Django in development or via a dedicated static server/load balancer in production.
Important Architectural Patterns
• Django’s MVC/MVT pattern where routing (URLs), business logic (views), and data access (models) are distinct.
• Point out the modular decomposition of the application into multiple self-contained apps. This separation of concerns aids maintainability and scalability.
• Mention the use of environment-specific settings stored in “config/settings” (Base, Local, Production, Test), which shows adherence to the principle of configuration decoupling.
• That pre-commit hooks, linting (using pylint and black), type checks (with mypy), and tests (pytest and coverage) are part of the development process but are not actively part of the runtime architecture.