{"id":21045150,"url":"https://github.com/fullpipe/gotgbot-template","last_synced_at":"2026-05-17T20:37:51.854Z","repository":{"id":262351071,"uuid":"886866616","full_name":"fullpipe/gotgbot-template","owner":"fullpipe","description":"Telegram bot boilerplate","archived":false,"fork":false,"pushed_at":"2025-04-16T14:30:19.000Z","size":81,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-31T10:02:04.586Z","etag":null,"topics":["boilerplate","go","telegram-bot"],"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/fullpipe.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-11-11T18:43:27.000Z","updated_at":"2025-04-16T14:30:29.000Z","dependencies_parsed_at":"2024-11-12T01:18:36.965Z","dependency_job_id":"fc4df4c1-faae-4746-ab3f-e3a4d59ad41d","html_url":"https://github.com/fullpipe/gotgbot-template","commit_stats":null,"previous_names":["fullpipe/gotgbot-template"],"tags_count":0,"template":true,"template_full_name":null,"purl":"pkg:github/fullpipe/gotgbot-template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fullpipe%2Fgotgbot-template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fullpipe%2Fgotgbot-template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fullpipe%2Fgotgbot-template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fullpipe%2Fgotgbot-template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fullpipe","download_url":"https://codeload.github.com/fullpipe/gotgbot-template/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fullpipe%2Fgotgbot-template/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33154082,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-17T09:28:26.183Z","status":"ssl_error","status_checked_at":"2026-05-17T09:27:52.702Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["boilerplate","go","telegram-bot"],"created_at":"2024-11-19T14:20:11.567Z","updated_at":"2026-05-17T20:37:51.837Z","avatar_url":"https://github.com/fullpipe.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gotgbot-template\n\nThis project provides a template for building Telegram bots, leveraging the gotgbot library, dependency injection with fx, and other helpful tools.\n\n## Getting Started\n\nClone the repository or use as template on github\n\n```bash\ngit clone https://github.com/fullpipe/gotgbot-template.git\n```\n\nAdd your env vars\n\n```bash\ncp .env.dist .env\n```\n\nMake sure you have [task](https://taskfile.dev/installation/) and [gowatch](https://github.com/silenceper/gowatch) installed\n\nStart bot with\n\n```bash\ntask dev\n```\n\n## Key Features and Concepts\n\n### Gotgbot\n\nThis project uses the gotgbot library for interacting with the Telegram Bot API. Refer to the gotgbot documentation for details on using the library: [gotgbot](https://github.com/PaulSonOfLars/gotgbot).\n\n### Dependency Injection (DI) with fx\n\nThe project utilizes the `fx` framework for dependency injection, promoting modularity and testability.\n\nNew repositories can be registered in [di/repository.go](di/repository.go)\n\n```go\nfx.Provide(repository.NewUserRepo)\n```\n\n#### Controllers\n\nAs you can see in [controller/start.go](controller/start.go). Controller is a struct which implements `di.Controller` interface.\n\nControllers are registered in [cmd/bot/bot.go](cmd/bot/bot.go) with `di.AsController` wrapper\n\n```go\ndi.AsController(controller.NewMessageController),\n```\n\n### task\n\nSimplifies common development tasks like running the application, generating mocks, and generating GraphQL code. See the [Taskfile.yaml](Taskfile.yaml) for available commands.\n\n### mockery\n\nMocks for testing are generated using [mockery](https://vektra.github.io/mockery/latest/).\n\n```bash\ntask mockery\n```\n\n### GraphQL\n\nFor Telegram MiniApps api we use [gqlgen](https://github.com/99designs/gqlgen).\n\nUpdate schema in (api)[api], then run `task gen` to update/generate handlers.\n\nTo run GraphQL server\n\n```sh\ngo run . graph\n```\n\n#### Auth\n\nOn your telegram miniapp client you should add `Authorization` header to all requests.\n\n```ts\nheaders: {\n    Authorization: `tma ${window.Telegram.WebApp.initData}`,\n},\n```\n\n\u003cdetails\u003e\n  \u003csummary\u003eAngular + apollo/client example\u003c/summary\u003e\n\n```ts\nimport { ApplicationConfig } from '@angular/core';\nimport { provideRouter } from '@angular/router';\nimport { routes } from './app.routes';\nimport { provideHttpClient } from '@angular/common/http';\nimport { provideApollo } from 'apollo-angular';\nimport { ApolloLink, InMemoryCache } from '@apollo/client/core';\nimport { environment } from '../environments/environment';\nimport { setContext } from '@apollo/client/link/context';\nimport { ErrorResponse, onError } from '@apollo/client/link/error';\nimport { createUploadLink } from 'apollo-upload-client';\nimport { provideAnimationsAsync } from '@angular/platform-browser/animations/async';\n\nexport const appConfig: ApplicationConfig = {\n  providers: [\n    provideAnimationsAsync(),\n    provideRouter(routes),\n    provideHttpClient(),\n    provideApollo(() =\u003e {\n      const error = onError((e: ErrorResponse) =\u003e {\n        console.log(e);\n      });\n\n      const auth = setContext((operation, context) =\u003e {\n        if (!window.Telegram.WebApp.initData) {\n          return {};\n        } else {\n          return {\n            headers: {\n              Authorization: `tma ${window.Telegram.WebApp.initData}`,\n            },\n          };\n        }\n      });\n\n      return {\n        link: ApolloLink.from([error, auth, createUploadLink({ uri: environment.graphUrl })]),\n        cache: new InMemoryCache(),\n        defaultOptions: {\n          watchQuery: {\n            fetchPolicy: 'no-cache',\n            errorPolicy: 'ignore',\n          },\n          query: {\n            fetchPolicy: 'no-cache',\n            errorPolicy: 'all',\n          },\n        },\n      };\n    }),\n  ],\n};\n```\n\n\u003c/details\u003e\n\n### Metrics\n\nPrometheus metrics are exposed at `:9090/metrics`, allowing monitoring of the application's performance.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffullpipe%2Fgotgbot-template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffullpipe%2Fgotgbot-template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffullpipe%2Fgotgbot-template/lists"}