command
module
Version:
v0.0.0-...-2800834
Opens a new window with list of versions in this module.
Published: Jan 20, 2025
License: MIT
Opens a new window with license information.
Imports: 2
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
README
¶
serverx
A server template combines multiple basic tools
Atchitecture
![Architecture](https://github.com/skyrocketOoO/serverx/raw/2800834e7a7a/manifest/architecture.png)
Integration
- Router: Gin
- Config: Viper
- ORM: Gorm
- Logging: Zerolog
- Cmd: Cobra
- Error trace: erx
- Rest api doc: swaggo/swag
- Logger: Loki x grafana
- Session: JWT
- Validator: go-playground/validator
- DB:
- Benchmark: K6
- format
- Long line format
How to use this project
- Clone the repository
- Change the module name to yours
- Run service(default use stdout logging)
go run . server
Convention
# Check conventions, can integrate into CICD
python3 scripts/convention/check.py
- camelCase: file name, folder name
- PascalCase: json attribute name, db table name, db column name
- Lines must be less than 99 characters, but its soft limit
- Never use init(), except for 3rd-party specify
- Never use fmt.Prinxxx, use log.Debug() instead
Dev environment
- Linux
- Code first (not data first)
- Docker
Directory structure
- api: API route definition
- cmd: Command entry point
- tests: Benchmark and api test with k6
- docs: Documentation
- openapi: Document generated from swaggo
- internal: Go function to not export the main logic
- boot: Initialization processes
- common: Shared utility functions
- controller: The main handler to process business logic
- gen: Code generated by gormx
- global: Global variables and instances
- domain: General domain-level entities like error codes
- job: Periodic or cron job executables
- model: GORM models
- service: Service layer logic
- exter: External services (e.g., Redis, Loki, database)
- inter: Internal services (e.g., validators, schedulers)
- manifest:
- deploy: Deployment-related files
- scripts:
- convention: Convention-checking scripts
Documentation
¶
There is no documentation for this package.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.