EbookStore
EbookStore copied to clipboard
A fully-featured REST API developed in Golang for an online book store.
E-book Store
A fully-featured REST API developed in Golang for an ebook store.
Check out the TODO.md if you want to have some fun 😇
Table of Contents
- Features
- Tech/Libraries
- High-level Documentation
- System Context Diagram
- Backend Container Diagram
- Design Principles / Techniques
- Local Development
- How to Run Locally
- How to Lint Project
- How to Use Husky Git pre-commit hook
- How Generate Seed Data
- How to Regenerate Mocks
- How to Regenerate REST API Documentation
- How to Regenerate Dependency Initialization
Product Features
- Authentication (Sign up, Login and Reset Password)
- Multiple Roles (Customer and Administrator)
- Book Catalog Management
- Order Management
- Pagination
- Order Creation
- File Storage/Retrieval
- Payment Management
Tech/Libraries
- Golang
- Gin
- PostgreSQL
- GORM
- JWT
- Bcrypt
- Wire
- Viper
- Zap
- Stripe
- Amazon S3
- Amazon SES
- Swagger
- Localstack
- Testify
- golangci-lint
High-level Documentation
This is a high-level technical documentation about how this application is structured. The diagrams follow the C4 model
System Context Diagram

Backend Container Diagram

Infrastructure Diagram

Design Principles / Techniques
- SOLID Principles
- Hexagonal Architecture
- Domain Driver Design
- Package by Feature
- Test-Driven-Development
Local Development
How to Run Locally
- Execute docker containers
make docker-up
- Execute REST HTTP Server
make start_server
- Open
http://localhost:8080/docsin your browser
How to Lint Project
- Install golangci-lint
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
- Execute
linttarget
make lint
How to Use Husky Git pre-commit hook
Pre-commit hooks are very useful to prevent commits with bad code.
- Install Husky
go install github.com/go-courier/husky/cmd/husky@latest
- Init Husky
husky init
How Generate Seed Data
- Execute docker containers
make docker-up
- Clean database and generate seed data
make generate_seed_data
How to Regenerate Mocks
- Install Mockery
go install github.com/vektra/mockery/v2@latest
- Generate Mocks
make generate-mocks
How to Regenerate REST API Documentation
- Install Swaggo
go install github.com/swaggo/swag/cmd/[email protected]
- Generate Docs
make api-docs
How to Regenerate Dependency Initialization
- Install wire
go install github.com/google/wire/cmd/wire@latest
- Execute wire
make wire