Giter Site home page Giter Site logo

toktik-team / toktik Goto Github PK

View Code? Open in Web Editor NEW
203.0 5.0 14.0 1.59 MB

ChatGPT integrated short video microservice application built with Kitex and Hertz. 第五届字节跳动青训营后端大作业“码如磐石奖(一等奖)”获奖项目

License: MIT License

Shell 5.04% Go 94.19% Dockerfile 0.77%
microservice tiktok go cloudwego golang hertz kitex backend clone consul

toktik's Introduction

Toktik

logo ChatGPT integrated short video microservice application built with Kitex and Hertz , made by Toktik-Team in The 5th Bytedance Youth Training Camp.

English | 简体中文

The 5th Bytedance Youth Training Camp Report Documentation: https://qrggpk56b9.feishu.cn/docx/Djwpdm8oZo3JyRx0JwkcZhRDnVd

Recommend

Now Recommend for GuGoTik !

TokTik is no longer maintained and has no planned maintenance plans, please go to GuGoTik. GuGoTik respects and follows TokTik's workline, improving and optimizing almost every components from it and adding more features. For best expermental experience, please use GuGoTik instead of TokTik.

Give us your stars if you like our project.

Awards

Earned the Best Project award in the 5th Bytedance Youth Training Camp.

Demo

Download Dousheng app from here, and use this URL to test with the demo.

https://toktik.xctra.cn/

Project Structure

Prerequisite

This project does not support Windows, as Kitex does not support either.

  • Linux / MacOS
  • Go
  • FFmpeg
  • PostgreSQL
  • Redis
  • OpenTelemetry Collector

For observability infrastructures, it's recommended to use:

  • Jaeger All in one
  • Victoria Metrics
  • Grafana

Build

Run ./build-all.sh in your Linux environment to compile all services.

Configurations

Check out constant/config/env.go

Run

  • Run start.sh --service <service_name> to start a service.
  • service_name could be any of the sub directory of ./service.

Test

Unit Test

Run ./unit-test.sh

End-to-End Test

Run go test toktik/test/e2e -tags="e2e"

How to Contribute

  1. Please following the HowToAddServices to create your own service.
  2. Create a new branch and make your changes.
  3. Create a pull request to the main branch.
  4. Wait for review and merge.

Contributors

License

Toktik is licensed under the MIT License.

toktik's People

Contributors

exercisebook avatar liaosunny123 avatar lss233 avatar nicognaw avatar selflocking avatar shaokeyibb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

toktik's Issues

Error handling with Kitex Biz Exception.

By default, when an RPC function returns an error, the details of the returned error are lost, and only a string value from err.Error() is kept with the client.

For my perspective, the biz error passing should be improved using Kitex Biz Exception in the future, but for now we should try to handle as many cases as possible in the RPC server function.

I will integrate it in the next sprint, please feel free to start if you are intrested.

Unit test improvement.

We have several aspects of deficiencies related to unit tests:

  • CI Integration
  • Coverage calculation & presentation
  • Mocking
    • DB
    • Storage
    • RPC Service
  • Edge cases
  • Fuzzy test

Refactor: add QueryVideosRequest

message QueryVideosRequest {
  uint32 actor_id = 1;
  repeated uint32 video_ids = 2;
}

message QueryVideosResponse {
  uint32 status_code = 1;
  optional string status_msg = 2;
  repeated Video video = 3;
}

service FeedService {
  rpc ListVideos(ListFeedRequest) returns (ListFeedResponse);
  rpc QueryVideos(QueryVideosRequest) returns (QueryVideosResponse);
}

Replace SQL Query to RPC on feed/user/favorite services etc.

Sync with new API change

In douyin_message_chat_request:

  • pre_msg_time

In Message message:

  • create_time

In User:

  • avatar
    • database
    • service impl (gravatar/cravatar)
  • background_image
    • database
    • service impl
  • signature
    • database
    • service impl
  • total_favorited
    • database
    • service impl
  • work_count
    • database
    • service impl
  • favorite_count
    • database
    • service impl

Performance tests & efficiency optimization

So far, we have implemented only basic features and are not aware of their overall performance. Efficiency is critical in the development of business services. Thus, we should integrate OTel & run performance tests & chaos engineering to find bottlenecks in our system.

Unify protos and response fields.

Since we don't use protojson as the serializer anymore (due to the int64 serialization problem), We will need to unify & reconsider the response fields, make the IDLs fit with cloudwego sonic.

Sonic omits zero values by default, which causes the 0 status code to be omitted. The solution is to use optional, and the generated type would be *int. In this case, the zero value of the field would be nil or 0, and the 0 would be serialized.

Integration test.

Use testcontainers as the solution for databases & describe a series of operations that could validate if all the APIs are working properly.

[gossip]维持128star

已经129star了,我为了维持128又取消了star
现在又是128了,家人们我做的对吗

Use mw.GetAuthActorId(ctx)

Use mw.GetAuthActorId(ctx) in web gatewar handler when ActorID needed instead of call c.GetUInt32 directly.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.