How certunlp/ngen works
Project type and purpose
• This is a full-stack Incident Response Management System (Ngen) for CSIRTs.
• The backend is a Django REST API with Celery for background tasks and integrates with external tools (IntelMQ, Cortex, Kintun, MISP).
• The frontend is a React/Vite SPA served via Nginx.
• Docker Compose orchestrates the environment (development and production), including the DB, message broker, Django, Celery, React, and Nginx.
File structure
• Top-level folders:
• docker/ – Dockerfiles, compose files, env templates, entrypoints
• frontend/ – React/Vite app, assets, components, services, build configs
• ngen/ & project/ – Django app code, models, serializers, views, URLs, settings, Celery, mailer
• manage.py, requirements.txt – Django entry point and dependencies
• Patterns:
• Separate frontend and backend projects
• Monolithic Django app employing MVC (models, serializers/controllers, views)
• Celery for asynchronous tasks
• Configuration files: docker-compose.yml, Dockerfile.prod/dev, nginx templates, .env files
Key points from the README
• Production and development ports (443 vs 3000/8000)
• Default credentials, environment variable requirements
• Integration points: IntelMQ, Cortex, Kintun, MISP
• Emphasis on containerized deployment and environment segregation
Main components
a. Frontend Layer
• User’s browser
• Nginx (serving the React SPA)
• React/Vite application
• API client module (axios + token interceptors)
b. API Layer
• Nginx (reverse proxy for /api) → Gunicorn/Uvicorn
• Django REST Framework endpoints (ngen/views)
• Authentication & permissions middleware
c. Data Layer
• PostgreSQL (or configured SQL database)
• Django ORM (models in ngen/models)
• Fixtures for initial data
d. Asynchronous Processing
• Message broker (Redis or RabbitMQ)
• Celery workers (ngen/tasks.py, services)
e. External Services
• SMTP server (EMAIL_HOST)
• IntelMQ, Cortex, Kintun, MISP (via ngen/mailer & ngen/services)
f. Storage & Reporting
• Local/static file storage (attachments, artifacts)
• Report templates (Django templates for PDF/HTML)
Relationships and interactions
• Browser → Nginx(frontend) → React SPA → API calls → Nginx(API) → Gunicorn → Django views
• Django views ↔ Django ORM ↔ PostgreSQL
• Long-running tasks or integrations → Celery via message broker → external tools → DB updates
• Django email module → SMTP
• Static assets and uploaded files served via Nginx or Django’s static handler
Architectural patterns & design principles
• Three-tier architecture: Presentation (React), Business logic (Django), Persistence (Postgres)
• API-first design with RESTful endpoints and token-based auth
• Layered separation: web server, application server, worker pool
• Containerized micro-services style (each major process in its own container)
Technologies, frameworks, and libraries
• Frontend: React, Vite, Redux/store, axios, i18next, SCSS, React Router
• Backend: Django, Django REST Framework, Celery, Gunicorn, django-cortex, django-misp, Redis/RabbitMQ, PostgreSQL
• Infrastructure: Docker, Docker Compose, Nginx, SSL certificates
• CI/CD: GitHub Actions (frontend-dev.yml, backend-dev.yml, push-tag.yml)
Essential details without over-splitting
• Docker container as a high-level component
• Only the major external services, not every individual API service file