VoAr is a backend web application written in Go that demonstrates modern backend engineering practices, including layered architecture, PostgreSQL integration, Redis Cache-Aside caching, request lifecycle management, structured logging, and graceful shutdown.
- User registration and authentication
- Session-based authorization
- User profiles
- Post publishing
- Comment system
- Notification system
- Server-side HTML rendering
- Redis Cache-Aside caching
- Structured logging
- Context propagation
- Graceful shutdown
- Database migrations
HTTP Request
│
▼
Middleware
│
▼
Handlers
│
▼
Services
├── Cache
└── Repository
│
▼
PostgreSQL
Redis is integrated using the Cache-Aside pattern with automatic fallback to a NoOp cache implementation when Redis is unavailable.
- Go
- PostgreSQL
- Redis
- Docker
- Docker Compose
- golang-migrate
- gorilla/mux
- gorilla/sessions
- bcrypt
- lib/pq
- go-redis/v9
cmd/
└── voar/
db/
└── migrations/
internal/
├── cache/
├── contextkeys/
├── database/
├── handler/
├── logger/
├── middleware/
├── models/
├── repository/
└── service/
pkg/
└── google/
web/
├── css/
└── templates/
Current schema:
- users
- posts
- comments
- notifications
Relationships:
User
├── Posts
├── Comments
└── Notifications
Post
└── Comments
Database schema is managed through versioned SQL migrations.
git clone https://github.com/ArsenVoar/VoAr.git
cd VoArCreate a .env file:
SESSION_SECRET=your_secret
DB_HOST=localhost
DB_PORT=5432
DB_USER=postgres
DB_PASSWORD=your_password
DB_NAME=voarEither run them manually or with Docker.
migrate -path db/migrations -database "postgres://postgres:your_password@localhost:5432/voar?sslmode=disable" upgo run ./cmd/voarApplication:
http://localhost:8080
Build and start all services:
docker compose up --buildRun tests:
go test ./...Run static analysis:
go vet ./...- Layered architecture
- Dependency Injection
- Repository pattern
- Middleware composition
- Context propagation
- Structured logging
- Graceful shutdown
- Database transactions
- Redis Cache-Aside
- Session-based authentication
- Request lifecycle management