This project is entirely designed, developed, and deployed by Qinghao Yang as an individual assignment.
- Framework: Node.js with Express
- Database: MongoDB (hosted on MongoDB Atlas)
- Packages:
mongoose: For database schema and operationsexpress: For handling routing and middlewarebcrypt: For secure password hashingdotenv: To manage environment variables securelycors: To enable cross-origin requestsbody-parser: To parse incoming request bodiesjsonwebtoken: For user authentication using JSON Web Tokens
- Framework: React
- Build Tool: Vite
- Packages:
react-router-dom: For client-side routingprop-types: For type-checking React propsaxios: To handle HTTP requests between frontend and backend
- Frontend: https://qhmadoka-twitterapp.onrender.com
- Backend: https://qhmadoka-twitterapp-backend.onrender.com
- User:
- Stores user credentials (username, password) and profile details (avatar, description).
- Passwords are hashed using
bcrypt.
- Post:
- Represents a social media post with content, timestamp, and likes.
- Linked to the user who created the post.
- Comment:
- Represents comments on posts, linked to the corresponding post and user.
- Authentication Controller:
- Handles user registration and login.
- Verifies credentials using
bcryptand generates JWT tokens for session management.
- User Controller:
- Fetches user profiles and their related posts.
- Allows users to update their profile (avatar and description) or delete their account.
- Post Controller:
- Implements CRUD operations for posts (Create, Read, Update, Delete).
- Supports features like liking/unliking posts.
- Comment Controller:
- Handles fetching, creating, and deleting comments for specific posts.
/api/auth: Authentication routes (login, register)./api/users: User profile management routes./api/posts: Post-related routes./api/comments: Comment-related routes.
- HomePage:
- Displays all posts.
- Allows users to create, delete, and interact with posts (like/unlike, comment).
- LoginPage:
- Provides user login and registration functionality.
- UserPage:
- Displays user-specific profile details, posts, and avatar management.
- Includes an option to delete the account.
- Navbar:
- Provides navigation between HomePage, UserPage, and LoginPage.
- ErrorBoundary:
- Catches and displays errors gracefully during runtime.
- User authentication with JWT.
- Full CRUD operations for posts and comments.
- Secure password hashing and validation.
- Cross-origin support with
cors.
- Responsive design for desktop and mobile.
- Dynamic routing using
react-router-dom. - State management using React context.
- Error handling with
ErrorBoundary.
- Frontend: Deployed on Render.
- Backend: Deployed on Render.
- Database: Hosted on MongoDB Atlas.
To further improve the functionality and scalability of this application, the following features and optimizations are planned:
-
Media Uploads:
- Allow users to upload images and videos in their posts, using cloud storage solutions like AWS S3 or Firebase Storage.
-
Interactive Notifications:
- Implement real-time notifications for likes, comments, and new followers.
-
Real-time Updates:
- Use WebSocket or similar technologies to provide real-time updates for posts, comments, and interactions.
-
Caching Popular Data:
- Utilize Redis to cache popular posts and user data, improving response time for frequently accessed resources.
-
Fuzzy Search:
- Implement a fuzzy search feature for posts and users, enabling better user experience when searching.
-
Database Optimization:
- Optimize MongoDB queries by adding indexes on frequently queried fields and using aggregation pipelines.
-
Analytics and Insights:
- Track user engagement and provide insights like most popular posts, top users, and activity trends.
-
Dark Mode:
- Add a dark mode toggle for better user accessibility and experience.
These enhancements aim to make the application more interactive, scalable, and user-friendly.