BDServer/README.md
2025-06-02 19:42:33 +02:00

5.4 KiB

BDServer

A self-hosted blogging platform and content management system with federation support.

Overview

BDServer is a lightweight Python web server designed for personal blogs and websites. It features a complete content management system with user accounts, analytics, federation capabilities, and plugin support - all while using only Python's standard library.

Features

📝 Content Management

  • Create and publish articles with markdown support
  • Organize content in categories/tabs
  • Image upload and management
  • Metadata management (title, description, author, license)
  • Version control for articles

👥 User System

  • Account registration and login
  • Email verification
  • Permission-based publishing
  • Invite system for controlled access

🌐 Federation

  • Connect with other BDServer instances
  • Share content across federated servers
  • Auto-federation capabilities
  • Distributed plugin sharing

📊 Analytics

  • Traffic analysis and visitor tracking
  • RSS subscriber analytics
  • Browser/OS statistics
  • Performance metrics
  • Optimal posting time analysis
  • Source tracking and trend analysis

🔌 Plugin System

  • Extensible architecture
  • Easy plugin installation/removal
  • Hooks for HTML rendering and GET requests
  • Federation-aware plugin distribution

🛡️ Security

  • Anti-DDoS protection
  • Cookie-based authentication
  • Ban system for malicious activity
  • Input validation and sanitization

Quick Start

Installation

  1. Clone the repository:
git clone https://github.com/yourusername/BDServer.git
cd BDServer
  1. No dependencies to install! BDServer uses only Python standard library.

Basic Setup

# Configure your website
python3 run.py --set --title "My Website"
python3 run.py --set --tagline "Welcome to my blog"
python3 run.py --set --domain "example.com"
python3 run.py --set --port 8080

# Create your main account
python3 run.py --set --account yourusername

# Start the server
python3 run.py --run

Your website will be available at http://localhost:8080

Usage

Common Commands

# Server operations
python3 run.py --run              # Start the server
python3 run.py --help             # Show help

# Content management
python3 run.py --create           # Create new article
python3 run.py --render           # Render articles

# Account management
python3 run.py --account          # Manage accounts

# Analytics
python3 run.py --analyse          # View analytics

# Federation
python3 run.py --federation       # Manage federation settings

# Configuration
python3 run.py --set              # Configure settings

Creating Content

  1. Create a new article:
python3 run.py --create
  1. Follow the prompts to set title, description, and content

  2. Publish when ready or save as draft

Managing Plugins

# View available plugins
python3 run.py --plugins

# Install a plugin
python3 run.py --plugins --install plugin_name

# Remove a plugin
python3 run.py --plugins --remove plugin_name

Configuration

Data Storage

BDServer stores all data in ~/.local/share/BDServer/ (or $XDG_DATA_HOME/BDServer/)

Directory Structure

BDServer/
├── pictures/         # Uploaded images
├── tabs/            # Categories
├── logs/            # Server logs
├── accounts/        # User data
├── plugins/         # Installed plugins
└── editing/         # Draft articles

Advanced Configuration

  • Custom CSS: Place default.css in your data directory
  • Favicon: Set with --set --favicon path/to/favicon.ico
  • Email SMTP: Configure with --email commands
  • Tor Support: Set hidden service domain with --set --tor
  • Editor: Change default editor with --set --editor

API

BDServer provides a JSON API for accessing content:

GET /api/articles     # List all articles
GET /api/article/id   # Get specific article
GET /api/tabs         # List categories
GET /api/analytics    # Get analytics data (requires auth)

Federation

Connect your instance to the BDServer network:

# Add a federated server
python3 run.py --federation --add https://example.com

# Enable auto-federation
python3 run.py --federation --auto

Development

Project Structure

BDServer/
├── run.py           # Main entry point
├── modules/         # Core modules
│   ├── API.py       # API endpoints
│   ├── Account.py   # User management
│   ├── Analyse.py   # Analytics
│   ├── Create.py    # Content creation
│   ├── Federation.py # Federation logic
│   ├── Plugins.py   # Plugin system
│   └── ...
├── icons/           # UI icons
└── help/            # Help documentation

Creating Plugins

Plugins are Python files placed in the plugins directory. They can hook into:

  • HTML rendering (html_token_graph)
  • GET requests (get_token_graph)

See existing plugins for examples.

Requirements

  • Python 3.6+
  • Linux/Unix-like OS (Windows WSL supported)
  • No external dependencies!

License

BDServer is released under LICENSE.

Contributing

Contributions are welcome! Please:

  1. Fork the repository
  2. Create a feature branch
  3. Submit a pull request

Support

  • Report issues on GitHub
  • Documentation in /help directory
  • Run with --help flag for command-specific help

Author

Created by J.Y.Amihud (Blender Dumbass)