Backend service for the ChillChill video sharing platform. This codebase exposes RESTful APIs that power user management, video feeds, media uploads, messaging, and organization workflows. The project targets a full-stack architecture and is optimized for containerized deployments.
- วีระศักดิ์ ฮ้อยตะคุ 660615040
- สพล ธิติธนชิต 660615041
- พลพัฒน์ ชาญด้วยวิทย์ 660610873
- Runtime & Language: Bun 1.x, TypeScript
- Web Framework & Tooling: Express 5, Axios for outbound HTTP
- Database Layer: MongoDB via Mongoose ODM
- Caching & Messaging: Redis
- Object Storage: MinIO (S3-compatible)
- Supporting Utilities: Multer (file uploads), JSON Web Token (auth), Nodemailer (email)
- Containerization: Dedicated Dockerfile for the backend,
docker-compose.yamlfor orchestration
- Prerequisites
- Install Bun 1.x
- Install Docker and Docker Compose (required for local infrastructure)
- Environment Variables
- Duplicate the provided
.envfile or create a new one using the documented keys:PORT,MONGO,JWT_SECRET,REDIS_URL, email credentials, andMINIO_ENDPOINT - Make sure MongoDB, Redis, and MinIO endpoints align with your chosen runtime (local or Docker)
- Duplicate the provided
- Install Dependencies
bun install
- Start the Development Server
The backend listens on
bun run dev
http://localhost:8000by default, controlled byPORTin.env.
Ensure MongoDB is running and that
MONGOin.envpoints to the active instance before seeding.
- Create mock users and generate
usersWithIds.json:bun run seeders/createMockUsers.ts
- Inserts users only when they do not already exist.
- Outputs
seeders/usersWithIds.json, which is required by other mock scripts.
- (Optional) Upload sample videos to the API:
API_URL=https://api.example.com/chillchill \ bun run seeders/uploadmock.ts (need to edit path in uploadmock.ts)- Update
VIDEOS_DIRinside the script to point to a directory of.mp4files. - Requires an accessible
/media/upload/mockendpoint. - Upload history is persisted in
seeders/uploadedVideos.json.
- Update
# Backend image (this repository)
docker build -t term-backend .
# Frontend image (adjust path to the actual frontend repository)
docker build -t term-frontend ../term-project-fedocker compose up -d- Services exposed: MinIO (
9000,9001), MongoDB (27017), Redis (6379), Backend (8000), Frontend (3000) docker-compose.yamlsources environment values from the same.envfile used in development.
docker compose down- Append
--volumesto remove persisted data.
src/– TypeScript source for Express controllers, models, and middlewareseeders/– Database and media seeding scripts plus supporting JSON assetsDockerfile– Bun-based backend image with FFmpeg supportdocker-compose.yaml– Local orchestration for infrastructure and app services