[참고자료] https://github.com/create-go-app/fiber-go-template https://github.com/golang-standards/project-layout https://gofiber.io/
- golang
1.18
- fiber
2.34
- web framework
Name | Version | Type |
---|---|---|
gofiber/fiber | v2.34.0 |
core |
gofiber/jwt | v2.2.7 |
middleware |
arsmn/fiber-swagger | v2.31.1 |
middleware |
stretchr/testify | v1.7.1 |
tests |
golang-jwt/jwt | v4.4.1 |
auth |
joho/godotenv | v1.4.0 |
config |
jmoiron/sqlx | v1.3.5 |
database |
jackc/pgx | v4.16.1 |
database |
go-sql-driver/mysql | v1.6.0 |
database |
gorm.io/gorm | v1.23.6 |
database |
go-redis/redis | v8.11.5 |
cache |
swaggo/swag | v1.8.2 |
utils |
google/uuid | v1.3.0 |
utils |
go-playground/validator | v10.10.0 |
utils |
Folder with OpenAPI/Swagger 스펙들.
Main applications for this project.
Private application and library code.. This is the code you don't want others importing in their applications or libraries.
./internal/cache
folder with in-memory cache setup functions (by default, Redis)./internal/database
folder with database setup functions (by default, PostgreSQL)./internal/controllers
folder for functional controllers (used in routes)./internal/entites
folder for describe business models and methods of your project./internal/service
folder for describe queries for models of your project./internal/routes
folder for describe routes of your project
Library code that's ok to use by external applications.. This directory contains all the project-specific code tailored only for your business use case, like configs, middleware, routes or utils.
./pkg/configs
folder for configuration functions./pkg/middleware
folder for add middleware (Fiber built-in and yours)./pkg/repository
folder for describeconst
of your project./pkg/utils
folder with utility functions (server starter, error checker, etc)
Folder with 사용자 문서들.
빌드, 설치, 분석, 기타 작업을 위한 스크립트들.
-
Rename
.env.example
to.env
and fill it with your environment values. -
Install Docker and the following useful Go tools to your system:
- golang-migrate/migrate for apply migrations
- github.com/swaggo/swag for auto-generating Swagger API docs
- github.com/securego/gosec for checking Go security issues
- github.com/go-critic/go-critic for checking Go the best practice issues
- github.com/golangci/golangci-lint for checking Go linter issues
3. Run project by this command:
make docker.run