Example project of an authentication system using Go
Follow these steps to install the project:
- Clone the repository:
git clone https://github.com/lfcifuentes/auth-ddd
- Navigate to the project directory:
cd auth-ddd
- Install the dependencies:
go mod tidy
Here is a list of the available commands in the Makefile and their description:
Starts the Docker containers in the background.
make docker_up
Stops and removes the Docker containers.
make docker_down:
Generates the API documentation using swag.
make docs_generate
Formats the documentation code using swag.
make docs_format
Run migrations
make migrate
Add new migration
make add_migration name=mew_migration_name
Rollback all migrations
make migrate_down
Rollback a specific migration
make migrate_down steps=1
Run test
make test
Run test with coverage
make test_coverage
/app
/cmd
server.go # Entry point of the application
/db
/migrations # Database migrations
/infraestructure
/http
/middleware # Api Rest Middleware
/router # API base route definitions
/internal
/adapters
/pgsql # PostgreSQL database adapter
/validator # Playground Validator adapter
/modules
/auth
/domain
/entities
user.go # User entity definition
/services
auth_services.go # Domain services for authentication
/application
/usecases
login_usecase.go # Use case for user login
/data
/repositories
auth_repository.go # Repository for user data
/pkg
jwt.go # JWT utility
docker-compose # Docker compose configuration file
Makefile # Makefile with project commands
README.md # Project documentation
go.mod # Go module file
go.sum # Go dependencies file