MCPcopy Index your code
hub / github.com/Agelessbaby/BloomBlog

github.com/Agelessbaby/BloomBlog @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
1,443 symbols 3,221 edges 121 files 196 documented · 14%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

BloomBlog

A backend social media project using Kitex + Hertz + RPC + Kubernetes,supporting functionalities for publishing posts, adding comments, liking posts, and dynamically retrieving them in a feed-like manner

Content

1.Main Features

  • Using Kitex as micro services framework and Hertz as HTTP Api gateway(both open sourced by bytedance)

  • Using AWS S3 as object storage

  • Using rabbitmq as message queue

  • Using Docker and Kubernetes as deployment

2.Description

Service Description Techniques Protocol service registry
api Routing HTTP request to RPC Services Gorm Kitex Hertz http CoreDNS
user User Management JWT proto3 CoreDNS
relation User Following Management - - CoreDNS
feed Posts Stream - - CoreDNS
favorite Favorite Management - - CoreDNS
comment Comment Management rabbitmq - CoreDNS
publish Posts Publish Management AWS S3 - CoreDNS
dal Data Access Layer MySQL gorm - CoreDNS

image.png

3.DataBase Schema

image.png

4.Code Architecture

Directory Sub Directory Description Remarks
cmd api api gateway
comment comment service
favorite favorite service
feed feed service
publish publish service
relation relation service
user user service
config Config file for services and infrastructure
dal db Including Gorm operations and initialization
pack Packing Gorm struct into RPC struct
idl protobuf idl file
kitex_gen Code generated by Kitex
util mq Message queue used in comment service(could be expanded to other services)
errno error code
jwt Using SHA256 and BASE64
oss AWS S3 oss, compatible with minio
config Viper Reading configurations
config Config file for each service and infrasctructures
kubernetes Kubernetes description yaml files
script Shell Scripts for kubernetes deployment, setting up Kind cluster and executing some needed sql operations(not creating database or tables)
kubernetes Shell files that create and deploy kubernetes cluster, building and loading images, etc
## 5.Logical Architecture
image.png

image.png

6.Physical Architecutre

image.png

7.How to Use?

Prerequisite

  1. Docker
  2. Using a Linux or Mac machine(Win is ok but you need to change the scripts)
  3. Having a AWS account and adjust the S3 Endpoint and bucket name to yours(in config/ossConfig.yaml) image.png
  4. Overwrite your AWS tokens in config/kubernetes/services/publish.yaml,make sure your IAM role has the access to S3 image.png
  5. Install Swagger shell go install github.com/swaggo/swag/cmd/swag@latest Verify shell swag --version Init Api file shell swag init -g cmd/api/main.go

Deploy

  1. Make sure you have installed Docker on your machine
  2. Install Kind - Kubernetes IN Docker

For Mac Shell brew install kind For Ubunut Shell sudo apt install kind Verify Installation shell kind --version 3. Grant executable permission to the .sh files shell chmod -R +x script/* 4. Create Kubernetes Cluster shell kind create cluster --config ./config/kubernetes/cluster-bloomblog.yaml Verify creating cluster shell kubectl cluster-info --context kind-bloomblog You should see output like image.png 5. Build Docker images shell ./script/kubernetes/build_images.sh 6. Loading images into Kubernetes cluster shell ./script/kubernetes/kind/load_images.sh 7. Deploy Infra(Mysql,Rabbitmq) shell ./script/kubernetes/deploy-infra.sh 8. Deploy Services shell ./script/kubernetes/deploy.sh

  1. Start a kubernetes job shell kubectl apply -f config/kubernetes/infra/jobs/add_casscade.yaml

  2. Verify Deployment

Verify Pods shell kubectl get pod Verify Services shell kubectl get service

Run

  1. Use Swagger to debug

Swagger

For Publish service, Swagger doesn't support multi files upload, youcan use this postman link

Postman

Future

  1. You can build your own frontend based on this project, the frontend is still developing
  2. I intended to build this project using cloud native solution, however the price for Amazon Mq and NAT is so expensive, you can build it yourself if the budget permits
  3. Now there is only RDBMS, decided that to later apply nosql to build a cache aside architecture
  4. The logstash filter is a little bit hard, still working on it.This is for to collect the database queries that exceed the time threshold

Extension points exported contracts — how you extend this code

Client (Interface)
Client is designed to provide IDL-compatible methods with call-option parameter for kitex framework.
cmd/user/kitex_gen/user/usersrv/client.go
Client (Interface)
Client is designed to provide IDL-compatible methods with call-option parameter for kitex framework.
cmd/relation/kitex_gen/relation/relationsrv/client.go
Client (Interface)
Client is designed to provide IDL-compatible methods with call-option parameter for kitex framework.
cmd/feed/kitex_gen/feed/feedsrv/client.go
Client (Interface)
Client is designed to provide IDL-compatible methods with call-option parameter for kitex framework.
cmd/comment/kitex_gen/comment/commentsrv/client.go
Client (Interface)
Client is designed to provide IDL-compatible methods with call-option parameter for kitex framework.
cmd/favorite/kitex_gen/favorite/favoritesrv/client.go
Client (Interface)
Client is designed to provide IDL-compatible methods with call-option parameter for kitex framework.
cmd/publish/kitex_gen/publish/publishsrv/client.go

Core symbols most depended-on inside this repo

NewErrNo
called by 62
util/errno/errno.go
SendResponse
called by 56
cmd/api/handlers/parameters.go
Error
called by 51
util/errno/errno.go
NewHttpErr
called by 46
util/errno/errno.go
ConvertErr
called by 18
util/errno/errno.go
CreateConfig
called by 18
util/config/config.go
VerifyJwt
called by 13
util/jwt/jwt.go
GetUserIdFromPayload
called by 12
util/jwt/jwt.go

Shape

Method 990
Function 317
Struct 122
Interface 12
FuncType 1
TypeAlias 1

Languages

Go100%

Modules by API surface

cmd/comment/kitex_gen/comment/comment.pb.fast.go96 symbols
cmd/user/kitex_gen/user/usersrv/usersrv.go78 symbols
cmd/relation/kitex_gen/relation/relationsrv/relationsrv.go78 symbols
cmd/comment/kitex_gen/comment/commentsrv/commentsrv.go78 symbols
cmd/comment/kitex_gen/comment/comment.pb.go75 symbols
cmd/relation/kitex_gen/relation/relation.pb.fast.go66 symbols
cmd/feed/kitex_gen/feed/feed.pb.fast.go66 symbols
cmd/user/kitex_gen/user/user.pb.fast.go63 symbols
cmd/relation/kitex_gen/relation/relation.pb.go60 symbols
cmd/publish/kitex_gen/publish/publishsrv/publishsrv.go55 symbols
cmd/feed/kitex_gen/feed/feedsrv/feedsrv.go55 symbols
cmd/favorite/kitex_gen/favorite/favoritesrv/favoritesrv.go55 symbols

For agents

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

⬇ download graph artifact