This is a social media website built with Django and React. The backend is powered by Django, providing a robust and scalable API, while the frontend is developed with React for a dynamic and responsive user experience. The website features user authentication with JWT, enabling secure user interactions.
- User registration and login
- JWT-based authentication
- Create, update, and delete posts
- Like and comment on posts
- Share media content
- Responsive design
- Installation
- Backend Setup (Django)
- Frontend Setup (React)
- Usage
- API Endpoints
- Technologies Used
- Contributing
- License
Follow the steps below to set up the project locally.
- Python 3.x
- Node.js and npm
- Django
- Django REST framework
- djangorestframework-simplejwt
- React
-
Clone the repository:
git clone https://github.com/your-username/social-media-website.git cd social-media-website/backend
-
Create and activate a virtual environment:
python -m venv venv source venv/bin/activate # On Windows use `venv\Scripts\activate`
-
Install the required packages:
pip install -r requirements.txt
-
Run migrations:
python manage.py migrate
-
Create a superuser:
python manage.py createsuperuser
-
Start the development server:
python manage.py runserver
-
Navigate to the frontend directory:
cd ../frontend
-
Install the required packages:
npm install
-
Start the React development server:
npm start
- Open your web browser and go to
http://localhost:8000
to access the Django backend. - Open another tab and go to
http://localhost:3000
to access the React frontend.
POST /api/auth/register/
- Register a new userPOST /api/auth/login/
- User login and obtain JWT tokenPOST /api/auth/logout/
- User logoutGET /api/posts/
- Retrieve all postsPOST /api/posts/
- Create a new postGET /api/posts/{id}/
- Retrieve a single postPUT /api/posts/{id}/
- Update a postDELETE /api/posts/{id}/
- Delete a postPOST /api/posts/{id}/like/
- Like a postPOST /api/posts/{id}/comment/
- Comment on a post
-
Backend:
- Django
- Django REST framework
- djangorestframework-simplejwt
-
Frontend:
- React
- Axios (for API requests)
- Redux (for state management)
- Tailwind CSS (for styling)
Contributions are welcome! Please follow these steps to contribute:
- Fork the repository.
- Create a new branch (
git checkout -b feature-branch
). - Make your changes.
- Commit your changes (
git commit -m 'Add new feature'
). - Push to the branch (
git push origin feature-branch
). - Create a new Pull Request.
This project is licensed under the MIT License. See the LICENSE file for details.
Happy coding!