An application backend or RESTful API server for https://github.com/armandwipangestu/gis-ui
A simple RESTful API for GIS Application built using Golang, Gin, and GORM
- Simple Migration & Seeder
- Simple clean architecture: routes -> controller -> struct -> helper -> models
- Support build manual, binary release, and Docker image
- Go 1.25+
- MariaDB 12.0.2
- Git
- Docker & Docker Compose (optional)
. gis-api
├── bruno
│ └── 'GIS API'
│ ├── Auth
│ │ ├── folder.bru
│ │ └── Login.bru
│ ├── bruno.json
│ ├── Category
│ │ ├── 'Create Categories.bru'
│ │ ├── 'Delete Categories By Id.bru'
│ │ ├── folder.bru
│ │ ├── 'Get All Categories.bru'
│ │ ├── 'Get Categories.bru'
│ │ ├── 'Get Categories By Id.bru'
│ │ └── 'Update Categories By Id.bru'
│ ├── Dashboard
│ │ ├── folder.bru
│ │ └── 'Get Dashboard.bru'
│ ├── environments
│ │ └── development.bru
│ ├── Map
│ │ ├── 'Create Maps.bru'
│ │ ├── 'Delete Maps By Id.bru'
│ │ ├── folder.bru
│ │ ├── 'Get Maps.bru'
│ │ ├── 'Get Maps By Id.bru'
│ │ └── 'Update Maps By Id.bru'
│ ├── Permission
│ │ ├── 'Create Permission.bru'
│ │ ├── 'Delete Permission By Id.bru'
│ │ ├── folder.bru
│ │ ├── 'Get All Permissions.bru'
│ │ ├── 'Get Permission By Id.bru'
│ │ ├── 'Get Permissions.bru'
│ │ └── 'Update Permission By Id.bru'
│ ├── Public
│ │ ├── folder.bru
│ │ ├── 'Get Categories.bru'
│ │ └── 'Get Settings.bru'
│ ├── Role
│ │ ├── 'Create Role.bru'
│ │ ├── 'Delete Roles By Id.bru'
│ │ ├── folder.bru
│ │ ├── 'Get All Roles.bru'
│ │ ├── 'Get Roles.bru'
│ │ ├── 'Get Roles By Id.bru'
│ │ └── 'Update Roles By Id.bru'
│ ├── Setting
│ │ ├── folder.bru
│ │ ├── 'Get Settings.bru'
│ │ └── 'Update Settings.bru'
│ └── User
│ ├── 'Create User.bru'
│ ├── 'Delete Users By Id.bru'
│ ├── folder.bru
│ ├── 'Get Users.bru'
│ ├── 'Get Users By Id.bru'
│ └── 'Update Users By Id.bru'
├── CHANGELOG.md
├── config
│ └── config.go
├── controllers
│ ├── admin
│ │ ├── category_controller.go
│ │ ├── dashboard_controller.go
│ │ ├── map_controller.go
│ │ ├── permission_controller.go
│ │ ├── role_controller.go
│ │ ├── setting_controller.go
│ │ └── user_controller.go
│ ├── auth
│ │ └── login_controller.go
│ └── public
│ ├── category_controller.go
│ └── setting_controller.go
├── database
│ ├── database.go
│ └── seeders
│ ├── permissions.go
│ ├── roles.go
│ ├── seed.go
│ ├── setting.go
│ └── users.go
├── docker-compose.yml
├── Dockerfile
├── go.mod
├── go.sum
├── helpers
│ ├── hash.go
│ ├── jwt.go
│ ├── pagination.go
│ ├── permission.go
│ ├── slug.go
│ ├── upload.go
│ └── validator.go
├── main.go
├── middlewares
│ ├── auth_middleware.go
│ └── permission_middleware.go
├── models
│ ├── category.go
│ ├── map.go
│ ├── permission.go
│ ├── role.go
│ ├── setting.go
│ └── user.go
├── README.md
├── routes
│ └── routes.go
└── structs
├── category.go
├── dashboard.go
├── error_response.go
├── map.go
├── permission.go
├── role.go
├── setting.go
├── success_response.go
└── user.go- Clone Repostory & Install dependencies
git clone https://github.com/armandwipangestu/gis-api && cd gis-api
go mod tidy- Setup Environment Variable
cp .env.example .envFill with your own configuration
# App Configuration
APP_PORT=3000
# Database Configuration
DB_HOST=localhost
DB_PORT=3306
DB_USER=root
DB_PASS=
DB_NAME=golang_gis
# You can generate the random string using this tool https://jwtsecrets.com/#generator
JWT_SECRET=<random_string>- Create Database
CREATE DATABASE golang_gis;- Install air-verse (hot reload)
go install github.com/air-verse/air@latest- Running the application
Note
Access the API at http://localhost:3000
air- Compile to make executable file
Tip
To compile for difference architecture (like Linux AMD64)
GOOS=linux GOARCH=amd64 go build -o dist/gis-api ./main.gogo build -o dist/gis-api ./main.go- Setup Environment Variable
cp .env.example .envFill with your own configuration
# App Configuration
APP_PORT=3000
# Database Configuration
DB_HOST=localhost
DB_PORT=3306
DB_USER=root
DB_PASS=
DB_NAME=golang_gis
# You can generate the random string using this tool https://jwtsecrets.com/#generator
JWT_SECRET=<random_string>- Running the executable file
./dist/gis-api- Build the image
docker build -t gis-api .- Run the image
docker run -p 3000:3000 --env-file .env gis-api- Copy the
.env.exampleand.env.example.mysql
cp .env.example .env
cp .env.example.mysql .env.mysql- Fill the value of
.envand.env.mysqlwith your own configuration
# App Configuration
APP_PORT=3000
# Database Configuration
DB_HOST=localhost
DB_PORT=3306
DB_USER=root
DB_PASS=
DB_NAME=golang_gis
# You can generate the random string using this tool https://jwtsecrets.com/#generator
JWT_SECRET=<random_string>MYSQL_ROOT_PASSWORD="<your_password>"
MYSQL_DATABASE="golang_gis"
MYSQL_USER="root"
MYSQL_PASSWORD="<your_password>"- Runing the application using compose
docker compose up -d