# README
Go-SQLite-Blog
Go-SQLite-Blog is a lightweight, full-featured blogging platform written in Go (Golang). It uses SQLite for data storage, making it easy to set up without the need for a separate database server. Ideal for personal blogs, Go-SQLite-Blog offers essential features for content creation and management.
Table of Contents
Features
- Admin Friendly: Easy to use, manage and backup - there is just the executable and the database file
- User Management: Support for multiple user roles (admin, editor, author)
- Article Management: Create, edit, and delete blog posts with Markdown support
- Comments: Enable readers to leave comments on posts (with moderation options)
- Categories and Tags: Organize posts using categories and tags
- Media Uploads: Upload and manage images and other media files
- Static Pages: Create static pages like "About Us" or "Contact"
- Search Functionality: Full-text search on articles
- Pagination: Navigate through posts with ease
Demo
Check out a live demo of Go-SQLite-Blog here. - Coming Soon
Getting Started
With Docker
- Install Docker
- Run
docker run -it --rm -v ~/.ssh:/home/developer/.ssh -v $(pwd):/workspace -w /workspace andreheber/go-sqlite-blog-dev:latest
On your local machine
Prerequisites
- Go 1.22 or higher
- Git
Installation
-
Clone the repository:
git clone https://github.com/AndreHeber/go-sqlite-blog.git cd go-sqlite-blog
-
Install dependencies:
go mod download
-
Build the application:
go build -o go-sqlite-blog
Usage
Configuration
Before running the application, you can configure settings in the config.yaml
file:
app:
port: 8080
templates_dir: templates
static_dir: static
database:
path: ./data/Go-SQLite-Blog.db
Running the Application
- Start the server
./go-sqlite-blog
-
Access the application
Open your web browser and navigate to http://localhost:8080.
Project Structure
Go-SQLite-Blog/
├── cmd/
│ └── Go-SQLite-Blog/
│ └── main.go # Entry point of the application
├── internal/
│ ├── db/
│ │ └── sqlite.go # Database connection and queries
│ ├── handlers/
│ │ ├── article.go # Handlers for article routes
│ │ ├── user.go # Handlers for user routes
│ │ └── comment.go # Handlers for comment routes
│ ├── models/
│ │ ├── article.go # Article model
│ │ ├── user.go # User model
│ │ └── comment.go # Comment model
│ └── templates/ # HTML templates
├── static/ # Static files (CSS, JS, images)
├── config.yaml # Configuration file
├── schema.sql # Database schema
├── go.mod # Go module file
├── LICENSE
└── README.md
Database Schema
Go-SQLite-Blog uses SQLite with the following tables:
users: Manage user accounts and roles.
articles: Store blog posts with metadata.
comments: Allow users to comment on articles.
categories: Organize articles into categories.
article_categories: Link articles to categories (many-to-many relationship).
tags: Tag articles for detailed classification.
article_tags: Link articles to tags (many-to-many relationship).
media: Manage uploaded media files.
pages: Create static pages.
settings: Store application settings.
Refer to the schema.sql file for detailed definitions.
Contributing
Contributions are welcome! Please follow these steps:
- Fork the repository
git clone https://github.com/yourusername/go-sqlite-blog.git
cd go-sqlite-blog
- Create a feature branch
git checkout -b feature/YourFeature
-
Make your changes
-
Run the tests
go test ./...
- Commit your changes
git commit -m 'Add YourFeature'
- Push to the branch
git push origin feature/YourFeature
- Open a pull request
License
This project is licensed under the MIT License. See the LICENSE file for details.