api-golang-template

module
v0.0.0-...-a9081ec Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 3, 2023 License: MIT

README

Golang Hexagonal Architecture Template 💎

This repository provides a Golang template for building scalable and maintainable applications using the Hexagonal Architecture pattern. The goal is to present a way of creating applications with a good project structure that scales very well, using some of the best practices in the ecosystem.

The goal of this repo is to serve as a guide and collection of resources for developers who want to build scalable and maintainable applications in Go. The template showcases solving most of the real-world problems of an application in a practical way and helps developers write better applications.

Disclaimer:

Feel free to explore the codebase to understand the architecture and get the most value out of the repo. However, keep in mind that this is not a one-size-fits-all solution. The template is opinionated, and you should decide what works best for you and your team. Use the template as a starting point and tailor it to fit your specific needs.

Table of contents

Contributing

Contributions are always welcome! If you have any ideas, suggestions, or fixes, feel free to contribute. You can do that by going through the following steps:

  1. Clone this repo
  2. Create a branch: git checkout -b your-feature
  3. Make some changes
  4. Test your changes
  5. Push your branch and open a Pull Request

License

MIT

Directories

Path Synopsis
api
rest
Package rest GENERATED BY SWAG; DO NOT EDIT This file was generated by swaggo/swag
Package rest GENERATED BY SWAG; DO NOT EDIT This file was generated by swaggo/swag
cmd
monolith
Monolith contain all microservice that will be launched as webserver All initialization of the required service, repository and handler are here.
Monolith contain all microservice that will be launched as webserver All initialization of the required service, repository and handler are here.
monolith/initsrv
Package initsrv will contain all initialization of the required service, repository and handler.
Package initsrv will contain all initialization of the required service, repository and handler.
internal
client
Package client contains the client initialization function.
Package client contains the client initialization function.
client/database
Package database initialize all the needed database client.
Package database initialize all the needed database client.
configs
Package configs loads environment variables and exposes them to the application.
Package configs loads environment variables and exposes them to the application.
ent
Package ent contains the schema for frontend entities.
Package ent contains the schema for frontend entities.
ent/schema
Package schema contains the schema definition for the ent package.
Package schema contains the schema definition for the ent package.
ent/schema/mixin/timemixin
Package timemixin implements the ent.Mixin about time fields.
Package timemixin implements the ent.Mixin about time fields.
handler/rest
Package rest provides a server and handlers for RESTful HTTP requests.
Package rest provides a server and handlers for RESTful HTTP requests.
handler/rest/admin/profile/adminsettinghandler
Package adminsettinghandler provide a server and handlers for RESTful HTTP requests.
Package adminsettinghandler provide a server and handlers for RESTful HTTP requests.
handler/rest/authentication/authenticationhandler
Package authenticationhandler provide a server and handlers for RESTful HTTP requests.
Package authenticationhandler provide a server and handlers for RESTful HTTP requests.
handler/rest/gincontext
Package gincontext provides funtcion to get ent entity from gin context
Package gincontext provides funtcion to get ent entity from gin context
handler/rest/middlewares
Package middlewares provide a middleware used in handlers for RESTful HTTP requests.
Package middlewares provide a middleware used in handlers for RESTful HTTP requests.
primitive
Package primitive contains irreducible types that are shared by all layers of the application.
Package primitive contains irreducible types that are shared by all layers of the application.
service
Package service contains the application's business logic.
Package service contains the application's business logic.
service/admin/adminservice
Package adminservice holds the business logic and data structures associated with the admin domain.
Package adminservice holds the business logic and data structures associated with the admin domain.
service/bucket/bucketservice
Package bucketservice holds the business logic and data structures associated with the bucket domain.
Package bucketservice holds the business logic and data structures associated with the bucket domain.
service/mailerservice
Package mailerservice holds the business logic and data structures associated with the mailer domain.
Package mailerservice holds the business logic and data structures associated with the mailer domain.
service/student/studentservice
Package studentservice holds the business logic and data structures associated with the student domain.
Package studentservice holds the business logic and data structures associated with the student domain.
service/token/tokenservice
Package tokenservice holds the business logic and data structures associated with the token domain.
Package tokenservice holds the business logic and data structures associated with the token domain.
storage
Package storage contain all repository.
Package storage contain all repository.
storage/mailgun
Package mailejet holds the repository logic associated with the mailgun domain.
Package mailejet holds the repository logic associated with the mailgun domain.
storage/mailgun/mailerrepo
Package mailerrepo provides a repository to interact with the mailgun mailer
Package mailerrepo provides a repository to interact with the mailgun mailer
storage/mariadb/admin/adminrepo
Package adminrepo holds the repository logic associated with the admin domain.
Package adminrepo holds the repository logic associated with the admin domain.
storage/mariadb/student/studentrepo
Package studentrepo holds the repository logic associated with the student domain.
Package studentrepo holds the repository logic associated with the student domain.
storage/redis/tokenrepo
Package tokenrepo holds the repository logic associated with the token domain.
Package tokenrepo holds the repository logic associated with the token domain.
storage/s3
Package s3repo holds the repository logic associated with the student session domain.
Package s3repo holds the repository logic associated with the student session domain.
storage/s3/bucketrepo
Package bucketrepo holds the repository logic associated with the bucket domain.
Package bucketrepo holds the repository logic associated with the bucket domain.
tracing
Package tracing contains tracing initialization client.
Package tracing contains tracing initialization client.
utils
Package utils contains utils function that are shared by all layers of the application.
Package utils contains utils function that are shared by all layers of the application.
pkg
apistatus
Package apistatus provides utility functions for working with api error.
Package apistatus provides utility functions for working with api error.
pagination
Package pagination contains the pagination struct and methods
Package pagination contains the pagination struct and methods
slice
Package slice provides utility functions for working with slices.
Package slice provides utility functions for working with slices.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL