Skip to content

code-xon/discuss-lite

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

7 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸŽฏ Discuss Lite

A lightweight, modern, self-hosted forum platform for small communities

Docker Python Next.js PostgreSQL TypeScript Tailwind CSS

Minimal โ€ข Fast โ€ข Extensible โ€ข Self-hosted

๐Ÿš€ Quick Start โ€ข ๐Ÿ“š Documentation โ€ข ๐Ÿค Contributing


โœจ Features

๐ŸŽญ User Experience

  • ๐Ÿ” Secure Authentication - Session-based auth with HTTPOnly cookies
  • ๐Ÿ“ฑ Responsive Design - Mobile-first with dark/light theme toggle
  • โšก Fast & Lightweight - Optimized for performance and minimal resource usage
  • ๐ŸŽจ Modern UI - Clean, accessible interface inspired by GitHub Discussions

๐Ÿ› ๏ธ Forum Features

  • ๐Ÿ“‚ Organized Categories - Hierarchical forum structure
  • ๐Ÿ’ฌ Rich Discussions - Threads, replies, and nested conversations
  • โœ๏ธ Markdown Support - Full markdown rendering with syntax highlighting
  • ๐Ÿ” Powerful Search - Full-text search across all content
  • ๐Ÿ“Ž File Attachments - Image uploads with validation
  • ๐Ÿ”” Notifications - In-app notifications for mentions and replies

๐Ÿ›ก๏ธ Moderation & Admin

  • ๐Ÿ‘ฅ Role-based Access - Admin, moderator, and user roles
  • ๐Ÿšฉ Content Moderation - Flag inappropriate content
  • ๐Ÿ—‘๏ธ Soft Delete - Maintain data integrity with soft deletion
  • ๐Ÿ“Š Admin Dashboard - Comprehensive moderation tools
  • ๐Ÿ“ˆ Analytics - View moderation logs and statistics

๐Ÿ”ง Developer Experience

  • ๐Ÿ“– OpenAPI Documentation - Interactive API docs at /docs
  • ๐Ÿณ Docker Ready - One-command deployment
  • ๐Ÿงช Comprehensive Testing - Backend and frontend test suites
  • ๐Ÿ”„ CI/CD Pipeline - Automated testing and deployment
  • ๐Ÿ“ Type Safety - Full TypeScript and Pydantic validation

๐Ÿ—๏ธ Tech Stack

Component Technology Description
Frontend Next.js + TypeScript + Tailwind CSS Modern React framework with type safety
Backend FastAPI + Python + Pydantic High-performance async API framework
Database PostgreSQL + SQLAlchemy Robust relational database with ORM
Cache Redis Optional caching and session storage
Deployment Docker + docker-compose Containerized deployment
Testing PyTest + React Testing Library Comprehensive test coverage
Code Quality Black + isort + ESLint + Prettier Automated code formatting and linting

๐Ÿš€ Quick Start

Get Discuss Lite running in under 5 minutes!

๐Ÿ“‹ Prerequisites

  • ๐Ÿณ Docker and docker-compose
  • ๐Ÿ™ Git

โšก Local Development Setup

# 1. Clone the repository
git clone https://github.com/code-xon/discuss-lite.git
cd discuss-lite

# 2. Set up environment
cp .env.example .env
# Edit .env with your settings (optional - defaults work for development)

# 3. Launch the application
docker-compose up --build

# 4. Set up the database (in another terminal)
docker-compose exec backend alembic upgrade head
docker-compose exec backend python scripts/seed_data.py

๐ŸŒ Access Your Forum

Once running, access these URLs:

Service URL Description
๐ŸŽจ Frontend http://localhost:3000 Main forum interface
๐Ÿ”ง API http://localhost:8000 REST API endpoints
๐Ÿ“š API Docs http://localhost:8000/docs Interactive OpenAPI documentation
๐Ÿ—„๏ธ Database localhost:5432 PostgreSQL (if needed)
โšก Cache localhost:6379 Redis (if needed)

๐ŸŽฏ First Steps

  1. Create Account - Visit http://localhost:3000/auth and sign up
  2. Explore Categories - Browse the seeded forum categories
  3. Create Thread - Start your first discussion
  4. Customize - Modify settings in the admin panel (/admin)

๐Ÿ’ก Default Admin Account: admin / admin123 (created by seed script)

โš™๏ธ Environment Configuration

