{"id":24929817,"url":"https://github.com/traptitech/trap-collection-server","last_synced_at":"2025-07-13T20:03:09.439Z","repository":{"id":38080729,"uuid":"197786433","full_name":"traPtitech/trap-collection-server","owner":"traPtitech","description":"内製ゲーム管理システム traP Collection サーバーアプリケーション","archived":false,"fork":false,"pushed_at":"2025-07-10T14:59:20.000Z","size":21724,"stargazers_count":8,"open_issues_count":21,"forks_count":0,"subscribers_count":10,"default_branch":"main","last_synced_at":"2025-07-10T20:19:05.117Z","etag":null,"topics":[],"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/traPtitech.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":"2019-07-19T14:25:44.000Z","updated_at":"2025-07-08T17:20:48.000Z","dependencies_parsed_at":"2024-02-06T08:27:21.983Z","dependency_job_id":"6bdfb165-8df2-49f5-8bf4-b14144e731f8","html_url":"https://github.com/traPtitech/trap-collection-server","commit_stats":null,"previous_names":[],"tags_count":30,"template":false,"template_full_name":null,"purl":"pkg:github/traPtitech/trap-collection-server","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/traPtitech%2Ftrap-collection-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/traPtitech%2Ftrap-collection-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/traPtitech%2Ftrap-collection-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/traPtitech%2Ftrap-collection-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/traPtitech","download_url":"https://codeload.github.com/traPtitech/trap-collection-server/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/traPtitech%2Ftrap-collection-server/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265198300,"owners_count":23726446,"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":["hacktoberfest"],"created_at":"2025-02-02T13:51:56.052Z","updated_at":"2025-07-13T20:03:09.427Z","avatar_url":"https://github.com/traPtitech.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# trap-collection-server\n\n[![codecov](https://codecov.io/gh/traPtitech/trap-collection-server/branch/main/graph/badge.svg)](https://codecov.io/gh/traPtitech/trap-collection-server)\n[![](https://github.com/traPtitech/trap-collection-server/workflows/Release/badge.svg)](https://github.com/traPtitech/trap-collection-server/actions)\n[![OpenAPI(v1)](https://img.shields.io/badge/OpenAPI(v1)-docs-brightgreen)](https://apis.trap.jp/?urls.primaryName=traP%20Collection%20v1%20API)\n[![OpenAPI(v2)](https://img.shields.io/badge/OpenAPI(v2)-docs-brightgreen)](https://apis.trap.jp/?urls.primaryName=traP%20Collection%20v2%20API)\n[![go report](https://goreportcard.com/badge/traPtitech/trap-collection-server)](https://goreportcard.com/report/traPtitech/trap-collection-server)\n[![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/traPtitech/trap-collection-server)\n\ntraPのゲームランチャーtraP Collectionのサーバーサイドです。\n\n## 開発に必要なツール\n\n- Go (最新のもの)\n- Docker\n- [Task](https://taskfile.dev/)\n  - タスクランナー\n- [Atlas](https://atlasgo.io/)\n  - DBマイグレーション用のツール\n  - マイグレーションの詳細は [migration.md](docs/migration.md) を参照してください。\n- [golangci-lint](https://golangci-lint.run/)\n  - 静的解析用のツール\n\n必要なものをインストールしたら、次に以下のコマンドを実行すると、Goの依存関係がインストールされ、コードが生成されます。\n\n```bash\ntask\n```\n\n`src/service/mock` ディレクトリなどにファイルが生成されていればよいです。\n\n## 開発環境の起動\n\nまず、[traQ BOT Console](https://bot-console.trap.jp/docs/client/create)に従い、\ntraQのOAuthクライアントを作成します。リダイレクト先URLは`http://localhost:8080/callback`、スコープは「読み取り」、に設定してください。\n\n次に、`docker/dev/.env`ファイルに以下のように書きます。\n\n```.env\nCLIENT_ID={{traQのClientのClientID}}\nCLIENT_SECRET={{traQのClientのClientSecret}}\n```\n\n最後に以下のコマンドを実行することで開発環境がポート3000番で起動します。\nまた、管理画面のWeb UIをhttp://localhost:8080 で、[Adminer](https://www.adminer.org/)をhttp://localhost:8081 で開けるようになります。\n\n```bash\ntask dev\n```\n\n### DBのデータ削除\n\n以下のコマンドを実行することでDBのデータを削除できます。\n\n```bash\ntask clean:db\n```\n\n## テストの実行\n\nGitHub Actionsで走っているのと同様のテストを以下のコマンドで実行できます。\nログの停止からtestのログが流れ始めるまで20秒程度時間が空く点に注意してください。\nDB に関わるテストは、Dockerが必要です。\n\n```bash\ntask test\n```\n\n`task test`では全てのテストが実行されます。開発中に関数ごとのテストを実行したい場合は、コマンドでテスト対象の関数を指定して実行することもできますが、エディタの機能を使うとよいです。\n例えば VSCode では、エディタのテスト関数の上にある「run test」ボタンやコマンドパレットなどから実行できます。\n\n## lint の実行\n\ngolangci-lint を使ってコードを静的解析し、良くないコードが無いかをチェックすることができます。\n古いコードではgolangci-lintのルールに従っていないものもありますが、それらを直す必要はありません。\n新しいコードを書くときは、golangci-lintのルールに従うようにしてください。\n`main`ブランチとの差分（自分が書いたコード）の中に良くないコードが無いかを以下のコマンドでチェックできます。\n\n```bash\ntask lint\n```\n\nGitHub Actionsでもgolangci-lintが実行されています。こちらもmainブランチとの差分に良くないコードが無いかをチェックしていますが、CIのログ出力には全てのエラーが出力されるため、注意してください。PRに含まれる部分だけ修正すればよいです。\n\n## DBスキーマの再生成\n\n以下のコマンドでDBスキーマのドキュメント(`docs/db_schema`)を再生成できます。\n\n```bash\ntask tbls\n```\n\n## マイグレーションについて\n\n[docs/migration.md](docs/migration.md)を参照してください。\n\n## API スキーマについて\n\nOpenAPI を使っています。APIスキーマは、 [docs/openapi/v2.yaml](docs/openapi/v2.yaml) に書かれており、このファイルを元に [src/handler/v2/openapi](src/handler/v2/openapi) 以下にコードが生成されます。\nまた、OpenAPI スキーマのドキュメントは [traP API ドキュメント](https://apis.trap.jp/?urls.primaryName=traP%20Collection%20v2%20API) で参照できます。\n\n## その他ドキュメント\n\nアプリの中で出てくる概念(game, editionなど)の定義やディレクトリ構成の説明は、部内のwikiの他、[.github/copilot-instructions.md](.github/copilot-instructions.md) にも書かれています。\n\nDeepWiki というサービスでAIによって生成されたドキュメントを閲覧し、AIに質問することもできます([https://deepwiki.com/traPtitech/trap-collection-server](https://deepwiki.com/traPtitech/trap-collection-server))。ただし、このドキュメントは最新のものを参照しているとは限らないので注意してください。\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftraptitech%2Ftrap-collection-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftraptitech%2Ftrap-collection-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftraptitech%2Ftrap-collection-server/lists"}