A modular, full stack blog application built in Go, following Clean Architecture principles.
This project demonstrates a well structured backend serving a server side rendered frontend, with clear separation of concerns, CLI tooling, and database migrations.
- User authentication & authorization
- Admin panel for content management
- Article CRUD operations
- Server-side rendered HTML using Go templates
- PostgreSQL-backed persistence
- Database migrations with Goose
- CLI powered application commands
- Modular architecture with clear boundaries
The application follows a layered, modular structure inspired by Clean Architecture:
├── cmd/ # CLI commands (serve, migrate, seed)
├── internal/
│ ├── domain/ # Core business entities
│ ├── repository/ # Data access layer
│ ├── service/ # Business logic
│ ├── handler/ # HTTP handlers
│ └── middleware/ # HTTP middleware
├── templates/ # Server-side HTML templates
├── static/ # CSS, JS, assets
├── migrations/ # Goose migration files
└── config/ # Configuration management
- Clear separation between domain, service, and infrastructure
- Dependency direction pointing inward (core independent from frameworks)
- CLI based application lifecycle management
- Explicit database migrations
- Minimal global state
- Language: Go (1.18+)
- Architecture: Modular Service–Repository pattern
- Database: PostgreSQL
- Migrations: Goose
- CLI Framework: Cobra
- Frontend: Go HTML Templates
- Styling: Bootstrap 4
- Client-side Enhancements: jQuery
- Go 1.18+
- PostgreSQL (running locally or via Docker)
git clone https://github.com/realwebdev/blog.git
cd blogEnsure PostgreSQL is running.
Update config.yml with your database credentials:
database:
host: localhost
port: 5432
user: postgres
password: postgres
name: blogInitialize the database schema:
go run main.go migrate upPopulate the database with sample users and articles:
go run main.go seed
⚠️ Default admin password ispassword123unlessADMIN_PASSWORDenvironment variable is set.
go run main.go serveVisit:
http://localhost:8080
(or the port defined in your configuration)
- Role based access control
- Admin only content management
- Secure password handling (bcrypt recommended if implemented)
| Command | Description |
|---|---|
serve |
Start HTTP server |
migrate up |
Apply database migrations |
migrate down |
Roll back migrations |
seed |
Populate database with sample data |
If applicable:
go test ./...(Add this section only if you have test coverage — otherwise omit or clarify scope.)
- Server-side rendering chosen for simplicity and SEO-friendliness.
- Goose for migration version control.
- Cobra to separate application lifecycle commands cleanly.
- Clean Architecture to ensure framework-independent core logic.
- API versioning
- REST/JSON API alongside SSR
- Integration tests
- Structured logging
- Dockerized deployment
- CI/CD pipeline
- Pagination & search
- Caching layer (Redis)
This project showcases:
- Backend architecture design in Go
- Database migration management
- Clean separation of business logic
- Full stack Go application development