Create a .env file based on .env.example:

cp .env.example .env

Key Configuration Options:

Variable Description Default
DATABASE_URL PostgreSQL connection string postgresql+asyncpg://discuss:discuss_password@postgres:5432/discuss_lite
REDIS_URL Redis connection string redis://redis:6379
SECRET_KEY JWT and session signing key Auto-generated
APP_ENV Environment (development/production) development
FRONTEND_URL Frontend application URL http://localhost:3000
BACKEND_URL Backend API URL http://localhost:8000

๐Ÿ“š API Documentation

๐ŸŽฏ API Design Principles

  • RESTful - Standard HTTP methods and resource-based URLs
  • Consistent Responses - Standardized JSON response format
  • OpenAPI Compliant - Full API specification available
  • Versioned - API versioning with /api/v1/ prefix

๐Ÿ“‹ Response Format

All API responses follow this consistent structure:

{
  "success": true,
  "data": {
    // Response data here
  },
  "error": null
}

Error Response:

{
  "success": false,
  "data": null,
  "error": {
    "code": "ERROR_CODE",
    "message": "Human-readable error message"
  }
}

๐Ÿ”— Core API Endpoints

๐Ÿ” Authentication

POST /api/auth/signup       # User registration
POST /api/auth/login        # User authentication
POST /api/auth/logout       # Session termination

๐Ÿ“‚ Categories & Threads

GET    /api/categories                    # List all categories
POST   /api/categories                    # Create category (admin)
GET    /api/categories/{id}/threads       # Get threads in category
GET    /api/threads/{id}                  # Get thread details
POST   /api/threads                       # Create new thread
PUT    /api/threads/{id}                  # Update thread
DELETE /api/threads/{id}                  # Delete thread

๐Ÿ’ฌ Replies & Content

POST   /api/threads/{id}/replies          # Create reply
PUT    /api/replies/{id}                  # Update reply
DELETE /api/replies/{id}                  # Delete reply
POST   /api/uploads                       # Upload files
GET    /api/search?q=query                # Search content

๐Ÿšฉ Moderation

POST   /api/flags                         # Flag content
GET    /api/flags                         # View moderation queue (admin)

๐ŸŽฎ Interactive API Explorer

Visit http://localhost:8000/docs for the interactive OpenAPI documentation where you can:

  • ๐Ÿ“– Explore all endpoints with detailed descriptions
  • ๐Ÿงช Test API calls directly in your browser
  • ๐Ÿ“‹ View request/response schemas
  • ๐Ÿ” Authenticate and test protected endpoints

๐Ÿงช Testing

Ensure code quality with comprehensive test suites:

๐Ÿ”ง Backend Testing

# Run all backend tests
docker-compose exec backend pytest

# Run with coverage report
docker-compose exec backend pytest --cov=app --cov-report=html

# Run specific test file
docker-compose exec backend pytest app/tests/test_api.py

๐ŸŽจ Frontend Testing

# Run frontend tests
docker-compose exec frontend npm test

# Run tests once (CI mode)
docker-compose exec frontend npm test -- --watchAll=false --coverage

๐Ÿš€ Deployment

๐Ÿณ Production Deployment (Recommended)

  1. Prepare production environment:

    # Create production docker-compose file
    cp infra/docker-compose.yml docker-compose.prod.yml
    # Edit for production settings (ports, environment variables)
  2. Deploy with Docker:

    # Build and run in background
    docker-compose -f docker-compose.prod.yml up --build -d
    
    # Run database migrations
    docker-compose -f docker-compose.prod.yml exec backend alembic upgrade head
    
    # Seed initial data (optional)
    docker-compose -f docker-compose.prod.yml exec backend python scripts/seed_data.py

๐Ÿ–ฅ๏ธ Manual Deployment

For systems without Docker:

Backend Setup

cd backend
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
pip install -r requirements.txt
alembic upgrade head
uvicorn app.main:app --host 0.0.0.0 --port 8000

Frontend Setup

cd frontend
npm install
npm run build
npm start

๐Ÿ’ป Development

๐ŸŽฏ Code Quality Tools

Language Linting Formatting Testing
Python flake8 Black + isort PyTest
TypeScript ESLint Prettier React Testing Library

๐Ÿ—„๏ธ Database Management

# Create new migration
docker-compose exec backend alembic revision --autogenerate -m "Add new feature"

