A secure video streaming service built with Go that provides encrypted video storage and streaming capabilities.
- User authentication with JWT
- Role-based access control (Admin/User)
- Secure video upload with AES-256 encryption
- Video streaming with range request support
- CRUD operations for video management (Admin only)
- SQLite database for data persistence
- User management using revolk token
- Go 1.18 or higher
- SQLite3
- ffmpeg (optional, for video processing)
- Clone the repository:
git clone [<repository-url>](https://github.com/shariaralphabyte/Secure-Video-Streaming-API.git)
cd secure-video-api- Install dependencies:
go mod download- Create a .env file (already provided) with the following configuration:
SERVER_PORT=8080
JWT_SECRET=your-super-secret-key-change-in-production
ENCRYPTION_KEY=32-byte-key-for-video-encryption12
SQLITE_DB_PATH=./database.db
STORAGE_PATH=./storage/videos
ENCRYPTED_PATH=./storage/encrypted
ADMIN_EMAIL=shariar99@gmail.com
ADMIN_PASSWORD=Alpha1234- Create required directories:
mkdir -p storage/videos storage/encrypted- Build and run the application:
go run cmd/api/main.goThe server will start on http://localhost:8080
Email: shariar99@gmail.com Password: Alpha1234
- POST /api/auth/register - Register a new user
- POST /api/auth/login - Login user
- GET /api/videos - List all videos
- GET /api/videos/:id/stream - Stream a video
- POST /api/admin/videos - Upload a new video
- PUT /api/admin/videos/:id - Update video details
- DELETE /api/admin/videos/:id - Delete a video
- Import the provided Postman collection (
secure-video-api.postman_collection.json). - Set up the environment variable
base_urltohttp://localhost:8080. - Login with the admin credentials to get a JWT token.
- Set the received token in the
tokenenvironment variable. - Use the collection to test all endpoints.
- AES-256 encryption for stored videos
- JWT-based authentication
- Password hashing with bcrypt
- Role-based access control
- Secure video streaming with range request support
- No direct access to video files
- OTP print in console for additional security
.
├── cmd/
│ └── api/
│ └── main.go
├── config/
├── internal/
│ ├── auth/
│ ├── database/
│ ├── handlers/
│ ├── middleware/
│ ├── models/
│ ├── storage/
│ └── utils/
├── storage/
│ ├── encrypted/
│ └── videos/
├── go.mod
├── go.sum
└── .env