Skip to content

Social network built with Django Framework.

License

Notifications You must be signed in to change notification settings

monosans/socnet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

f2f751f · Mar 21, 2025
Mar 14, 2025
Feb 10, 2025
Mar 18, 2025
Mar 19, 2025
Sep 17, 2023
Mar 19, 2025
Mar 14, 2025
Feb 4, 2025
Nov 22, 2024
Feb 1, 2025
Feb 3, 2025
Aug 5, 2023
Aug 29, 2023
Mar 20, 2025
Jun 7, 2023
Jun 10, 2022
Mar 14, 2025
Nov 12, 2024
Nov 12, 2024
Jan 16, 2025
Jan 16, 2025
Jan 16, 2025
Dec 25, 2024
Nov 5, 2024
Feb 25, 2025
Nov 22, 2024
Mar 14, 2025
Mar 21, 2025
Mar 20, 2025
Feb 10, 2025
Mar 20, 2025
Apr 4, 2024
Mar 14, 2025
Feb 10, 2025
Aug 10, 2024
Mar 20, 2025

Repository files navigation

SocNet

CI

Social network built with Django Framework.

Features

  • Multi-language (currently English and Russian). Selected based on browser settings.
  • Light and dark theme support with a switch. The browser theme is selected by default.
  • Infinite scrolling.
  • Progressive Web App (PWA) support.

Regular users

  • Register and confirm their account by email
  • Sign in
  • Add backup email addresses in case they lose access to the primary address
  • Reset and change their password
  • Use two-factor authentication with time-based one-time passwords (TOTP)
  • Provide information about themselves in their profile
  • Write real-time messages with Markdown and HTML support to other users using WebSockets
  • Create, edit, like and delete posts and comments with Markdown and HTML support
  • View images in posts, comments and messages as a gallery using viewerjs
  • Subscribe to other users to see their posts in their news feed
  • Inexact search for posts by text
  • Inexact search for messages by text
  • Inexact search for users by selectable fields
  • Delete their account
  • And a lot of other little things

Administrators

  • All of the above
  • Use Django admin panel
  • Receive error notifications in Sentry or by email

Installation

Install Docker Compose.

Configuration

Copy the .env.example file to .env. Set the settings you need in the .env file.

Development

# Pull service images
docker compose pull --ignore-buildable
# Build services
docker compose build --pull
# Run DB migrations
docker compose run --rm django python3 manage.py migrate
# Create a superuser if you want
docker compose run --rm django python3 manage.py createsuperuser
# Compile translations
docker compose run --rm django python3 manage.py compilemessages --locale en --locale ru

# Run without debugpy
docker compose up --remove-orphans
# Or run with debugpy
docker compose -f compose.yaml -f compose.override.yaml -f compose.debug.yaml up --remove-orphans

Production

To run this in production, you need to specify the production settings in .env.

# Pull service images
docker compose -f compose.yaml -f compose.prod.yaml pull --ignore-buildable
# Build services
docker compose -f compose.yaml -f compose.prod.yaml build --pull
# Run DB migrations
docker compose -f compose.yaml -f compose.prod.yaml run --rm django python3 manage.py migrate
# Create a superuser if you want
docker compose -f compose.yaml -f compose.prod.yaml run --rm django python3 manage.py createsuperuser
# Run
docker compose -f compose.yaml -f compose.prod.yaml up -d --remove-orphans

Tech Stack

Containerization

  • Docker
  • Docker Compose

Backend

  • Python 3.13
  • Django 5.1
  • django-allauth
  • django-bootstrap5
  • django-cleanup
  • django-environ
  • django-filter
  • django-logentry-admin
  • django-ninja
  • channels
  • channels-redis
  • sentry-sdk
  • websockets

Markdown parsing, HTML minification and sanitization, and a few other things are implemented in Rust in the socnet_rs package using the following libraries:

  • ammonia
  • minify-html
  • pulldown-cmark
  • pyo3

Databases

  • PostgreSQL 17 for persistent data
  • Valkey 8 (FOSS Redis fork) for cache and as a layer for Channels

Frontend

  • HTML with Django Template language
  • HTMX 2
  • Bootstrap CSS 5.x
  • Font Awesome 6
  • TypeScript (compiled and minified with esbuild)
  • viewerjs
  • luxon

Web servers

  • Caddy
  • gunicorn
  • uvicorn

Testing

  • pytest
  • factory-boy

Linting

  • mypy
  • ruff
  • eslint
  • stylelint

DB schema

License

MIT