Skip to content

C0lliNN/EbookStore

Repository files navigation

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

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

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

  1. Execute docker containers
make docker-up
  1. Execute REST HTTP Server
make start_server
  1. Open http://localhost:8080/docs in your browser

How to Lint Project

  1. Install golangci-lint
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
  1. Execute lint target
make lint

How to Use Husky Git pre-commit hook

Pre-commit hooks are very useful to prevent commits with bad code.

  1. Install Husky
go install github.com/go-courier/husky/cmd/husky@latest
  1. Init Husky
husky init

How Generate Seed Data

  1. Execute docker containers
make docker-up
  1. Clean database and generate seed data
make generate_seed_data

How to Regenerate Mocks

  1. Install Mockery
go install github.com/vektra/mockery/v2@latest
  1. Generate Mocks
make generate-mocks

How to Regenerate REST API Documentation

  1. Install Swaggo
go install github.com/swaggo/swag/cmd/swag@v1.7.8
  1. Generate Docs
make api-docs

How to Regenerate Dependency Initialization

  1. Install wire
go install github.com/google/wire/cmd/wire@latest
  1. Execute wire
make wire

Languages