A full-stack web application inspired by Twitch.tv, built with React.js and Node.js. This project features user authentication, real-time communication capabilities, and a modern responsive interface.
- User Authentication: Secure login and registration system
- JWT Authentication: Token-based authentication with 8-hour expiration
- Password Encryption: Secure password hashing with bcrypt
- Input Validation: Client-side and server-side validation using Joi
- Real-time Communication: Socket.io integration for live features
- Responsive Design: Mobile-friendly interface
- Toast Notifications: User feedback with react-hot-toast
- Modern Routing: React Router DOM for seamless navigation
- React.js (v18.3.1) - UI Framework
- React Router DOM (v6.26.0) - Navigation
- Axios (v1.7.7) - HTTP Client
- React Hot Toast (v2.4.1) - Notifications
- CSS3 - Styling
- Node.js - Runtime Environment
- Express.js (v4.19.2) - Web Framework
- MongoDB with Mongoose (v8.5.2) - Database
- Socket.io (v4.7.5) - Real-time Communication
- JWT (v9.0.2) - Authentication
- bcrypt.js (v2.4.3) - Password Hashing
- Joi (v17.13.3) - Input Validation
- CORS (v2.8.5) - Cross-Origin Resource Sharing
Before running this application, make sure you have the following installed:
- Node.js (v14 or higher)
- npm or yarn
- MongoDB (local installation or MongoDB Atlas)
git clone https://github.com/NishalDev/twitch.tv.git
cd twitch.tvCreate a .env file in the server directory with the following variables:
# Server Configuration
PORT=5002
API_PORT=5002
# Database
MONGO_URI=mongodb://localhost:27017/twitchtv
# Or use MongoDB Atlas: mongodb+srv://<username>:<password>@cluster.mongodb.net/twitchtv
# JWT Configuration
TOKEN_KEY=your_super_secret_jwt_key_herecd twitch.tv/server
npm installcd ../client
npm installcd server
npm startThe server will run on http://localhost:5002
cd client
npm startThe application will open at http://localhost:3000
cd client
npm run buildtwitch.tv/
βββ client/ # React frontend application
β βββ public/ # Public assets
β βββ src/
β β βββ API/ # API configuration and calls
β β βββ AuthPage/ # Authentication components
β β βββ DashboardPage/ # Main dashboard
β β βββ shared/ # Shared utilities
β β β βββ hooks/ # Custom React hooks
β β β βββ validators/ # Input validation functions
β β βββ resources/ # Images and assets
β βββ package.json
βββ server/ # Node.js backend application
β βββ src/
β β βββ controllers/ # Route controllers
β β β βββ auth/ # Authentication controllers
β β βββ models/ # MongoDB models
β β βββ routes/ # API routes
β βββ index.js # Server entry point
β βββ package.json
βββ README.md
POST /api/auth/register
Content-Type: application/json
{
"username": "string (3-12 characters)",
"email": "valid-email@example.com",
"password": "string (6-12 characters)"
}POST /api/auth/login
Content-Type: application/json
{
"email": "user@example.com",
"password": "userpassword"
}Response:
{
"userDetails": {
"email": "user@example.com",
"username": "username",
"token": "jwt_token_here"
}
}{
email: String (unique),
username: String,
password: String (hashed)
}- Password Hashing: All passwords are encrypted using bcrypt
- JWT Tokens: Secure authentication with 8-hour expiration
- Input Validation: Both client and server-side validation
- CORS Protection: Configured for secure cross-origin requests
- Email Validation: Regex-based email format validation
# Run frontend tests
cd client
npm test
# Run backend tests (when implemented)
cd server
npm testThe React application can be deployed to platforms like:
- Vercel
- Netlify
- GitHub Pages
- AWS S3 + CloudFront
The Node.js server can be deployed to:
- Heroku
- Railway
- AWS EC2
- DigitalOcean
- Vercel
- MongoDB Atlas (Recommended for production)
- AWS DocumentDB
- Self-hosted MongoDB
- Fork the project
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
- β User Registration & Login
- β JWT Authentication
- β Input Validation
- β Basic Dashboard Structure
- π Dashboard functionality (In Progress)
- π Real-time features (Socket.io integrated but not implemented)
- π Video streaming capabilities
- π Chat system
- Fix typo in
postLogin.js:toLowercase()should betoLowerCase() - API base URL uses HTTPS but server runs on HTTP in development
- Dashboard page needs implementation
This project is licensed under the ISC License - see the LICENSE file for details.
NishalDev
- GitHub: @NishalDev
- Inspired by Twitch.tv
- Built with Create React App
- Uses modern web development practices and technologies
If you have any questions or need help getting started, please open an issue in this repository.