Built with the tools and technologies:
- 🌐 Live Demo
- 📱 Overview
- ✨ Features
- 🚀 Tech Stack
- 📁 Folder Structure
- 🗄️ Database Structure
- ⚙️ Installation & Setup
- 📌 Project Roadmap
- 🔰 Contributing
- 📄 License
- 👤 Author
Check out the live demo of this project here: 👉 dantetestserver.pages.dev
- User Authentication (Login/Signup)
- Profile Creation & Editing
- Post Creation, Editing, and Deletion
- Like and Comment Functionality
- Real-Time Chat System
- Notifications (Locally cached using IndexedDB)
- Responsive Design for Mobile and Desktop
- Custom React Hooks and Redux Toolkit for state management
- Frontend: React.js, Redux Toolkit, Tailwind CSS
- Backend & Database: Appwrite (self-hosted backend-as-a-service)
- Realtime Messaging: Custom Chat Service
- Data Storage: IndexedDB for local notifications and data caching
- Deployment: Cloudflare Pages
└── SocialMedia/
├── LICENSE
├── SocialMedia/
│ ├── public/ # Static assets
│ ├── src/
│ │ ├── app/ # Redux store and configuration
│ │ ├── assets/ # Images and icons
│ │ ├── components/ # Shared components (Navbar, Button, etc.)
│ │ ├── features/ # Feature-based Redux slices
│ │ ├── pages/ # Page components (Home, Profile, Chat, etc.)
│ │ ├── services/ # API and backend interactions
│ │ ├── utils/ # Utility functions and hooks
│ │ └── main.jsx # React DOM root
│ ├── .env # Environment variables
│ ├── package.json # Project metadata and scripts
│ └── tailwind.config.js # Tailwind CSS configuration
└── appwriteFunctions # Appwrite functions
├── commentFunction
│ └── src
│ └── main.js # Appwrite functions for comment system
└── followFunction
└── src
└── main.js # Appwrite functions for follow unfollow└── Database
├── UserProfileCollection
│ ├── Fields: username*, bio, avatarUrl
│ └── Permissions:
│ ├── Any: X R X X
│ └── Users: C R W D
├── PostCollection
│ ├── Fields: userId*, content, mediaUrl, likesCount, visibility, title*, commentsCount
│ └── Permissions:
│ ├── Any: X R X X
│ └── Users: C R W D
├── ReportCollection
│ ├── Fields: userId*, postId, reportText*
│ └── Permissions:
│ ├── Dev: C R W D
│ └── Users: C X X X
├── CommentsCollection
│ ├── Fields: commentId, postId*, authorId*, content*, likesCount
│ ├── Accessed By: Function { postId, commentId = null, content }
│ └── Permissions:
│ ├── Any: X R X X
│ └── Users: X X X X
├── FollowersStats
│ ├── Fields: Document ID, followersCount, followingCount
│ ├── Accessed By: Function { followeeId }
│ └── Permissions:
│ ├── Any: X R X X
│ └── Users: X X X X
├── FollowsEvent
│ ├── Fields: followerId*, followeeId*
│ ├── Accessed By: Function { followeeId }
│ └── Permissions:
│ ├── Any: X R X X
│ └── Users: X X X X
├── Notifications
│ ├── Fields: userId, type(comment|follow|replay), relatedUserId, relatedPostId, seen, commentText
│ ├── Accessed By:
│ ├── Function { followeeId }
│ └── Function { postId, commentId = null, content }
│ └── Permissions:
│ └── User($ID): X R W D
├── LikesCollection # Requires custom access control via an Appwrite Function
│ ├── Fields: userId*, postId*, commentId
│ ├── Notes: Needs to be secured via custom function
│ └── Permissions:
│ ├── Any: X R X X
│ └── Users: C R X D
├── InboxCollection # Requires custom access control via an Appwrite Function
│ ├── Fields: senderId, receiverId, message, seen
│ ├── Notes: Must be secured with custom function
│ └── Permissions:
│ ├── Any: X R U X
│ └── Users: C R U DLegend:
C= CreateR= ReadW= WriteD= DeleteX= No permission*= Required field
Before getting started with SocialMedia, ensure your runtime environment meets the following requirements:
- Programming Language: JavaScript
- Package Manager: Npm
Install SocialMedia using one of the following methods:
-
Clone the Repository
git clone https://github.com/Tanmoy-Mondal-07/SocialMedia.git cd SocialMedia -
Install Dependencies
npm install
-
Setup Environment Variables Create a
.envfile in the root directory and add your Appwrite project credentials:# Appwrite Project Configuration VITE_APPWRITE_URL= # The endpoint URL of your Appwrite server VITE_APPWRITE_PROJECT_ID= # Your Appwrite project ID VITE_APPWRITE_DATABASE_ID= # The ID of your Appwrite database # Collection IDs VITE_APPWRITE_USER_PROFILE_COLLECTION_ID= # Collection for user profile data VITE_APPWRITE_POST_COLLECTION_ID= # Collection for posts VITE_APPWRITE_FOLLOW_STATE_COLLECTION_ID= # Collection to track follow state between users VITE_APPWRITE_FOLLOW_EVENT_COLLECTION_ID= # Collection for follow/unfollow events VITE_APPWRITE_COMMENTS_COLLECTION_ID= # Collection for post comments VITE_APPWRITE_NOTIFICATIONS_COLLECTION_ID= # Collection for user notifications VITE_APPWRITE_REPORT_COLLECTION_ID= # Collection for content reports (e.g., abuse or spam) VITE_APPWRITE_LIKE_COLLECTION_ID= # Collection for likes on posts or comments VITE_APPWRITE_INBOX_COLLECTION_ID= # Collection for private chat or messaging inboxes # Bucket IDs VITE_APPWRITE_BUCKET_AVATAR_ID= # Storage bucket for user avatars # Function IDs VITE_APPWRITE_FOLLOW_FUNCTION_ID= # Function to handle follow/unfollow logic VITE_APPWRITE_COMMENT_FUNCTION_ID= # Function to handle comment creation/processing
-
Run the Development Server
npm run dev
-
Build for Production
npm run build
-
Create a New Appwrite Function Go to your Appwrite dashboard and create a new function.
-
Replace the
main.jsFile After creating the function, replace the defaultmain.jsfile with your custom version.└── Function/ # Appwrite Function repository ├── node_modules/... ├── src/ │ └── main.js # Replace this file with your custom main.js ├── package.json └── package-lock.json
-
Configure Environment Variables and Permissions Don’t forget to set the required environment variables and configure the appropriate permissions for your Appwrite function.
-
Learn More To understand Appwrite functions in more detail, refer to the following resources:
-
Task 1:The follow system must be secured using a custom Appwrite function to validate user actions and prevent unauthorized follows. -
Task 2:The comment system must be secured using a custom Appwrite function to ensure only authenticated users can post, edit, or delete comments. - [*]
Task 3: The live chat system must be secured using a custom Appwrite function to ensure message integrity and user authentication. - [*]
Task 4: The like system must be secured using a custom Appwrite function to prevent duplicate likes and ensure actions are tied to authenticated users..
Contributions are welcome! If you'd like to contribute:
- Fork the Repository: Start by forking the project repository to your github account.
- Clone Locally: Clone the forked repository to your local machine using a git client.
git clone https://github.com/Tanmoy-Mondal-07/SocialMedia
- Create a New Branch: Always work on a new branch, giving it a descriptive name.
git checkout -b new-feature-x
- Make Your Changes: Develop and test your changes locally.
- Commit Your Changes: Commit with a clear message describing your updates.
git commit -m 'Implemented new feature x.' - Push to github: Push the changes to your forked repository.
git push origin new-feature-x
- Submit a Pull Request: Create a PR against the original project repository. Clearly describe the changes and their motivations.
- Review: Once your PR is reviewed and approved, it will be merged into the main branch. Congratulations on your contribution!
This project is licensed under the MIT License. See the LICENSE file for details.
Tanmoy Mondal
GitHub: @Tanmoy-Mondal-07
If you find any bugs or issues, please open an issue on GitHub or reach out via the Issues tab.
Happy Coding! ✨