https://github.com/ajikamaludin-dev/api-raya-ojt
simple rest for on job training i crate for demo project
https://github.com/ajikamaludin-dev/api-raya-ojt
fiber go-redis golang gorm pubsub
Last synced: 29 days ago
JSON representation
simple rest for on job training i crate for demo project
- Host: GitHub
- URL: https://github.com/ajikamaludin-dev/api-raya-ojt
- Owner: ajikamaludin-dev
- Created: 2022-07-25T00:44:18.000Z (almost 4 years ago)
- Default Branch: dev
- Last Pushed: 2022-07-28T08:36:08.000Z (almost 4 years ago)
- Last Synced: 2026-04-07T09:40:22.534Z (3 months ago)
- Topics: fiber, go-redis, golang, gorm, pubsub
- Language: Go
- Homepage:
- Size: 693 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# API Raya OJT
## Requirement
Installed Go
```bash
$ go version
go version go1.18.4 linux/amd64
```
Create a postgresql database
```sql
CREATE DATABASE api_raya_ojt
```
## Setup Project
Clone Project
```bash
git clone https://github.com/ajikamaludin/api-raya-ojt
cd api-raya-ojt
```
Run Install Depedency
```bash
go mod tidy
```
Create env file
```bash
cp .env.example .env
```
Edit `.env` file change your database connection, redis connection and google cloud credentials
```
APP_NAME=note-app
APP_ENV=dev
APP_PORT=3000
DB_NAME=test
DB_HOST=localhost
DB_PORT=5432
DB_USER=aji
DB_PASS=eta
DB_TIMEZONE=Asia/Jakarta
DB_ISMIGRATE=true
JWT_SECRET=IyMjIEdvIEZpYmVyIChCYXNpYyBTZXR1cCk.
JWT_EXPIRED_SECOND=3600
REDIS_HOST=localhost
REDIS_PORT=6379
REDIS_PASSWORD=
GOOGLE_PROJECT_NAME=project-name
GOOGLE_APPLICATION_CREDENTIALS=/path/to/credentials.json
```
Run Rest Api Project (Keep Running) (Automated Migrate Database and Seed)
```bash
go run .
```
Run Service Transaction (Keep Running)
```bash
go run services/main.go
```
## REST Api docs
[Postman Collection](https://raw.githubusercontent.com/ajikamaludin/api-raya-ojt/dev/assets/postman/ApiRaya.Postman_collection.json)
[Postman Environment](https://raw.githubusercontent.com/ajikamaludin/api-raya-ojt/dev/assets/postman/ApiRaya.Postman_environment.json)
Public Api Doc : https://documenter.getpostman.com/view/1829038/UzXM1JEa

## Code overview
### Folders
- `app/models` - Contains all the GORM models and models for request and response
- `app/controllers` - Contains all the controllers
- `app/configs` - Contains all the application configuration files
- `app/repository` - Contains all function to access database layer and redis
- `app/services/services.go` - Contains all package/service use by app to interact
- `pkg/` - Contains all third party librari to access service like gorm to access database or go-redis/client to access redist
- `router/` - Contains all the app routes
- `main.go` - Main app file to start the app
- `services` - Contains service app that works with app
## Project Design
### REST Api Design with Swagger Editor
https://raw.githubusercontent.com/ajikamaludin/api-raya-ojt/dev/assets/schema.yaml
### Database Table Design

### TechStack In Plan
