Skip to content

Elagoht/bloggo-backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

272 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Bloggo: Blog CMS

Go SQLite GitHub License Builds

A modern, feature-rich blog management system built with Go. Bloggo provides a complete content management solution with post versioning, role-based permissions, statistics tracking, and comprehensive analytics.

✨ Features

πŸ“ Content Management

  • Post Creation & Editing - Rich content management with cover images and metadata
  • Version Control - Track and manage multiple versions of posts with approval workflow
  • Draft System - Save drafts and publish when ready
  • Categories & Tags - Organize content with flexible categorization
  • Cover Images - Upload and serve automatically optimized cover images (resized and saved in WebP format)

πŸ‘₯ User Management

  • Role-Based Access Control - Admin, Editor, and Author roles with granular permissions
  • User Authentication - JWT-based secure authentication
  • Profile Management - User profiles with avatar support
  • Permission System - Fine-grained permission control for different actions

πŸ“Š Analytics & Statistics

  • View Tracking - Track timestamp based post views with user agent analysis
  • Device Analytics - Desktop vs mobile traffic analysis
  • Operating System Detection - Detailed OS statistics
  • Browser Analytics - Browser usage statistics
  • Read Time Calculation - Automatic reading time estimation
  • Performance Optimized - Denormalized read counts for fast retrieval

πŸ”§ Technical Features

  • Modular Architecture - Clean, maintainable codebase with module-based design
  • SQLite Database - Lightweight, embedded database with full SQL support
  • File Storage - Organized file storage system for uploads
  • Rate Limiting - Built-in rate limiting for API protection
  • Caching Headers - Optimized caching for static assets

πŸš€ Quick Start

Prerequisites

Nothing! Bloggo is pre-compiled via github workflows and does not requires any additional software. Just download and run the exacurable from Releases Page

πŸ“ Project Structure

bloggo/
β”œβ”€β”€ cli/                    # Application entry point
β”œβ”€β”€ internal/
β”‚   β”œβ”€β”€ app/               # Application core
β”‚   β”œβ”€β”€ config/            # Configuration management
β”‚   β”œβ”€β”€ db/                # Database initialization and queries
β”‚   β”œβ”€β”€ infrastructure/    # Infrastructure components
β”‚   β”‚   β”œβ”€β”€ bucket/        # File storage abstraction
β”‚   β”‚   β”œβ”€β”€ permissions/   # Permission system
β”‚   β”‚   └── tokens/        # Token management
β”‚   β”œβ”€β”€ middleware/        # HTTP middlewares
β”‚   β”œβ”€β”€ module/            # Feature modules
β”‚   β”‚   β”œβ”€β”€ category/      # Category management
β”‚   β”‚   β”œβ”€β”€ post/          # Post management
β”‚   β”‚   β”œβ”€β”€ session/       # Authentication
β”‚   β”‚   β”œβ”€β”€ statistics/    # Analytics
β”‚   β”‚   β”œβ”€β”€ storage/       # File serving
β”‚   β”‚   β”œβ”€β”€ tag/           # Tag management
β”‚   β”‚   └── user/          # User management
β”‚   └── utils/             # Utility packages
β”œβ”€β”€ uploads/               # File storage directory
β”œβ”€β”€ .env                  # Environment variables (create from .env.example)
β”œβ”€β”€ bloggo.sqlite         # SQLite database
β”œβ”€β”€ go.mod                # Go module definition
└── LICENSE               # GPLv3 License

πŸ”§ Configuration

Configuration is managed through environment variables. Create a .env file from .env.example:

cp .env.example .env

Key environment variables include:

  • PORT - Server port (default: 8723)
  • JWT_SECRET - JWT signing secret (required, min 32 characters)
  • ACCESS_TOKEN_DURATION - Access token lifetime in seconds (default: 900)
  • REFRESH_TOKEN_DURATION - Refresh token lifetime in seconds (default: 604800)
  • GEMINI_API_KEY - Google Gemini API key (optional, for AI features)
  • TRUSTED_FRONTEND_KEY - Key for trusted frontend requests (required, min 32 characters)

πŸ—„οΈ Database Schema

The application uses SQLite with the following main entities:

  • Users - User accounts and profiles
  • Roles & Permissions - Role-based access control
  • Posts & Post Versions - Content with version control
  • Categories & Tags - Content organization
  • Post Views - Analytics and tracking
  • Sessions - Authentication management

πŸ›‘οΈ Security Features

  • JWT Authentication - Secure token-based authentication
  • Password Hashing - bcrypt password hashing
  • Rate Limiting - Protection against abuse
  • Input Validation - Comprehensive input validation
  • SQL Injection Protection - Parameterized queries

πŸ“ˆ Performance

  • Optimized Queries - Efficient database queries with proper indexing
  • Denormalized Counters - Fast read counts without expensive aggregations
  • Caching Headers - Proper HTTP caching for static assets
  • Connection Pooling - Efficient database connection management
  • Modular Loading - Lazy loading of modules and dependencies

πŸ§ͺ Development

Code Structure

  • Modular Design - Each feature is a self-contained module
  • Repository Pattern - Clean separation of data access
  • Service Layer - Business logic abstraction
  • Handler Layer - HTTP request handling

Dev Dependencies

  • Chi Router - Fast HTTP router
  • SQLite3 - Embedded database
  • JWT - JSON Web Tokens for authentication
  • Validator - Request validation
  • WebP - Image processing and optimization

πŸ“œ License

This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.

🀝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.

πŸ“ž Support

If you encounter any issues or have questions, please open an issue in the repository.


Bloggo - A modern blog management system built with ❀️ and Go

About

Blog

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages