LinkUp is a modern social media platform backend built with Django REST Framework, providing robust APIs for user authentication, posts, and social interactions.
- JWT Authentication (Register, Login, Logout)
- User Profiles with profile pictures
- Post Management (Create, Read, Update, Delete)
- Media Uploads (Images/Videos)
- Follow/Unfollow functionality
- CORS Support for frontend integration
- PostgreSQL database support
backend/
├── core/ # Main Django project
│ ├── settings.py # Project configuration
│ ├── urls.py # Main URL routing
│ └── ...
├── accounts/ # User authentication app
│ ├── models.py # Custom User model
│ ├── serializers.py # User serializers
│ └── ...
├── post/ # Posts functionality
│ ├── models.py # Post model
│ ├── views.py # Post viewsets
│ └── ...
├── manage.py # Django management script
└── requirements.txt # Python dependencies
- Python 3.10+
- PostgreSQL 13+
- pip 20+
-
Clone the repository:
git clone https://github.com/emmanuelronoh/LinkUp-backend.git cd LinkUp-backend/backend -
Set up virtual environment:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies:
pip install -r requirements.txt
- Create .env file in backend/core/ with:
DATABASE_URL=postgres://user:password@localhost:5432/linkup
SECRET_KEY=your-secret-key-here
DEBUG=True- Run migrations:
python manage.py migrate- Create superuser:
python manage.py createsuperuser- Running the Server
python manage.py runserverThe API will be available at http://localhost:8000/api/
| Endpoint | Method | Description |
|---|---|---|
/api/auth/register/ |
POST | User registration |
/api/auth/login/ |
POST | User login (JWT tokens) |
/api/auth/logout/ |
POST | User logout |
/api/posts/ |
GET | List all posts |
/api/posts/ |
POST | Create new post |
/api/posts/<id>/ |
GET | Retrieve specific post |
/api/users/ |
GET | List all users |
/api/users/<id>/ |
GET | Retrieve specific user profile |
Edit core/settings.py to configure:
# Database
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': os.getenv('DB_NAME'),
'USER': os.getenv('DB_USER'),
'PASSWORD': os.getenv('DB_PASSWORD'),
'HOST': os.getenv('DB_HOST'),
'PORT': os.getenv('DB_PORT'),
}
}
# Security
DEBUG = False
ALLOWED_HOSTS = ['yourdomain.com', 'api.yourdomain.com']
# CORS
CORS_ALLOWED_ORIGINS = [
"https://yourfrontend.com",
"https://www.yourfrontend.com"
]- Environment Configuration:
# In your .env file DEBUG=False SECRET_KEY=your-production-secret-key ALLOWED_HOSTS=yourdomain.com,api.yourdomain.com DATABASE_URL=postgres://prod_user:strongpassword@prod-db-host:5432/prod_db
-
Fork the repository
-
Create your feature branch
git checkout -b feature/fooBar
-
Commit your changes
git commit -am 'Add some fooBar' -
Push to the branch
git push origin feature/fooBar
-
Create a new Pull Request