Simple Social Network v0.1.0

Django-powered web application with real-time messaging, friendship management, user profiles, and two-factor authentication

Designed for secure communication and social interaction with a modern, dark-themed interface.

Python Django PostgreSQL Redis WebSocket 2FA Semantic UI

Simple Social Network is a Django-based web application that provides real-time messaging, friendship management, user profiles, and two-factor authentication. The platform is designed for secure communication and social interaction with a modern, dark-themed interface.

  • User Authentication — registration, login, email verification, password reset
  • Two-Factor Authentication — TOTP-based 2FA with backup codes
  • Real-time Chat — WebSocket-powered messaging with edit/delete capabilities
  • Friend System — send, accept, reject, and cancel friend requests
  • User Profiles — customizable profiles with avatars, biography, and personal information
  • Chat Management — archive, mute, delete, and restore chats
  • Message Status — read receipts and message timestamps
  • User Search — find users by username or first name
  • Responsive Design — works on desktop and mobile devices

Backend

  • Django 6.0.5 — Web framework
  • PostgreSQL — Database
  • Redis — Caching and session storage
  • Django Channels — WebSocket support for real-time features

Frontend

  • Django Templates — Server-side rendering
  • Semantic UI — Frontend framework
  • JavaScript — Native WebSocket client

Security

  • pyotp — TOTP generation/verification
  • bcrypt — Backup code hashing

# Clone repository
git clone https://github.com/aixandrolab/simple-social-network.git
cd simple-social-network

# Create virtual environment
python -m venv venv
source venv/bin/activate

# Install dependencies
pip install -r requirements.txt

# Configure PostgreSQL
sudo pacman -S postgresql  # Arch Linux
sudo systemctl start postgresql
sudo systemctl enable postgresql

# Create database (in psql)
CREATE DATABASE simple_social_network_db
    OWNER postgres
    ENCODING 'UTF-8'
    LC_COLLATE 'en_US.UTF-8'
    LC_CTYPE 'en_US.UTF-8'
    TEMPLATE template0;

# Configure Redis
sudo pacman -S redis
sudo systemctl start redis
sudo systemctl enable redis

# Create .env file (see below)
# Apply migrations
python manage.py migrate

# Create superuser
python manage.py createsuperuser

# Collect static files
python manage.py collectstatic

# Run development server
python manage.py runserver

simple-social-network/
├── chats/
│   ├── signals.py            # Post-save signals
│   ├── forms/                # Chat settings form
│   ├── templatetags/         # Custom template tags
│   ├── models/               # Chat, ChatStatus, ChatMessage
│   └── views/                # Chat views
├── core/
│   ├── consumers.py          # WebSocket consumers
│   ├── context_processors.py # Site config context
│   ├── models.py             # SiteConfig singleton
│   ├── services.py           # Email services
│   ├── routing.py            # WebSocket routing
│   ├── signals.py            # SiteConfig signals
│   ├── utils/                # Pagination utilities
│   └── views/                # Home, auth, password views
├── friends/
│   ├── services.py           # Friendship business logic
│   ├── signals.py            # Status change logging
│   ├── models/               # Friendship, FriendshipHistory
│   └── views/                # Friend request views
├── profiles/
│   ├── middleware.py         # Last activity tracking
│   ├── signals.py            # User profile creation
│   ├── forms/                # Profile, 2FA, password forms
│   ├── utils/                # Image validation
│   ├── models/               # Profile, token models
│   └── views/                # Profile, 2FA, settings views
├── static/                   # Static files
├── templates/                # Base templates and components
├── media/                    # User-uploaded files
├── .env                      # Environment variables
├── manage.py
├── requirements.txt
└── README.md

  • Profile — user profile with avatar, biography, 2FA settings. Tracks online status via Redis.
  • Friendship — manages friend relationships with status (pending/accepted/rejected). Maintains history of status changes.
  • Chat — two-user private chat with naming, archiving, muting, and deletion.
  • ChatMessage — messages with content, read status, edit/delete support, and timestamp tracking.
  • ChatStatus — per-user chat preferences (archived, muted, deleted, visible).

URLDescription
/Home page
/login/User login
/register/User registration
/profile/detail/{slug}/User profile
/profile/search/Search users
/friends/@username/Friends list
/friends/incoming/Incoming friend requests
/friends/outgoing/Outgoing friend requests
/chats/active/Active chats list
/chats/archived/Archived chats
/chats/deleted/Deleted chats
/chats/create/{profile_id}/Create new chat
/chat/details/{chat_id}/Chat detail/messages
/chat/settings/{chat_id}/Chat settings
/two-factor/2FA management

# Core Settings
DJANGO_ENV=development
SECRET_KEY=your-secret-key-here
DEBUG=True
ALLOWED_HOSTS=localhost,127.0.0.1

# Database Settings
DB_NAME=simple_social_network_db
DB_USER=postgres
DB_PASSWORD=your-db-password
DB_HOST=localhost
DB_PORT=5432

# Redis Settings
REDIS_URL=redis://localhost:6379/1

# Email Settings (SMTP)
EMAIL_ON=True
EMAIL_HOST=smtp.gmail.com
EMAIL_HOST_USER=your-email@gmail.com
EMAIL_HOST_PASSWORD=your-app-password

Links


Created by Alexander Suvorov (@aixandrolab)

This application is part of the @aixandrolab ecosystem.