{"id":17863983,"url":"https://github.com/hidayatarg/go-crud","last_synced_at":"2025-04-07T22:29:28.077Z","repository":{"id":171285340,"uuid":"647298004","full_name":"hidayatarg/go-crud","owner":"hidayatarg","description":"This a template of GoLang Web API, Using the Gin Framework and GO ORM with PostgreSQL Database","archived":false,"fork":false,"pushed_at":"2023-07-03T21:04:15.000Z","size":41,"stargazers_count":0,"open_issues_count":4,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-06-21T06:26:46.485Z","etag":null,"topics":["gin-gonic","godev","golang","goorm","postgresql","webapi"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hidayatarg.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-05-30T13:32:41.000Z","updated_at":"2023-06-03T10:18:06.000Z","dependencies_parsed_at":null,"dependency_job_id":"6c6a1178-6618-4205-800d-5bbbed1c1c76","html_url":"https://github.com/hidayatarg/go-crud","commit_stats":null,"previous_names":["hidayatarg/go-crud"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hidayatarg%2Fgo-crud","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hidayatarg%2Fgo-crud/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hidayatarg%2Fgo-crud/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hidayatarg%2Fgo-crud/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hidayatarg","download_url":"https://codeload.github.com/hidayatarg/go-crud/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247740153,"owners_count":20988164,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gin-gonic","godev","golang","goorm","postgresql","webapi"],"created_at":"2024-10-28T09:06:01.280Z","updated_at":"2025-04-07T22:29:28.047Z","avatar_url":"https://github.com/hidayatarg.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Go Web API\n\nThis a template of GoLang Web API, using the Gin framework and Go ORM with PostgreSQL Database.\n\nBy Hidayat Arghandabi 2023\n\n#### Implementations\n\nLast Update 06/19/2023\n\n- HTTP Request\n- Authorization and Authentication\n- Middleware (Auth, Logger)\n- PostgreSQL DB\n- Containerization\n- .env\n- Migration\n\n## How to run using docker container\n\nRun the `docker-compose up` command\n\n## How to run/use this template without docker containers\n\n1. Update DB Connection String in the .env file\n2. Create migration located in migrate/migrate.go using `go run migrate/migrate.go`. It will create the posts and users table in the database.\n3. Install packages `go mod tidy`\n4. You can run the project from main.go using the vscode debugger or `CompileDaemon -command=\"./go-crud\"` the Daemon tool, make sure it is installed.\n5. Enjoy this project\n\n## Initalization\n\n`go mod init` creating a go mod file (like a node file for nodejs projects)\n\n## Required Packages\n\n1.  `go get github.com/githubnemo/CompileDaemon` and install it, so that it can be run as command-line tool `go install github.com/githubnemo/CompileDaemon` watch files for changes and rebuild\n2.  `go get github.com/joho/godotenv` Easy to load environment variables\n3.  `go get -u github.com/gin-gonic/gin` Gin Framework for Http Server\n4.  `go get -u gorm.io/gorm` and `go get -u gorm.io/driver/postgres` Go ORM Library for Go\n5.  `go get -u github.com/sirupsen/logrus` Package for logging in a Gin application\n6.  `go get github.com/redis/go-redis/v9` Package for Redis go\n\n#### for JWT authentication\n\n5. `go get -u golang.org/x/crypto/bcrypt` for cryptography visit https://pkg.go.dev/golang.org/x/crypto\n6. `go get -u github.com/golang-jwt/jwt/v4` jwt package visit https://pkg.go.dev/github.com/golang-jwt/jwt or https://github.com/golang-jwt/jwt\n\n## Running Development Server\n\n`CompileDaemon -command=\"./go-crud\"` Run the Daemon and given the package name\n\n## Declaring Models\n\nhttps://gorm.io/docs/models.html visit the link to see how to declare your models.\nwe are using the following model\n\n```go\n\ntype User struct {\n  gorm.Model\n  Name string\n}\n// equals\ntype User struct {\n  ID        uint           `gorm:\"primaryKey\"`\n  CreatedAt time.Time\n  UpdatedAt time.Time\n  DeletedAt gorm.DeletedAt `gorm:\"index\"`\n  Name string\n```\n\nto make auto `db.AutoMigrate(\u0026Product{})` visit link https://gorm.io/docs/index.html\n\nas migrate/migrate.go is created run the migration using\n`go run migrate/migrate.go`, It will make the posts table in the database.\n\n## Go ORM Create\n\nvisit the link https://gorm.io/docs/create.html for Go ORM\n\n## Important Commands\n\n- `docker-compose up --build`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhidayatarg%2Fgo-crud","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhidayatarg%2Fgo-crud","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhidayatarg%2Fgo-crud/lists"}