{"id":21125351,"url":"https://github.com/k5sha/gobook","last_synced_at":"2026-05-17T00:44:52.009Z","repository":{"id":263672042,"uuid":"891121086","full_name":"k5sha/goBook","owner":"k5sha","description":"An example of a REST API for a library written in Go using the Gin framework.","archived":false,"fork":false,"pushed_at":"2024-11-26T09:06:19.000Z","size":273,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-14T11:41:24.232Z","etag":null,"topics":["books","example-project","gin","go","golang","gorm","rest-api"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/k5sha.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2024-11-19T19:05:18.000Z","updated_at":"2024-11-20T13:41:57.000Z","dependencies_parsed_at":"2024-11-19T20:33:19.904Z","dependency_job_id":"1c940f4e-6b58-4a53-ad2c-e4c9525af872","html_url":"https://github.com/k5sha/goBook","commit_stats":null,"previous_names":["k5sha/gobook"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/k5sha/goBook","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/k5sha%2FgoBook","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/k5sha%2FgoBook/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/k5sha%2FgoBook/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/k5sha%2FgoBook/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/k5sha","download_url":"https://codeload.github.com/k5sha/goBook/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/k5sha%2FgoBook/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273961553,"owners_count":25198597,"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","status":"online","status_checked_at":"2025-09-06T02:00:13.247Z","response_time":2576,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["books","example-project","gin","go","golang","gorm","rest-api"],"created_at":"2024-11-20T04:32:59.252Z","updated_at":"2026-05-17T00:44:51.956Z","avatar_url":"https://github.com/k5sha.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/k5sha/goBook/blob/master/media/logo_.png\" alt=\"Logo\" width=\"256\"/\u003e\n\u003c/p\u003e\n\n\u003cdiv align=\"center\"\u003e\n  \n  ![Go Badge](https://img.shields.io/badge/Go-00ADD8?style=for-the-badge\u0026logo=go\u0026logoColor=white)\n  ![Docker Badge](https://img.shields.io/badge/Docker-2496ED?style=for-the-badge\u0026logo=docker\u0026logoColor=white)\n  ![REST API Badge](https://img.shields.io/badge/REST_API-34B7B1?style=for-the-badge\u0026logo=swagger\u0026logoColor=white)\n  ![GORM Badge](https://img.shields.io/badge/GORM-00A9E0?style=for-the-badge\u0026logo=gorm\u0026logoColor=white)\n  ![Gin Badge](https://img.shields.io/badge/Gin-8B8B00?style=for-the-badge\u0026logo=gin\u0026logoColor=white)\n\u003c/div \u003e\n\n# GoBook\nThis project demonstrates how to create a simple but scalable API using Go (Golang), Gin, and GORM. \nIt includes endpoints for managing workbooks with functions such as adding, searching, updating, and deleting workbook records. \nThe project also integrates PostgreSQL for data storage and uses the Aconfig package for configuration management. \nThis guide provides a step-by-step approach to installing and configuring the API via Docker.\n\n### How it works:\n- **Gin** is used for handling HTTP requests, routing, and middleware, making the API fast and efficient. It simplifies tasks like validation and error handling.\n- **GORM** is used to interact with the PostgreSQL database, allowing seamless CRUD operations with Go structs instead of raw SQL queries, making database management easier and more efficient.\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/k5sha/goBook/blob/master/media/how.jpg\" alt=\"How work\" width=\"726\"/\u003e\n\u003c/p\u003e\n\n### Startup\n- via Docker\n```bash\ndocker compose -f docker-compose.dev.yml up -d\n```\n- via bash \n```bash\ngo mod download\ngo run cmd/main.go\n```\n\n### Configuration\nThe application uses a configuration file, **config.yaml**, to define environment-specific settings, such as the server port and database connection details.\n\nHere is an example of the config.local.yaml file:\n\u003e [!NOTE]\n\u003e If you are using docker to run the database on localhost, you should use `db` instead of `localhost` in the `database_dsn` clause of the config.yaml file\n```yaml\nport: ':3000'\ndatabase_dsn: 'postgres://postgres:password@localhost:5432/books_db?sslmode=disable'\n```\n#### Explanation:\n- `port: ':3000'`\nThis sets the port on which the API server will run. By default, the server will listen on port 3000.\n\n- `database_dsn: 'postgres://postgres:password@localhost:5432/books_db?sslmode=disable'`\n  \nThis is the Data Source Name (DSN) for connecting to the PostgreSQL database. It contains the necessary credentials and database information:\n\n- `postgres`: The username for the database.\n- `password`: The password for the database.\n- `localhost`: The hostname of the database server (in this case, it’s running locally).\n- `5432`: The port on which the PostgreSQL database is listening (default is 5432).\n- `books_db`: The name of the database to connect to.\n- `sslmode=disable`: This disables SSL encryption for the connection, which is commonly used in local development environments.\n  \nBy editing this file, you can easily change the server's port or adjust the database connection settings without modifying the source code.\n\n### Nice to have features (backlog)\n- [ ]  Add swagger\n- [ ]  Add a separate author model to the database\n- [ ]  Add tests\n- [ ]  Add comments\n- [ ]  Add to config the 'release' mode\n\n### Author:\n**Yurii (k5sha) Yevtushenko**\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fk5sha%2Fgobook","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fk5sha%2Fgobook","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fk5sha%2Fgobook/lists"}