A secure media management backend with user auth, media metadata management, streaming URLs, view logging, analytics with caching, and rate limiting.
- Users can upload media and generate secure streaming links.
- Tracks who is watching your media, when, and from where.
- Adds performance, security, and production-readiness features.
- User Authentication (Signup/Login with JWT)
- Media Management (Add media metadata, stream URLs)
- View Logging (IP + timestamp)
- Analytics with Redis caching
- Rate Limiting on view logging endpoint
- Automated Tests (Jest)
- Dockerized for easy deployment
- Config via
.env
- MediaAsset:
id,title,type(video/audio),file_url,created_at - AdminUser:
id,email,hashed_password,created_at - MediaViewLog:
media_id,viewed_by_ip,timestamp
POST /auth/signupPOST /auth/login→ returns JWT tokenPOST /media(auth) → add media metadataGET /media/:id/stream-url→ returns secure 10-minute expiring URLPOST /media/:id/view→ log a view (with IP & timestamp), rate limitedGET /media/:id/analytics→ return view stats, cached with Redis
-
Clone repo
-
Copy
.env.exampleto.envand configure -
Build and run with Docker:
docker compose up --build
-
Run tests:
# Example for Node.js (adjust for your stack) npm test
- Streaming URLs are signed and expire after 10 minutes for security.
- Redis caches analytics responses to improve performance.
- Rate limiting protects view logging endpoint from abuse.
- Tests cover auth, media, logging, analytics, and middleware.
Untitled.video.-.Made.with.Clipchamp.7.mp4