mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-05-20 05:21:57 +00:00
67ddd8e667cf51ee773a07fea9561fe542fc60db
Merge branch 'development-before-sso' of https://gitlab.com/mbugroup/lti-api into refactor-to-serve/with-middleware
Lumbung Telur Indonesia ERP API (lti-api)
RESTful API for Lumbung Telur Indonesia ERP, built with Go, Fiber, GORM and PostgreSQL.
📦 Tech Stack
- Go + Fiber — Web framework
- GORM — ORM for PostgreSQL
- PostgreSQL — Relational database
- go-playground/validator — Input validation
- JWT — Authentication
- Logrus — Logging
- Fiber middleware — Rate limiting, CORS, recovery, logger
- Air — Hot reload for development
- Docker + Docker Compose — Containerization
- golang-migrate — Database migration tool
🚀 Getting Started
1. Clone Project
git clone https://gitlab.com/mbugroup/lti-api.git
cd lti-api
2. Install Dependencies
go mod tidy
3. Configure Environment
Copy .env.example to .env and adjust the variables (e.g. DATABASE_URL, JWT secrets, etc).
cp .env.example .env
5. Setup Docker
Run initial docker.
make docker-local
4. Migrate Database
Run initial migrations and generate views.
make migrate-up
5. Run App
Run project via Docker
6. Create New Module
make gen feat=user
output:
cmd/
├── api/
│ └── main.go # Application entrypoint (initialize Fiber, load config, connect DB, register route)
internal/
├── config/ # App config (env loader, logger, app settings)
│
├── database/ # Database connection + migration setup
│
├── middleware/ # Global Fiber middleware (auth, logger, recovery, rate limiting)
│
├── modules/ # Feature modules (users, products, suppliers, etc.)
│ ├── <module>/
│ │ ├── controllers/ # HTTP handler layer (receive request, call service, return response)
│ │ ├── dto/ # Data Transfer Objects (request & response payloads, separate from models)
│ │ ├── models/ # GORM models (represent database tables/entities)
│ │ ├── repositories/ # Data access layer (queries to DB, CRUD abstraction)
│ │ ├── services/ # Business logic layer (process rules, orchestrate repository calls)
│ │ ├── validation/ # Request validation (custom rules per module)
│ │ ├── module.go # Module bootstrapper (wire controller, service, repository together)
│ │ └── route.go # Module route (register module routes into Fiber app)
│
├── repository/ # Shared repositories (reusable DB access layer across multiple modules)
│
├── response/ # Standardized API responses (success, error, pagination)
│
├── utils/ # Helper functions (JWT, hashing, constants, enums, etc.)
│
├── validation/ # Shared request validation structs & rules
│
└── route/ # Central route aggregator (load all module routes into main app)
✨ Author
IT Development PT Mitra Berlian Unggas Group
📃 License
This project is private. All rights reserved.
Description
Languages
Go
95.8%
PLpgSQL
3.8%
Go Template
0.3%