Skip to content

LinkUp Backend is the server-side component of the LinkUp social media platform, developed using Django REST Framework. It offers robust APIs for user authentication, post management, media uploads, and social interactions, seamlessly integrating with the React-based frontend.

Notifications You must be signed in to change notification settings

emmanuelronoh/LinkUp-backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LinkUp - Social Media Platform (Backend)

Django PostgreSQL DRF

LinkUp is a modern social media platform backend built with Django REST Framework, providing robust APIs for user authentication, posts, and social interactions.

Features

  • 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

Project Structure

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

Prerequisites

  • Python 3.10+
  • PostgreSQL 13+
  • pip 20+

Installation

  1. Clone the repository:

    git clone https://github.com/emmanuelronoh/LinkUp-backend.git
    cd LinkUp-backend/backend
  2. Set up virtual environment:

    python -m venv venv
    source venv/bin/activate  # On Windows: venv\Scripts\activate
  3. Install dependencies:

    pip install -r requirements.txt

Configure environment variables

  1. Create .env file in backend/core/ with:
 DATABASE_URL=postgres://user:password@localhost:5432/linkup
 SECRET_KEY=your-secret-key-here
 DEBUG=True
  1. Run migrations:
 python manage.py migrate
  1. Create superuser:
 python manage.py createsuperuser
  1. Running the Server
  python manage.py runserver

The API will be available at http://localhost:8000/api/

API Endpoints

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

Configuration

Edit core/settings.py to configure:

Database Settings

# 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"
]

Deployment

Production Checklist

  1. 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

Contributing

  1. Fork the repository

  2. Create your feature branch

    git checkout -b feature/fooBar
  3. Commit your changes

    git commit -am 'Add some fooBar'
  4. Push to the branch

    git push origin feature/fooBar
  5. Create a new Pull Request

About

LinkUp Backend is the server-side component of the LinkUp social media platform, developed using Django REST Framework. It offers robust APIs for user authentication, post management, media uploads, and social interactions, seamlessly integrating with the React-based frontend.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages