{"id":29777435,"url":"https://github.com/ahmadammarm/go-rest-api-template","last_synced_at":"2025-10-24T14:22:40.474Z","repository":{"id":285869428,"uuid":"957973616","full_name":"ahmadammarm/go-rest-api-template","owner":"ahmadammarm","description":"Simple RESTful API template built using Go programming language and Fiber framework with many key features","archived":false,"fork":false,"pushed_at":"2025-07-14T16:38:21.000Z","size":81,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-07-14T21:22:27.495Z","etag":null,"topics":["ci","docker","fiber","go","postgresql","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/ahmadammarm.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,"zenodo":null}},"created_at":"2025-03-31T12:43:42.000Z","updated_at":"2025-07-14T16:38:25.000Z","dependencies_parsed_at":"2025-07-14T18:24:57.731Z","dependency_job_id":"a60cd566-cdfc-41ae-aacb-0d599d5f044c","html_url":"https://github.com/ahmadammarm/go-rest-api-template","commit_stats":null,"previous_names":["ahmadammarm/go-rest-api-template"],"tags_count":0,"template":true,"template_full_name":null,"purl":"pkg:github/ahmadammarm/go-rest-api-template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ahmadammarm%2Fgo-rest-api-template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ahmadammarm%2Fgo-rest-api-template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ahmadammarm%2Fgo-rest-api-template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ahmadammarm%2Fgo-rest-api-template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ahmadammarm","download_url":"https://codeload.github.com/ahmadammarm/go-rest-api-template/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ahmadammarm%2Fgo-rest-api-template/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267347334,"owners_count":24072656,"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-07-27T02:00:11.917Z","response_time":82,"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":["ci","docker","fiber","go","postgresql","rest-api"],"created_at":"2025-07-27T11:05:09.878Z","updated_at":"2025-10-24T14:22:35.431Z","avatar_url":"https://github.com/ahmadammarm.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Go REST API Template\n\nA RESTful API template built with Go programming language.\n\n\n![Go](https://img.shields.io/badge/go-%2300ADD8.svg?style=for-the-badge\u0026logo=go\u0026logoColor=white) ![Postgres](https://img.shields.io/badge/postgres-%23316192.svg?style=for-the-badge\u0026logo=postgresql\u0026logoColor=white) ![JWT](https://img.shields.io/badge/JWT-black?style=for-the-badge\u0026logo=JSON%20web%20tokens) ![GitHub Actions](https://img.shields.io/badge/github%20actions-%232671E5.svg?style=for-the-badge\u0026logo=githubactions\u0026logoColor=white) ![Docker](https://img.shields.io/badge/docker-%230db7ed.svg?style=for-the-badge\u0026logo=docker\u0026logoColor=white)\n\n## Prequisites\n\n- Go 1.24 or later\n- PostgreSQL 17 or later\n- Docker (optional)\n\n\n## Features\n\n- **Unit Testing**: Implement the unit testing in order to code maintenance.\n- **Middleware**: Implement the JWT Auth for the middleware.\n- **Service Layer**: Implement the service layer for separating business logic from application logic.\n- **Repository Pattern**: Managing interactions with databases using the repository pattern.\n- **CRUD Implementation**: Implement CRUD logic in the model entity.\n- **Configuration**: Supports environment variables configuration via .env files.\n- **CORS Support**: Supports Cross-Origin Resource Sharing (CORS) configuration.\n- **Deployment**: Supports build and deploy using Docker.\n\n## REST API Design\n\nThe project provides a RESTful API for posts. The API follows standard REST conventions:\n\n### Users API Routes\n\n- `GET /api/v1/users` - Get all users.\n- `GET /api/v1/user/:id` - Get an user by id.\n- `POST /api/v1/user/register` - Register an user.\n- `POST /api/v1/user/login` - Login for the registered user.\n\n\n### News API Routes\n\n- `GET /api/v1/news` - Get all news.\n- `GET /api/v1/news/:id` - Get a news by id.\n- `POST /api/v1/news` - Create a news.\n- `PUT /api/v1/news/:id` - Edit a news by id.\n- `DELETE /api/v1/news/:id` - Delete a news by id.\n\n\n## Getting Started\n\n1. Clone the repository:\n\n```sh\ngit clone https://github.com/ahmadammarm/go-rest-api-template.git\n```\n\n2. Navigate to the project directory:\n\n```sh\ncd go-rest-api-template\n```\n\n3. Install the project dependencies:\n\n```sh\ngo mod download\n```\n\n4. Configure Environment Variable: Copy the file `.env.example` to `.env` and adjust it to your configuration:\n\n```sh\ncp .env.example .env\n```\n\n```\nPOSTGRES_HOST=localhost\nPOSTGRES_PORT=\nPOSTGRES_USER=\nPOSTGRES_PASSWORD=\nPOSTGRES_DB=\nJWT_SECRET_KEY=your-jwt-secret-key\nCORS_ALLOW_ORIGINS=your-header-http-domain\n```\n\n- POSTGRES: Configuration for PostgreSQL database connection.\n\n- JWT_SECRET_KEY: The secret key used for JWT token signing and verification.\n\n- CORS_ALLOW_ORIGINS: The allowed origins for Cross-Origin Resource Sharing (CORS). This is the domain that will be able to access resources from this API. For example, if you are running the frontend on http://localhost:5173, you should set this environment variable to http://localhost:5173.\n\n\n5. Run the project:\n\n```sh\ngo run cmd/main.go\n```\n\n\n## Getting Started with Docker\n\n1. Clone the repository:\n```sh\ngit clone https://github.com/ahmadammarm/go-rest-api-template.git\n```\n\n2. Navigate to the project directory:\n\n```sh\ncd go-rest-api-template\n```\n\n3. Run the Docker Compose:\n\n```sh\ndocker-compose up\n```\n\nor run in detach mode:\n```sh\ndocker-compose up -d\n```\n\n4. To stop the Docker Compose:\n```sh\ndocker-compose down\n```\n\nThe project will be available at:\n\n`http://localhost:8080`\n\n### This project also available for your contributions, thank you :)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fahmadammarm%2Fgo-rest-api-template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fahmadammarm%2Fgo-rest-api-template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fahmadammarm%2Fgo-rest-api-template/lists"}