A lightweight video-sharing backend (Express + MongoDB) — StreamSpeare.
StreamSpeare is an Express.js backend for a video-sharing platform. It provides RESTful API endpoints and server-rendered pages (EJS) for core features such as user authentication, video upload (Cloudinary), comments, likes, playlists, subscriptions, and simple dashboard routes.
- Users: signup, login, profile management
- Videos: upload, list, view, delete (uses Cloudinary for storage)
- Comments: create and list comments on videos
- Likes: like/unlike videos and render liked videos page
- Playlists: create and manage playlists
- Subscriptions: follow/unfollow channels
- Dashboard & Pages: EJS-rendered pages for home, channel, watch, upload and more
- Node.js (ES Modules)
- Express 5
- MongoDB + Mongoose
- EJS for server-side views
- Cloudinary for media upload
- Multer for multipart/form-data handling
Prerequisites:
- Node.js (v18+ recommended)
- A running MongoDB instance (local or Atlas)
- Cloudinary account (optional, for uploads)
Install dependencies:
npm installEnvironment:
Create a .env file at the project root (or set env vars in your environment). Example variables used by the app:
PORT=3000
MONGODB_URL=mongodb://localhost:27017
JWT_SECRET=your_jwt_secret
CORS_ORIGIN=http://localhost:3000
CLOUDINARY_CLOUD_NAME=your_cloud_name
CLOUDINARY_API_KEY=your_api_key
CLOUDINARY_API_SECRET=your_api_secret
Run in development (uses nodemon):
npm run devThe dev script runs src/index.js (see package.json).
- src/ - application source
- app.js - Express application and route registration (src/app.js)
- index.js - entrypoint that connects DB and starts the server (src/index.js)
- db/ - MongoDB connection (src/db/index.js)
- controllers/ - route handlers
- models/ - Mongoose models
- routes/ - Express routes
- utils/ - helpers (e.g., Cloudinary integration: src/utils/cloudinary.js)
- views/ - EJS templates
- Database name constant is defined in src/constants.js (currently set to
youtube). - Cloudinary uploads are handled in src/utils/cloudinary.js.
- The app serves server-rendered pages and exposes API routes under
/api/v1/...(routes are registered insidesrc/app.js).
GET /api/v1/healthcheck- health endpointPOST /api/v1/users- user registration (example)POST /api/v1/tweets,POST /api/v1/videos- content endpointsGET /api/v1/likes,/api/v1/comments,/api/v1/playlist,/api/v1/subscriptions- related resources
Refer to the src/routes/ folder to inspect concrete route definitions.
- The project uses ES modules (
type: "module"in package.json). - Dev script uses
nodemon -r dotenv/config --experimental-json-modules src/index.js.
Contributions are welcome. Suggested workflow:
- Fork
- Create a feature branch
- Submit a PR with tests and description
This project is provided as-is. Check package.json for author metadata (author: Yash Shinde).
If you'd like, I can also:
- Extract a more detailed API reference by reading each route file, or
- Add a sample
.env.exampleand Postman collection.