FMS (Factory Management System) backend image. Includes API, WebSocket and OAuth2 integration.
4.3K
High-performance, asynchronous Django 5 REST API & WebSocket backend powering the Factory Management System (FMS). Built with Django REST Framework, Django Channels, Redis caching/channel layer, and Google OAuth2.
The backend is composed of domain-driven Django applications:
main: User management, custom authentication, role-based permissions (Admin, Manager, Supervisor).core: Organization structure, departments, and workshop locations.labor: Employee skill matrix, work shifts, and labor tracking.project: Project lifecycles, milestone tracking, and task assignments.product: Product catalogs, manufacturing processes, and BOM (Bill of Materials).inventory: Suppliers, raw materials, stock levels, and consumption tracking.production: Production lines, machine states, and manufacturing schedules.CustomSocialAccountAdapter extending django-allauth. Automatic signup is disabled (SOCIALACCOUNT_AUTO_SIGNUP = False). Only existing system users with matching Google emails are allowed access; unauthenticated attempts return HTTP 403 with administrator instructions.rest_framework_simplejwt & dj-rest-auth.
ROTATE_REFRESH_TOKENS = TrueTOKEN_BLACKLIST_ENABLED = True/api/token/, /api/token/refresh/, /api/token/blacklist/, /api/rest-auth/google/.ProtocolTypeRouter (backend.asgi.application) combining HTTP and WebSocket protocols.JWTAuthMiddleware and ConsumerBlock validate SimpleJWT access tokens upon initial WebSocket handshake connection.channels_redis.core.RedisChannelLayer for scalable multi-node message broadcasting.check_object_permission) on WebSocket message payloads before sending updates to connected clients.create_model_change_signal listening on post_save and post_delete model signals.created, updated, deleted) using DRF serializers.async_to_sync) over Redis Channel Layer groups directly to active frontend WebSocket listeners.Configured using django-redis with ZlibCompressor compression and JSONSerializer:
redis://.../1):
KEY_PREFIX: fms).IGNORE_EXCEPTIONS = True ensures graceful fallback to standard database queries if Redis is offline.redis://.../2):
SESSION_ENGINE = "django.contrib.sessions.backends.cache"KEY_PREFIX: fms-session).django_prometheus middleware exposing Prometheus metrics at /metrics./api/health/ handled by HealthCheckMiddleware (bypasses ALLOWED_HOSTS for Kubernetes / Docker compose probes).RequestTimeLoggingMiddleware records execution latency in JSON format to /app/logs/ and outputs colorized rich console logs during development.| Variable | Description | Default |
|---|---|---|
SECRET_KEY | Django application secret key | Required |
DEBUG | Enable debug mode | False |
ALLOWED_HOSTS | Comma-separated allowed hostnames | localhost,127.0.0.1 |
DATABASE_ENGINE | Database driver (postgresql_psycopg2 / sqlite3) | sqlite3 |
REDIS_HOST | Redis cache hostname | 127.0.0.1 |
REDIS_PORT | Redis cache port | 6379 |
GOOGLE_CLIENT_ID | OAuth2 Google Client ID | Required for auth |
GOOGLE_CLIENT_SECRET | OAuth2 Google Client Secret | Required for auth |
CORS_ORIGINS | Allowed frontend CORS domains | http://localhost:3000 |
Content type
Image
Digest
sha256:1191ddbc1…
Size
52 MB
Last updated
11 days ago
docker pull lecroissant2003/fms-backend