# Apply migrations
docker-compose exec backend alembic upgrade head

# Rollback migration
docker-compose exec backend alembic downgrade -1

# View migration history
docker-compose exec backend alembic history

๐Ÿ“ Project Architecture

discuss-lite/
โ”œโ”€โ”€ ๐Ÿ“ backend/                 # FastAPI Backend
โ”‚   โ”œโ”€โ”€ ๐Ÿ“ app/
โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ“ api/v1/endpoints/  # API route handlers
โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ“ db/               # Database models & connections
โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ“ utils/            # Helper utilities
โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ main.py           # FastAPI application
โ”‚   โ”‚   โ””โ”€โ”€ ๐Ÿ“„ config.py         # Environment configuration
โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ requirements.txt      # Python dependencies
โ”‚   โ””โ”€โ”€ ๐Ÿ“„ Dockerfile           # Backend container config
โ”œโ”€โ”€ ๐Ÿ“ frontend/                # Next.js Frontend
โ”‚   โ”œโ”€โ”€ ๐Ÿ“ src/pages/           # Next.js pages & components
โ”‚   โ”œโ”€โ”€ ๐Ÿ“ src/styles/          # Global styles
โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ package.json         # Node dependencies
โ”‚   โ””โ”€โ”€ ๐Ÿ“„ Dockerfile           # Frontend container config
โ”œโ”€โ”€ ๐Ÿ“ infra/                   # Infrastructure
โ”‚   โ””โ”€โ”€ ๐Ÿ“„ docker-compose.yml   # Local development setup
โ”œโ”€โ”€ ๐Ÿ“ scripts/                 # Utility scripts
โ”‚   โ””โ”€โ”€ ๐Ÿ“„ seed_data.py         # Database seeding
โ”œโ”€โ”€ ๐Ÿ“ .github/workflows/       # CI/CD pipelines
โ””โ”€โ”€ ๐Ÿ“„ README.md               # This file!

๐Ÿค Contributing

We welcome contributions! Here's how to get started:

๐Ÿš€ Quick Setup for Contributors

# Fork and clone
git clone https://github.com/your-username/discuss-lite.git
cd discuss-lite

# Set up development environment
cp .env.example .env
docker-compose up --build

# Run tests before submitting
docker-compose exec backend pytest
docker-compose exec frontend npm test -- --watchAll=false

๐Ÿ“‹ Development Workflow

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-feature
  3. Make your changes with tests
  4. Test thoroughly:
    • Backend: docker-compose exec backend pytest
    • Frontend: docker-compose exec frontend npm test
    • Manual testing in browser
  5. Commit with clear messages: git commit -m "feat: Add amazing feature"
  6. Push to your branch: git push origin feature/amazing-feature
  7. Create a Pull Request with detailed description

๐ŸŽฏ Contribution Guidelines

  • ๐Ÿ“ Code Style: Follow existing patterns and run formatters
  • ๐Ÿงช Testing: Add tests for new features
  • ๐Ÿ“š Documentation: Update docs for API changes
  • ๐Ÿ”„ Compatibility: Ensure backward compatibility
  • ๐ŸŽจ UI/UX: Maintain consistent design patterns

๐Ÿ› Found a Bug?

  1. Check existing Issues
  2. Create a new issue with:
    • Clear title and description
    • Steps to reproduce
    • Expected vs actual behavior
    • Environment details

๐Ÿ’ก Have a Feature Request?

We'd love to hear your ideas! Create an Issue with:

  • Feature description
  • Use case and benefits
  • Implementation ideas (optional)

๐Ÿ“„ License

MIT License - see LICENSE file for details.

Copyright (c) 2025 Ramkrishna

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

๐Ÿ“ž Contact & Support

๐Ÿ™ Acknowledgments

  • FastAPI - The modern Python web framework
  • Next.js - The React framework for production
  • PostgreSQL - The world's most advanced open source database
  • Tailwind CSS - A utility-first CSS framework
  • Docker - Containerization platform

Made with โค๏ธ for the open source community

โญ Star us on GitHub โ€ข ๐Ÿ“– Read the docs โ€ข ๐Ÿš€ Quick start

About

A lightweight, modern, and self-hosted open-source forum platform for small communities. Built with FastAPI, Next.js, and PostgreSQL.

Topics

Resources

License

Stars

Watchers

Forks

Contributors