A Django REST Framework (DRF) API that replicates core Instagram features such as user authentication, posts, likes, comments, and follow/unfollow functionality.
β
User Authentication (Register, Login, JWT)
β
Create, Read, Update, and Delete (CRUD) for Posts
β
Like/Unlike Posts
β
Comment on Posts
β
Follow/Unfollow Users
β
User Profiles with Followers & Following Counts
β
Search Users
- Backend: Django, Django REST Framework
- Database: PostgreSQL
- Authentication: JWT (JSON Web Tokens)
- Documentation: DRF Spectacular (OpenAPI/Swagger)
1οΈβ£ Clone the Repository
2οΈβ£ Create a Virtual Environment & Install Dependencies
python -m venv venv
source venv/bin/activate # On Windows use: venv\Scripts\activate
pip install -r requirements.txt3οΈβ£ Configure Environment Variables
Create a .env file in the root directory and add the required variables:
SECRET_KEY=your_secret_key
DATABASE_URL=your_database_url4οΈβ£ Apply Migrations & Create Superuser
python manage.py migrate
python manage.py createsuperuser5οΈβ£ Run the Development Server
python manage.py runserver- Register:
POST /api/auth/register/ - Login:
POST /api/auth/login/ - Get User Profile:
GET /api/users/{username}/ - Update Profile:
PUT /api/users/{username}/ - Follow/Unfollow:
POST /api/users/{username}/follow/
- Create Post:
POST /api/posts/ - Retrieve Post:
GET /api/posts/{post_id}/ - Like/Unlike Post:
POST /api/posts/{post_id}/like/ - Comment on Post:
POST /api/posts/{post_id}/comment/
After running the server, access the API documentation at:
π http://127.0.0.1:8000/api/schema/swagger-ui/
Contributions are welcome! Feel free to fork, create a pull request, or open an issue. π