{"id":17038548,"url":"https://github.com/titusjaka/go-sample","last_synced_at":"2026-04-28T21:31:23.972Z","repository":{"id":54441464,"uuid":"334610265","full_name":"titusjaka/go-sample","owner":"titusjaka","description":"Go Backend Sample with the modular structure.","archived":false,"fork":false,"pushed_at":"2024-05-06T10:09:14.000Z","size":170,"stargazers_count":3,"open_issues_count":2,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-05-07T09:47:15.404Z","etag":null,"topics":["backend","clean-architecture","golang","postgres","restful-api"],"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/titusjaka.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"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":"2021-01-31T08:43:14.000Z","updated_at":"2024-05-28T09:27:15.597Z","dependencies_parsed_at":"2024-05-28T09:40:35.036Z","dependency_job_id":null,"html_url":"https://github.com/titusjaka/go-sample","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/titusjaka%2Fgo-sample","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/titusjaka%2Fgo-sample/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/titusjaka%2Fgo-sample/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/titusjaka%2Fgo-sample/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/titusjaka","download_url":"https://codeload.github.com/titusjaka/go-sample/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240031544,"owners_count":19736974,"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":["backend","clean-architecture","golang","postgres","restful-api"],"created_at":"2024-10-14T08:57:06.919Z","updated_at":"2026-04-28T21:31:18.942Z","avatar_url":"https://github.com/titusjaka.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# go-sample\n\n[![GitHub release](https://img.shields.io/github/v/release/titusjaka/go-sample)](https://github.com/titusjaka/go-sample/releases/latest)\n[![codecov](https://codecov.io/gh/titusjaka/go-sample/branch/main/graph/badge.svg?token=UNJY7V5SZL)](https://codecov.io/gh/titusjaka/go-sample)\n[![Go Report Card](https://goreportcard.com/badge/github.com/titusjaka/go-sample)](https://goreportcard.com/report/github.com/titusjaka/go-sample)\n[![GitHub license](https://img.shields.io/github/license/titusjaka/go-sample)](https://github.com/titusjaka/go-sample/blob/main/LICENSE)\n\nGo Backend Sample. It’s suitable as a starting point for a REST-API Go application.\n\nThis example uses:\n  - [chi](https://github.com/go-chi/chi) for HTTP router;\n  - [kong](https://github.com/alecthomas/kong) for building neat commands;\n  - [PostgreSQL](https://www.postgresql.org/) as a database and [pgx](https://github.com/jackc/pgx) as a driver;\n  - [testify](https://github.com/stretchr/testify) and [mock](https://github.com/uber-go/mock) for tests;\n  - [ozzo-validation](https://github.com/go-ozzo/ozzo-validation) for request validation;\n  - [slog](https://go.dev/blog/slog) as a logger;\n  - [the Clean Architecture](http://blog.cleancoder.com/uncle-bob/2012/08/13/the-clean-architecture.html) as the primary approach.\n\nFeatures:\n\n  - Modular Project Structure.\n  - Built-in migration handling.\n  - Ready to go example with tests and mocks.\n  - Easy-to-go Docker deployment.\n\n## Structure\n```text\ngo-sample\n├── 📁 commands/              // Sub-commands for CLI (stands for Command Line Interface).\n├── 📁 internal/              // Internal packages for the application according to Go convention.\n│  ├── 📁 business/           // Business logic of the application.\n│  │  └── 📁 snippets/        // A specimen business-logic package “snippets” with REST-API for snippets creating, listing, and deleting.\n│  └── 📁 infrastructure/     // Infrastructure code of the application.\n│     ├── 📁 api/             // API-related utilities: middlewares, authentication, error handling for the transport layer.\n│     ├── 📁 kongflag/        // Helper package for Kong CLI.\n│     ├── 📁 nopslog/         // No-operation logger for tests.\n│     ├── 📁 postgres/        // PostgreSQL-related utilities.\n│     │  ├── 📁 pgmigrator/   // PostgreSQL migration utilities.\n│     │  └── 📁 pgtest/       // PostgreSQL test utilities.\n│     ├── 📁 service/         // Service-related reusable code: error handling for the service layer, etc.\n│     └── 📁 utils/ \n│        └── 📁 testutils/    // Test utilities.\n├── 📁 migrations/            // This folder contains *.sql migrations.\n└── main.go                   // Entry point for the application.\n```\n\n## Installation\n\n```shell\ngit clone https://github.com/titusjaka/go-sample\n```\n\n## Usage\n\n```shell\ndocker-compose up --build\n```\n\n\n## Future improvements\n- [ ] Return verbose API errors with exact fields in it:\n    ```json\n    {\n      \"errors\": {\n        \"title\": \"Title must not be empty\",\n        \"expires_at\": \"Expires at must be within range 1-365 days\"\n      }\n    }\n    ```\n- [ ] Add user authentication + session storage.\n- [ ] Add `/status` handler with service health.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftitusjaka%2Fgo-sample","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftitusjaka%2Fgo-sample","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftitusjaka%2Fgo-sample/lists"}