https://github.com/imthaghost/echo-go-template
https://github.com/imthaghost/echo-go-template
Last synced: 11 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/imthaghost/echo-go-template
- Owner: imthaghost
- Created: 2021-09-23T17:15:04.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2021-09-29T04:52:17.000Z (almost 5 years ago)
- Last Synced: 2025-02-11T20:50:57.249Z (over 1 year ago)
- Language: Go
- Size: 1.98 MB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Echo template for [Create Go App CLI](https://github.com/create-go-app/cli)
[Echo](https://github.com/labstack/echo) is a high performance, minimalist Go web framework.
## β‘οΈ Quick start
1. Create a new project with Echo:
```bash
cgapp create
# Choose a backend framework:
# > echo
# fiber
# net/http
```
## Development
Prerequisites:
- [Go](https://golang.org)
- [Docker](https://github.com/google/protobuf)
### Run tests
```
make test
```
### Run static code analysis
```shell
make lint
```
### Run code coverage
```shell
make coverage
```
### Run the server
```shell
## with Go
make local
```
```shell
## with Docker
make docker.run
```
5. Go to API Docs page (Swagger): [127.0.0.1:5000/swagger/index.html](http://127.0.0.1:5000/swagger/index.html)

## π Template structure
### ./cmd
```
βββ cmd
β βββ template
β βββ main.go
β...
```
**Folder with business logic only**. This directory doesn't care about _what database driver you're using_ or _which caching solution your choose_ or any third-party things.
- `./app/controllers` folder for functional controllers (used in routes)
- `./app/models` folder for describe business models and methods of your project
- `./app/queries` folder for describe queries for models of your project
### ./docs
**Folder with API Documentation**. This directory contains config files for auto-generated API Docs by Swagger.
### ./internal
```
βββ internal
βΒ Β βββ api
βΒ Β βΒ Β βββ models
βΒ Β βββ cache
βΒ Β βββ datastore
βΒ Β βββ middleware
βΒ Β βββ migrations
βΒ Β βββ redis
βΒ Β βββ token
```
[comment]: <> (**Folder with project-specific functionality**. This directory contains all the project-specific code tailored only for your business use case, like _configs_, _middleware_, _routes_ or _utils_.)
[comment]: <> (- `./pkg/configs` folder for configuration functions)
[comment]: <> (- `./pkg/middleware` folder for add middleware (Fiber built-in and yours))
[comment]: <> (- `./pkg/repository` folder for describe `const` of your project)
[comment]: <> (- `./pkg/routes` folder for describe routes of your project)
[comment]: <> (- `./pkg/utils` folder with utility functions (server starter, error checker, etc))
[comment]: <> (### ./platform)
[comment]: <> (**Folder with platform-level logic**. This directory contains all the platform-level logic that will build up the actual project, like _setting up the database_ or _cache server instance_ and _storing migrations_.)
[comment]: <> (- `./platform/cache` folder with in-memory cache setup functions (by default, Redis))
[comment]: <> (- `./platform/database` folder with database setup functions (by default, PostgreSQL))
[comment]: <> (- `./platform/migrations` folder with migration files (used with [golang-migrate/migrate](https://github.com/golang-migrate/migrate) tool))
[comment]: <> (## βοΈ Configuration)
[comment]: <> (```ini)
[comment]: <> (# .env)
[comment]: <> (# Stage status to start server:)
[comment]: <> (# - "dev", for start server without graceful shutdown)
[comment]: <> (# - "prod", for start server with graceful shutdown)
[comment]: <> (STAGE_STATUS="dev")
[comment]: <> (# Server settings:)
[comment]: <> (SERVER_HOST="0.0.0.0")
[comment]: <> (SERVER_PORT=5000)
[comment]: <> (SERVER_READ_TIMEOUT=60)
[comment]: <> (# JWT settings:)
[comment]: <> (JWT_SECRET_KEY="secret")
[comment]: <> (JWT_SECRET_KEY_EXPIRE_MINUTES_COUNT=15)
[comment]: <> (JWT_REFRESH_KEY="refresh")
[comment]: <> (JWT_REFRESH_KEY_EXPIRE_HOURS_COUNT=720)
[comment]: <> (# Database settings:)
[comment]: <> (DB_HOST="cgapp-postgres")
[comment]: <> (DB_PORT=5432)
[comment]: <> (DB_USER="postgres")
[comment]: <> (DB_PASSWORD="password")
[comment]: <> (DB_NAME="postgres")
[comment]: <> (DB_SSL_MODE="disable")
[comment]: <> (DB_MAX_CONNECTIONS=100)
[comment]: <> (DB_MAX_IDLE_CONNECTIONS=10)
[comment]: <> (DB_MAX_LIFETIME_CONNECTIONS=2)
[comment]: <> (# Redis settings:)
[comment]: <> (REDIS_HOST="cgapp-redis")
[comment]: <> (REDIS_PORT=6379)
[comment]: <> (REDIS_PASSWORD="")
[comment]: <> (REDIS_DB_NUMBER=0)
[comment]: <> (```)
## β οΈ License
Apache 2.0 Β© [Vic ShΓ³stak](https://shostak.dev/) & [True web artisans](https://1wa.co/).