MCPcopy Index your code
hub / github.com/bangumi/server

github.com/bangumi/server @v1.12.10

Chat with this repo
repository ↗ · DeepWiki ↗ · release v1.12.10 ↗ · + Follow
3,313 symbols 9,369 edges 281 files 443 documented · 13%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

https://bgm.tv/ 新后端服务器。

GitHub go.mod Go version Codecov

Requirements

Optional Requirements:

  • nodejs: 用于生成 openapi 文件。

Init

git clone --recursive https://github.com/bangumi/server.git bangumi-server
cd bangumi-server
task

设置

可设置的环境变量

  • MYSQL_HOST 默认 127.0.0.1
  • MYSQL_PORT 默认 3306
  • MYSQL_DB 默认 bangumi
  • MYSQL_USER 默认 user
  • MYSQL_PASS 默认 password
  • REDIS_URI 默认 redis://127.0.0.1:6379/0
  • HTTP_PORT 默认 3000

你也可以把配置放在 .env 文件中,go-task 会自动加载 .env 文件中的环境变量。

example:

MYSQL_HOST="127.0.0.1"
MYSQL_PORT="3306"
MYSQL_USER="user"
MYSQL_PASS="password"
MYSQL_DB="bangumi"
REDIS_URI="redis://:redis-pass@127.0.0.1:6379/1"

开发

bangumi 相关项目整体说明 bangumi/dev-docs

Web 框架: fiber

ORM: GORMGORM Gen

后端环境

redis 和 mysql 都在此 docker-compose 内 https://github.com/bangumi/dev-env

如果你不使用 docker ,请自行启动 mysql 和 redis 并导入 bangumi/dev-env 仓库内的数据。

提交 Pull Request

如果你的 PR 是新功能,最好先发个 issue 讨论一下要不要实现,避免 PR 提交之后新功能本身被否决的问题。

如果已经存在相关的 issue,可以先在 issue 内回复一下自己的意向,或者创建一个 Draft PR 关联对应的 issue,避免撞车问题。

测试

使用 mock 进行部分测试。

task test

运行 hCaptcha 以外的的全部测试,需要数据库环境。

task test-all

使用 task test-all-with-http 或者 task coverage 来运行所有测试。

代码风格

task lint

配置文件

非 golang 文件 (yaml, json, markdown 等) 使用 prettier 进行格式化。 如果你没有 nodejs 环境,也可以直接提交 PR。GitHub Actions 会对文件进行检查并提出修改建议。

Go Mod

你不应当导入 github.com/bangumi/server/pkg 以外的任何路径。

具体可用的包见 pkg/readme.md

Contributing

contributing.md

License

Copyright (C) 2021-2022 bangumi server contributors.

Source is licensed under the GNU AGPLv3 license that can be found in the LICENSE.txt file.

Extension points exported contracts — how you extend this code

SubjectService (Interface)
(no doc) [6 implementers]
internal/domain/subject.go
Repo (Interface)
(no doc) [6 implementers]
internal/web/session/repo.go
Generic (Interface)
(no doc) [4 implementers]
internal/cache/interface.go
Manager (Interface)
(no doc)
internal/oauth/interface.go
CharacterRepo (Interface)
(no doc) [6 implementers]
internal/domain/character.go
Manager (Interface)
nolint:gochecknoglobals
internal/web/rate/new.go
CharacterService (Interface)
(no doc) [12 implementers]
internal/domain/character.go
Manager (Interface)
(no doc)
internal/web/session/manager.go

Core symbols most depended-on inside this repo

Get
called by 444
internal/web/session/repo.go
Error
called by 205
internal/web/res/error.go
Wrap
called by 192
internal/pkg/errgo/errors.go
WithContext
called by 94
internal/dal/query/gen.go
Count
called by 79
internal/domain/episode.go
New
called by 49
internal/pkg/test/request.go
JSON
called by 49
internal/pkg/test/request.go
Execute
called by 49
internal/web/frontend/template_dev.go

Shape

Method 2,271
Function 579
Struct 381
Interface 40
Class 32
TypeAlias 10

Languages

Go89%
TypeScript11%

Modules by API surface

internal/web/frontend/static/bootstrap/js/bootstrap.min.js296 symbols
internal/dal/query/chii_crt_cast_index.gen.go86 symbols
internal/dal/query/chii_person_cs_index.gen.go75 symbols
internal/dal/query/chii_crt_subject_index.gen.go75 symbols
internal/web/frontend/static/jquery-3.6.0.slim.min.js70 symbols
internal/dal/query/chii_subjects.gen.go64 symbols
internal/dal/query/chii_subject_revisions.gen.go64 symbols
internal/dal/query/chii_subject_relations.gen.go64 symbols
internal/dal/query/chii_persons.gen.go64 symbols
internal/dal/query/chii_oauth_clients.gen.go64 symbols
internal/dal/query/chii_members.gen.go64 symbols
internal/dal/query/chii_index_related.gen.go64 symbols

Datastores touched

(mysql)Database · 1 repos

For agents

$ claude mcp add server \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact