How informed-governance-project/nisinp works
Project type and purpose
• NISINP is a full-stack, multi-tenant Django application serving as an Incident Notification Platform for national regulators and Operators of Essential Services (energy, transport, etc.) under NIS 2 regulations.
• It provides web UIs (HTML templates + static JS/CSS), an administrative interface, REST/OpenAPI endpoints, scheduled/background tasks, email notifications, PDF generation, and multi-language support.
File structure
• Top-level orchestration:
• docker/ & .github/workflows/ → Docker‐based CI, container builds, docker-compose examples
• celery_worker.py, celery_beat.py → entry points for Celery workers & scheduler
• manage.py, governanceplatform/, incidents/ → core Django project and two main Django apps
• governanceplatform/:
• Core models, middleware, settings, URLs, forms, custom auth backend, signals, management commands, tasks
• Migrations for database schema
• incidents/:
• Models, views, templates, PDF generation, email helpers, tasks, scripts, migrations
• docs/:
• Architecture and OpenAPI spec (openapi.yml), global‐architecture.odg
• static/ & templates/:
• Frontend assets (JS, CSS) and HTML templates (home, admin, widgets)
• Configuration:
• pyproject.toml, package.json / package-lock.json (front-end deps), pytest.ini, .pre-commit-config.yaml
• docker-compose.example.yml, Dockerfile, Apache2 sample config
README for additional insights
• Confirms it is part of a larger platform (NC3-LU), uses Django, Celery, OpenAPI, multi-regulations support.
• Points to online documentation (readthedocs) and architecture doc in docs/_static/global‐architecture.odg.
Main components
a. Presentation Layer
• Web Browser (users & regulators)
• Static Assets (served by NGINX or Apache)
• HTML Templates (Django)
b. Application Layer
• Web Server / Reverse Proxy (NGINX or Apache2)
• WSGI Server (Gunicorn or uWSGI) hosting Django
• ASGI Server (for async endpoints if any)
• Django Core (governanceplatform app + incidents app)
c. Data Layer
• Relational Database (PostgreSQL or MariaDB)
• Redis/RabbitMQ (Celery broker + result backend)
• File Store (for generated PDFs, user uploads)
d. Background & Scheduling
• Celery Worker (+ concurrency pool)
• Celery Beat Scheduler (periodic tasks)
e. External Services
• Email SMTP Server (for incident notifications & reminders)
• Optional third-party APIs (e.g., regulatory reference data)
f. Development/CI
• GitHub Actions (CI pipelines)
• Docker (local dev & prod containers)
• Management CLI (manage.py, custom commands)
Relationships and data flows
• User → NGINX/Apache → Gunicorn → Django views → Database
• Django → Celery Broker → Celery Worker → tasks → Database / Email / PDF store
• Celery Beat → Broker → Worker (periodic jobs)
• Django → SMTP (send emails)
• Browser ← Static assets served by NGINX or Django static files app
• GitHub Actions → build/test Docker images → push to GHCR
Architectural patterns and design principles
• Layered architecture: Presentation, Application, Data
• Modular Django apps (governanceplatform vs incidents)
• Separation of concerns: web vs background tasks via Celery
• 12-factor app principles: config via environment, containerized deployment
• Internationalization (i18n) and template-based UI
• API-first mindset: OpenAPI spec in docs/_static