How thehopetechteam/conf-webapi works
Main Components
• Django Web Server & Application Core: The main entry point is manage.py with the configuration files (e.g., portal/config.py, configurations for dev and production), WSGI/asgi files (portal/wsgi.py, portal/asgi.py) and the Gunicorn configuration (gunicorn_conf.py). This represents the core of the backend.
• Modular Django Apps: Under portal/apps, you have multiple apps such as:
• Account: Handles user accounts and authentication with its own models, views, admin, and management commands.
• Conference: Manages conference-related functionalities.
• Event_Info, FAQ, FCM_Device, Feedback, Home, Instructor, Language, Location, Notification, Search, Testimony, Ticket, Workshop: Each of these represent a specific domain with their models, migrations, views, and even custom integrations (like wagtail_hooks in some apps for Wagtail CMS integration).
• Request Routing and API Layers: The project contains clear routing through portal/urls.py and separated API endpoints under portal/routers/apis/v1. This layer maps incoming HTTP requests to the appropriate handlers.
• Middleware and Handlers: Custom middlewares (in portal/middlewares) intercept and process requests (e.g., custom HTTP handling) and domain-specific business logic is defined in portal/handlers (for account management, conference logic, feedback, etc.).
• Libraries and Shared Utilities: There are shared libraries (portal/libs) covering authentication, logging, context management, database connections (including an asynchronous redis client), and utility functions that support cross-cutting concerns.
• External Integrations: The providers directory, for example with Firebase integrations, signals external service communication. Additionally, the project uses Docker for containerization (Dockerfile) and has CI/CD workflows configured in .github/workflows.
Relationships and Data Flow
• Incoming HTTP requests (from client apps or a front-end) are received by the Django server running via Gunicorn or another WSGI/ASGI server.
• Requests pass through a series of middlewares (portal/middlewares) which may perform tasks such as authentication, logging, or custom request handling.
• The Django URL router (portal/urls.py along with portal/routers) then dispatches the requests to the appropriate Django app’s views.
• Inside each Django app, views interact with models and, where applicable, invoke custom handlers (in portal/handlers) to process business logic.
• After processing, responses are serialized (using serializers in portal/serializers) and sent back to the client.
• Database operations are coordinated through Django’s ORM with migrations maintained per app.
• External system integrations (such as Firebase authentication and notifications) are managed within the providers and libs directories.
Architectural Patterns and Design Principles
• Modular Architecture: Each domain area (account, conference, ticket, etc.) is separated into its own Django app. This separation encourages maintainability and clarity.
• Layered Design: The project clearly distinguishes between routing (urls/routers), business logic (views/handlers), data access (models/migrations), and auxiliary services (media, static files, utilities in libs).
• Extensibility: The existence of directories for plugins (wagtail_hooks in several apps) and extra modular libraries indicates that the system was designed with extensibility in mind.
• Configuration Management & CI/CD: Distinct configuration files for different environments (portal/configs) and automation scripts (GitHub workflows, Dockerfile) ensure smooth deployment pipelines.
Suggested Components
• Client/External Requests: Frontend web/mobile which makes API calls.
• Web Server: Gunicorn (using the entrypoint script and managing via Docker).
• Django Framework Core: Represented by manage.py, configuration files, and WSGI/ASGI handlers.
• Middleware Layer: Custom middlewares handling HTTP requests.
• API & Routing Layer: Including URL routers (portal/urls.py, portal/routers/apis/v1) dispatching requests.
• Shared Libs and Utilities: Common libraries (authentication, logging, shared utilities) that support multiple apps.
• External Services: Firebase integration (under portal/providers/firebase), caching (aio_redis in portal/libs/database), and any additional third-party services.
• CI/CD and Deployment Infrastructure: Dockerfile, GitHub Actions workflows.
• Data Storage: Implicit database layer (managed by Django ORM and migrations).