{"id":19570828,"url":"https://github.com/create-go-app/net_http-go-template","last_synced_at":"2025-04-27T03:31:58.886Z","repository":{"id":37818639,"uuid":"231386829","full_name":"create-go-app/net_http-go-template","owner":"create-go-app","description":"📝 net/http backend template for Create Go App CLI.","archived":false,"fork":false,"pushed_at":"2024-11-04T14:39:22.000Z","size":519,"stargazers_count":50,"open_issues_count":0,"forks_count":5,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-11-04T15:36:27.482Z","etag":null,"topics":["api-rest","api-server","backend-template","cgapp","create-go-app","docker","golang","golang-app-server","net-http","swagger","template-project"],"latest_commit_sha":null,"homepage":"https://github.com/create-go-app/cli/wiki","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/create-go-app.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"patreon":"koddr","custom":["https://www.producthunt.com/posts/create-go-app","https://paypal.me/koddr"]}},"created_at":"2020-01-02T13:24:13.000Z","updated_at":"2024-11-04T14:39:24.000Z","dependencies_parsed_at":"2023-02-19T07:45:49.925Z","dependency_job_id":"5ca014cf-4840-4c29-9677-bdcb7b0f2286","html_url":"https://github.com/create-go-app/net_http-go-template","commit_stats":null,"previous_names":[],"tags_count":22,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/create-go-app%2Fnet_http-go-template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/create-go-app%2Fnet_http-go-template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/create-go-app%2Fnet_http-go-template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/create-go-app%2Fnet_http-go-template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/create-go-app","download_url":"https://codeload.github.com/create-go-app/net_http-go-template/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224056523,"owners_count":17248329,"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":["api-rest","api-server","backend-template","cgapp","create-go-app","docker","golang","golang-app-server","net-http","swagger","template-project"],"created_at":"2024-11-11T06:16:30.672Z","updated_at":"2024-11-11T06:16:31.481Z","avatar_url":"https://github.com/create-go-app.png","language":"Go","funding_links":["https://patreon.com/koddr","https://www.producthunt.com/posts/create-go-app","https://paypal.me/koddr"],"categories":[],"sub_categories":[],"readme":"# net/http backend template for [Create Go App CLI](https://github.com/create-go-app/cli)\n\n\u003cimg src=\"https://img.shields.io/badge/Go-1.17+-00ADD8?style=for-the-badge\u0026logo=go\" alt=\"go version\" /\u003e\u0026nbsp;\u003ca href=\"https://goreportcard.com/report/github.com/create-go-app/net_http-go-template\" target=\"_blank\"\u003e\u003cimg src=\"https://img.shields.io/badge/Go_report-A+-success?style=for-the-badge\u0026logo=none\" alt=\"go report\" /\u003e\u003c/a\u003e\u0026nbsp;\u003cimg src=\"https://img.shields.io/badge/license-Apache_2.0-red?style=for-the-badge\u0026logo=none\" alt=\"license\" /\u003e\n\nPackage `net` provides a portable interface for network I/O, including TCP/IP, UDP, domain name resolution, and Unix domain sockets. Although the package provides access to low-level networking primitives.\n\nPackage [`net/http`](https://golang.org/pkg/net/http/) provides HTTP client and server implementations.\n\n## ⚡️ Quick start\n\n1. Create a new project with Fiber:\n\n```bash\ncgapp create\n\n# Choose a backend framework:\n# \u003e net/http\n#   fiber\n#   chi\n```\n\n2. Rename `.env.example` to `.env` and fill it with your environment values.\n3. Install [Docker](https://www.docker.com/get-started) and the following useful Go tools to your system:\n\n   - [golang-migrate/migrate](https://github.com/golang-migrate/migrate#cli-usage) for apply migrations\n   - [github.com/swaggo/swag](https://github.com/swaggo/swag) for auto-generating Swagger API docs\n   - [github.com/securego/gosec](https://github.com/securego/gosec) for checking Go security issues\n   - [github.com/go-critic/go-critic](https://github.com/go-critic/go-critic) for checking Go the best practice issues\n   - [github.com/golangci/golangci-lint](https://github.com/golangci/golangci-lint) for checking Go linter issues\n\n4. Run project by this command:\n\n```bash\nmake docker.run\n```\n\n5. Go to API Docs page (Swagger): [127.0.0.1:5000/swagger/index.html](http://127.0.0.1:5000/swagger/index.html)\n\n![Screenshot](https://user-images.githubusercontent.com/11155743/112716623-76bc0800-8ef8-11eb-80db-48edcbdacf36.png)\n\n## 📦 Used packages\n\n| Name                                                                  | Version   | Type       |\n| --------------------------------------------------------------------- | --------- | ---------- |\n| [net/http](https://golang.org/pkg/net/http/)                          | `latest`  | core       |\n| [gorilla/mux](https://github.com/gorilla/mux)                         | `v1.8.0`  | router     |\n| [auth0/go-jwt-middleware](https://github.com/auth0/go-jwt-middleware) | `v1.0.1`  | middleware |\n| [swaggo/http-swagger](https://github.com/swaggo/http-swagger)         | `v1.1.2`  | middleware |\n| [stretchr/testify](https://github.com/stretchr/testify)               | `v1.7.0`  | tests      |\n| [golang-jwt/jwt](https://github.com/golang-jwt/jwt)                   | `v4.2.0`  | auth       |\n| [joho/godotenv](https://github.com/joho/godotenv)                     | `v1.4.0`  | config     |\n| [jmoiron/sqlx](https://github.com/jmoiron/sqlx)                       | `v1.3.4`  | database   |\n| [jackc/pgx](https://github.com/jackc/pgx)                             | `v4.14.1` | database   |\n| [swaggo/swag](https://github.com/swaggo/swag)                         | `v1.7.6`  | utils      |\n| [google/uuid](https://github.com/google/uuid)                         | `v1.3.0`  | utils      |\n| [go-playground/validator](https://github.com/go-playground/validator) | `v10.9.0` | utils      |\n\n## 🗄 Template structure\n\n### ./app\n\n**Folder with business logic only**. This directory doesn't care about _what database driver you're using_ or _which caching solution your choose_ or any third-party things.\n\n- `./app/controllers` folder for functional controllers (used in routes)\n- `./app/models` folder for describe business models and methods of your project\n- `./app/queries` folder for describe queries for models of your project\n- `./app/validators` folder for describe validators for models fields\n\n### ./docs\n\n**Folder with API Documentation**. This directory contains config files for auto-generated API Docs by Swagger.\n\n### ./pkg\n\n**Folder with project-specific functionality**. This directory contains all the project-specific code tailored only for your business use case, like _configs_, _middleware_, _routes_ or _utils_.\n\n- `./pkg/configs` folder for configuration functions\n- `./pkg/middleware` folder for add middleware (Fiber built-in and yours)\n- `./pkg/routes` folder for describe routes of your project\n- `./pkg/utils` folder with utility functions (server starter, error checker, etc)\n\n### ./platform\n\n**Folder with platform-level logic**. This directory contains all the platform-level logic that will build up the actual project, like _setting up the database_ or _cache server instance_ and _storing migrations_.\n\n- `./platform/database` folder with database setup functions (by default, PostgreSQL)\n- `./platform/migrations` folder with migration files (used with [golang-migrate/migrate](https://github.com/golang-migrate/migrate) tool)\n\n## ⚙️ Configuration\n\n```ini\n# .env\n\n# Server settings:\nSERVER_HOST=\"0.0.0.0\"\nSERVER_PORT=5000\nSERVER_READ_TIMEOUT=60\n\n# JWT settings:\nJWT_SECRET_KEY=\"secret\"\nJWT_REFRESH_KEY=\"refresh\"\n\n# Database settings:\nDB_HOST=\"cgapp-postgres\"\nDB_PORT=5432\nDB_USER=\"postgres\"\nDB_PASSWORD=\"password\"\nDB_NAME=\"postgres\"\nDB_SSL_MODE=\"disable\"\nDB_MAX_CONNECTIONS=100\nDB_MAX_IDLE_CONNECTIONS=10\nDB_MAX_LIFETIME_CONNECTIONS=2\n```\n\n## ⚠️ License\n\nApache 2.0 \u0026copy; [Vic Shóstak](https://shostak.dev/) \u0026 [True web artisans](https://1wa.co/).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcreate-go-app%2Fnet_http-go-template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcreate-go-app%2Fnet_http-go-template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcreate-go-app%2Fnet_http-go-template/lists"}