Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

docs: debrief the dev guide (#9417)

Danny Xu5e44943e9311
diff --git a/docs/code-review-guide.md b/docs/code-review-guide.md
deleted file mode 100644
index 8c89a5c9a9..0000000000
--- a/docs/code-review-guide.md
+++ /dev/null
@@ -1,35 +0,0 @@
-# Code Review Guide
-
-_Note: this guide also applies to [bytebase.com](https://github.com/bytebase/bytebase.com) repository for producing content._
-
-Please read and follow [Google's Code Review Guideline](https://google.github.io/eng-practices/). There is additional guide below because this is an open-source project and we'd like to have effective communications on GitHub.
-
-# Install [Neat](https://neat.run/)
-
-Neat subscribes you to the GitHub notifications:
-
-1. Make sure to watch the Bytebase repository.
-1. Go to your [notification setting](https://github.com/settings/notifications), make sure to check `Web and Mobile`
- ![Screenshot](https://raw.githubusercontent.com/bytebase/bytebase/main/docs/assets/codereview2.png)
-
-# Additional Guide
-
-## Who's next?
-
-- Because it's an open-source project with developers coming from different timezones, we recommend asynchronous communication between reviewers and authors except for emergency such as change rollback or high-priority bug fixes. Each side should expect responses for **up to one business day**.
-- However, if the reviewer doesn't respond in a business day, it's OK to ping the other side by commenting again on the PR, IM messaging, or offline chats. If there is a back and forth discussion on the same topic or you would think so, it will be more efficient to discuss offline.
-- Each side should make very explicit comments to indicate whether the other side can take the turn, e.g. when all previous review comments are addressed, author should leave a PTAL comment and ask reviewer to review again.
-- The goal is to complete the work nicely and quickly so that the authors should have more incentives to drive the discussions, resolve the comments, and merge the PR. However, the comment can be resolved by anyone whoever feels the end of a discussion or the comment is addressed. PRs can be merged by either authors or approvers whenever the PR is ready to be merged. If the comments are not perfectly addressed for a merged PR, leave a comment and the change be addressed by a follow-up PR.
-
-### For reviewers
-
-- If the change is good to go, please approve the PR with short note LGTM (Looks Good To Me).
-- Otherwise, make comments to the related lines and finish the review with [Comment status](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/about-pull-request-reviews#about-pull-request-reviews). If the inline comment is nice to improve (not required), comment should start with nit(picking), e.g. "nit: use word hello instead of hi".
-- If you cannot review e.g. during busy time, please leave comments to let authors know and unassign youself.
-
-### For authors
-
-- Start the review with only one reviewer. Once the change is approved, you can add additional reviewers if needed such as owner review. If you want each reviewer looking at different parts of the code, please leave explicit comments.
-- Commit updates to the PR.
-- Respond to the comments.
-- [Re-requesting a review](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/about-pull-request-reviews#about-pull-request-reviews) with a short note PTAL (Please Take Another Look)
diff --git a/docs/dev-guide.md b/docs/dev-guide.md
index 164fb87de1..0b766146ad 100644
--- a/docs/dev-guide.md
+++ b/docs/dev-guide.md
@@ -1,221 +1,40 @@
-# Development Guide
+# Code Review Guide
-## Tips
+_Note: also applies to [bytebase.com](https://github.com/bytebase/bytebase.com)._
-* Use [Code Inspector](https://en.inspector.fe-dev.cn/guide/start.html#method1-recommend) to locate
-frontend code from UI. Hold `Option + Shift` on Mac or `Alt + Shift` on Windows
+1. [Google's Code Review Guideline](https://google.github.io/eng-practices/).
+1. Effective communication. Expect responses for **up to one business day**.
+ 1. [Re-requesting a review](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/about-pull-request-reviews#about-pull-request-reviews) with comment "PTAL".
+ 1. "LGTM".
+ 1. "I'm not around. Ask @xxx for reviews."
+ 2. "PTAL".
+2. Authors are the drivers for discussions, resolving comments, and merging PRs. Discussions or PRs should not hang around.
-## Branch Management
+# Style Guide
-This section describes how to manage git branches.
+1. Follow the style guide before referring to existing code patterns and conventions.
+1. Use American English for naming. For simplicity, avoid using "xxxList". The ambiguity between singular and plural forms often arises from inadequate design.
+1. Prioritizing simplicity leading to effective and maintainable software.
-Since git utilizes branches as a primary development pattern, we usually face the problem of branch management. We suggest naming your fork of the code, i.e. `${YourGithubID}/bytebase` as `origin`, and the repo `bytebase/bytebase` as `upstream`. Here's a guide for following this branch development pattern.
+## API
-### Remote Tracking
+1. Follow [Google AIP](https://google.aip.dev/).
+1. In cases of conflicts between AIP and the proto guide, follow AIP. For instance, the enum name should be `HELLO` instead of `TYPE_HELLO`.
-After forking the `bytebase/bytebase` repository, set up the git remote tracking.
+## Go
-```bash
-# clone your Bytebase fork
-git clone [email protected]:${YourGithubID}/bytebase.git
-cd bytebase
-# setup upstream pointing to bytebase/bytebase
-git remote add upstream [email protected]:bytebase/bytebase.git
-# check the result
-git remote -v
-# expected outputs:
-# origin [email protected]:${YourGithubID}/bytebase.git (fetch)
-# origin [email protected]:${YourGithubID}/bytebase.git (push)
-# upstream [email protected]:bytebase/bytebase.git (fetch)
-# upstream [email protected]:bytebase/bytebase.git (push)
-```
+1. https://google.github.io/styleguide/go/
-Now you have set up two tracked repositories: `upstream` for `bytebase/bytebase` and `origin` for your fork.
+## TypeScript
-### Development
+1. https://google.github.io/styleguide/tsguide.html
+1. https://google.github.io/styleguide/jsguide.html
+1. [Frontend Style Guide](fe-style-guide.md).
-We usually create a new branch when we start developing a new feature. Here's a typical workflow.
+## Database Schema
-```bash
-# checkout to the main branch
-git checkout main
-# sync with the upstream
-git pull upstream main
-# create and checkout to your new feature branch
-git checkout -b feat/xxx
-# coding & commit
-# push to origin
-git push
-# then git will prompt you with a complete command to push and track to the origin, copy & paste
-git push --set-upstream origin feat/xxx
-```
+1. [Schema Update Guide](schema-update-guide.md)
-### Branch Naming Convention
+## Writing
-The recommended branch naming convention is using `/` as a namespace separator, e.g., feat/xxx, chore/xxx, docs/xxx, which works nicely with 3rd party git tools such as GitLens.
-
-## Commit Messages Guide
-
-This section describes how we add human and machine-readable commit messages.
-
-Refer to [Conventional Commits 1.0.0](https://www.conventionalcommits.org/en/v1.0.0/)
-
-### Benefits
-
-- Automatically generating CHANGELOGs and release notes.
-- Communicating the nature of changes to teammates, the public, and other stakeholders.
-- Making it easier for people to contribute to your projects, by allowing them to explore a more structured commit history.
-
-### Summary
-
-Conventional Commits specification is a lightweight convention on top of commit message. It provides an easy set of rules for creating an explicit commit history, which improves better readability, velocity and automation.
-
-### Commit Message Style
-
-The commit message should be structured as follows:
-
-```bash
-<type>[optional scope]: <description>
-
-[optional body]
-
-[optional footer(s)]
-```
-
-#### Header
-
-The header is a `mandatory` line that simply describes the purpose of the change.
-
-```bash
-<type>[optional scope]: <description>
-```
-
-It consists of three parts in itself:
-
-- `Type` - a short prefix that represents the kind of the change
-- `Scope` - optional information that represents the context of the change
-- `Subject` - represents a concise description of actual change
-
-> **Note**
-> There also has a colon and space(`:<space>`), which separated the type and description
-
-#### Body
-
-The body is optional lines that introduce the motivation behind the change or just describing slightly more detailed information.
-
-#### Footer
-
-The footer is optional lines that mention consequences which stems from the change - such as announcing a breaking change, linking closed issues, mentioning contributors and so on.
-
-### Examples
-
-#### Commit message with no body
-
-```bash
-docs: correct spelling of CHANGELOG
-```
-
-#### Commit message with scope
-
-```bash
-feat(lang): add polish language
-```
-
-#### Commit message with description and breaking change footer
-
-```bash
-feat: allow provided config object to extend other configs
-
-BREAKING CHANGE: `extends` key in config file is now used for extending other config files
-```
-
-#### Commit message with body and footer
-
-```bash
-fix: prevent racing of requests
-
-Introduce a request id and a reference to latest request. Dismiss
-incoming responses other than from latest request.
-
-Reviewed-by: Z
-```
-
-### Common Types
-
-On top of defining the commit message format, the [Angular commit message conventions](https://github.com/angular/angular/blob/22b96b9/CONTRIBUTING.md#-commit-message-guidelines) specify a list of useful types that cover various sorts of changes.
-
-#### feat
-
-Used for add some feature
-
-```bash
-feat: add some feature
-feat(frontend): add some feature in frontend
-```
-
-#### fix
-
-Used for fixed some bug
-
-```bash
-fix: fixed typo
-fix(frontend): fixed some error in frontend scope
-```
-
-#### docs
-
-Used for write some docs
-
-```bash
-docs: add a new docs
-```
-
-#### refactor
-
-Used for refactor some old code or maybe rewrite、enchance it
-
-```bash
-refactor: rewrite some logic
-```
-
-#### style
-
-Generally used for front-end
-
-```bash
-style: update the ui colors
-```
-
-#### test
-
-Used for add some test case
-
-```bash
-test: test some case
-```
-
-#### perf
-
-Used for some performance improvements.
-
-```bash
-perf: reduce the api requests when page loading
-```
-
-#### chore
-
-Used for changes the build process, bump up version, add some configs etc.
-
-```bash
-chore: release v0.0.1
-chore: bump up dependencies version
-```
-
-Checkout [more examples](https://www.conventionalcommits.org/en/v1.0.0/#examples)
-
-### Tools
-
-- [commitizen](https://github.com/commitizen/cz-cli) - The commitizen command line utility.
-- [cz-conventional-changelog](https://github.com/commitizen/cz-conventional-changelog) - A commitizen adapter for the angular preset of [conventional-changelog](https://github.com/conventional-changelog/conventional-changelog)
-- [husky](https://github.com/typicode/husky) - Git hooks made easy 🐶 woof!
-- [conventional-changelog-cli](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-cli) - Generate changelogs and release notes from a project's commit messages and metadata.
+1. [Writing Guide](writing-guide.md).
diff --git a/docs/i18n-guide.md b/docs/i18n-guide.md
deleted file mode 100644
index a21c3edbb0..0000000000
--- a/docs/i18n-guide.md
+++ /dev/null
@@ -1,119 +0,0 @@
-# I18n Guide
-
-Bytebase supports English and Chinese. We provide the language toggle on the Sign-up/Sign-in page and the user profile dropdown menu on the top-right of the dashboard.
-
-## How do we translate
-
-### Overview
-
-Required tools.
-
-* `vue-i18n` for vue project.
-* `i18n-ally` for VSCode Extension.
-
-With these tools, we could extract translations from code without opening the [i18n assets](#i18n-assets).
-
-### Vue I18n
-
-In our frontend project, we use `vue-i18n` to translate all the messages. Vue I18n is an internationalization plugin for Vue.js.
-
-Learn about [vue-i18n](https://vue-i18n.intlify.dev/)
-
-### i18n-ally
-
-We use a VSCode extension called `i18n-ally`. It provides a simple and seamless translation workflow.
-
-Some usefully features:
-
-* Extract Translations from Code
-* Inline Annotations
-* Hover and Direct Actions
-* Mangae All Translations in One Place
-* Editor UI & Review System
-* Report Missing Translations
-* Machine Translation
-
-Learn about [VSCode Extension i18n-ally](https://marketplace.visualstudio.com/items?itemName=lokalise.i18n-ally)
-
-### i18n assets
-
-The `i18n assets` refers to the locales files in the `bytebase/frontend/src/locales` dir.
-
-`en.yml` is for English and `zh-CN.yml` is for Chinese.
-
-### Translate message in `<template>`
-
-Most translation work would be done in the Vue file under the `<template>` tag which is the page template. vue-i18n injects a Vue global variable `$t` globally. So that we can translate directly from template using the `$t` function.
-
-For example:
-
-```html
-{{ $t("quick-start.self") }}
-```
-
-### Translate message in `<script>`
-
-Sometimes, we write some texts as constants, such as fixed drop-down menu options. The translation of texts in the `<script>` tag is slightly different, and we need to use the Vue i18n API.
-
-For example:
-
-```ts
-import { useI18n } from "vue-i18n";
-
-export default {
- ...,
- setup () {
- const { t } = useI18n()
-
- return {
- quickStart: t("quick-start.self")
- }
- },
- ...
-}
-```
-
-### Translate message in `.ts` file
-
-Sometimes, some constants may be referenced by multiple files, and we extract those constants into a separate `.ts` file. At this time, we export the `t` function from `plugins/i18n.ts`.
-
-```ts
-import { t } from "../plugins/i18n";
-export const PROJECT_HOOK_TYPE_ITEM_LIST: () => ProjectWebhookTypeIte[] =
- () => [
- ...,
- {
- type: "bb.plugin.webhook.discord",
- name: t("common.discord"),
- urlPrefix: "https://discord.com/api/webhooks",
- },
- ...
- ];
-```
-
-For more advanced usage, check out the [vue-i18n] documents.
-
-## Contributes
-
-If you would like to help a language's translation up to date, please follow this guide.
-
-### How to start
-
-#### Clone to local
-
-```bash
-npx degit bytebase/bytebase bytebase
-cd bytebase/frontend
-pnpm i && pnpm dev
-```
-
-#### Extract some messages
-
-Follow the [How do we translate?](#how-do-we-translate) guide.
-
-## Tools
-
-Some useful frontend dev tools for i18n in Vue Project.
-
-* [vue-i18n](https://vue-i18n.intlify.dev/)
-* [VSCode Extension i18n-ally](https://marketplace.visualstudio.com/items?itemName=lokalise.i18n-ally) - 🌍 All in one i18n extension for VS Code
diff --git a/docs/life-of-a-feature.md b/docs/life-of-a-feature.md
index ef1b456da8..5867605d95 100644
--- a/docs/life-of-a-feature.md
+++ b/docs/life-of-a-feature.md
@@ -1,34 +1,15 @@
# Life of a Feature
-## Do's
-
-1. Understand the goal by answering "what's the problem we're solving?".
-1. Write technical design docs.
- - Do some research and provide background information and overview.
- - Find a simple and sustainable solution. Technical decisions usually come along with trade-offs among several options. We need a simple solution for a complex problem. The solution should also be scalable to future changes or growth if possible.
- - Split a large design into smaller ones, e.g., backend, UI, UX, etc.
- - **(IMPORTANT)** Define data model and design database schema. According to our [Version Management](version-management.md), any schema change could disrupt existing customers. The uncareful design will also lead to software scalability issues.
- - Design API by following [API style guide](https://github.com/bytebase/bytebase/blob/main/docs/api-style-guide.md)
- - Put thoughts on naming because it's hard to change the names in database schemas and APIs. We can have different names for technical pieces and products.
+1. Comprehend the objective by addressing the question, "What problem are we addressing?"
+1. Write technical designs.
+ - Conduct research and furnish background information along with an overview.
+ - Identify a straightforward and enduring solution. Technical choices often involve trade-offs among various options. We require a straightforward resolution for a complex problem, ideally one that is also scalable to accommodate future changes or growth.
+ - **(IMPORTANT)** Design API and schema.
- Collaborate with peers and tech leads.
- - Write docs including comments in English. We are doing open-source with contributors globally.
-1. Coding.
- - Follow [code review guide](code-review-guide.md) (small changes, effective communication, collaboration, and `respect`).
- - Split changes to database schema, API, backend, frontend if possible, because you will get different reviewers looking at different parts. For example, we can make the backend do dual writes for any API changes, switch the reads on UI, and clean up the dual writes in the backend.
- - **(IMPORTANT)** Think about compatibility and don't break existing users. This usually happens if we change database schemas or APIs.
- - Guard new features behind a release flag. We should release the feature only when it's mature.
- - For frontend using [`isDev()`](https://github.com/bytebase/bytebase/blob/4fd7ea41a716dbd72c85b0bc02f04fff5e08370f/frontend/src/main.ts#L41).
- - For backend using [`FeatureFlag(xxx)`](https://github.com/bytebase/bytebase/blob/main/store/feature_flag.go)
- to make the code work with both old and new schema.
- - Testing is the key to product quality. This includes unit tests, [backend integration tests](https://github.com/bytebase/bytebase/tree/main/tests), frontend manual tests. Tests should cover critical user journeys. While writing backend integration tests, you will have an even better idea of how users will use the product from end to end.
- - Golang code follows [Google Go Style](https://google.github.io/styleguide/go/).
- - Collaborate if a feature requires multiple developers to work on.
- - (Optional) After code is submitted, you can wait for a while and use a docker image with tag `bytebase/bytebase:release-ci` for testing release build. See [Docker Deployment Guide](https://www.bytebase.com/docs/get-started/install/deploy-with-docker).
-1. Success metrics
- - What data do we need to prove the feature or business is successful?
+1. Coding by following [Dev Guide](dev-guide.md).
+1. Success metrics.
- Collect and display the metrics in the [metrics dashboard](https://metric.bytebase.com/).
1. Documentation.
- - We should update [public documentation](https://bytebase.com/docs) for new features.
-1. Testing and feedback.
- - Before a feature is released, get some peers to try out these new features by following public documentation. Receive feedback and iterate.
-1. Release and announcement. Cheers!
+ - Update [public documentation](https://bytebase.com/docs).
+1. Testing.
+1. Cheers!
diff --git a/docs/openapi.md b/docs/openapi.md
deleted file mode 100644
index a07e3c0fa4..0000000000
--- a/docs/openapi.md
+++ /dev/null
@@ -1,59 +0,0 @@
-# Bytebase OpenAPI
-
-Bytebase OpenAPI implements the OpenAPI specification with Swagger.
-
-## Dev
-
-### Required tools
-
-- [`swag`](https://github.com/swaggo/swag) for the Swagger command line.
-- [`echo-swagger`](https://github.com/swaggo/echo-swagger) Swagger middleware for echo.
-
-### Comment for OpenAPIs
-
-1. Add general API annotations in `./backend/server/server.go`.
-2. Add API operation annotations in your controller code.
-
-> **Note**
-> You need to comment for a specific controller function, otherwise the swagger cannot extract the comment as docs. For example:
-
-❌ Incorrect
-
-```go
-// Swagger doc (cannot work)
-// @Summary Health check for service
-// @Accept */*
-// @Produce plain
-// @Router /healthz [get]
-e.GET("/healthz", func(c echo.Context) error {
- return c.String(http.StatusOK, "OK!\n")
-})
-```
-
-✅ Correct
-
-```go
-// Swagger doc (this can work)
-// @Summary Health check for service
-// @Accept */*
-// @Produce plain
-// @Router /healthz [get]
-func healthCheckController(c echo.Context) error {
- return c.String(http.StatusOK, "OK!\n")
-}
-
-e.GET("/healthz", healthCheckController)
-```
-
-### Generate Swagger docs
-
-Every time you changed the comments, you need to re-run the following command to re-generate the Swagger docs:
-
-```bash
-cd bytebase
-# generate swagger doc
-swag init -g ./backend/server.go -d ./backend/server --output docs/openapi --parseDependency
-```
-
-This should generate new docs under `./docs/openapi` folder based on your comments.
-Then start the service, you can visit the Swagger dashboard on `/swagger/index.html`
diff --git a/docs/style-guide.md b/docs/style-guide.md
deleted file mode 100644
index 8ca419c7f1..0000000000
--- a/docs/style-guide.md
+++ /dev/null
@@ -1,28 +0,0 @@
-# Style Guide
-
-1. Follow the style guide before referring to existing code patterns and conventions.
-1. Use American English for naming. For simplicity, avoid using "xxxList". The ambiguity between singular and plural forms often arises from inadequate design.
-1. Prioritizing simplicity leading to effective and maintainable software.
-
-## API
-
-1. Follow [Google AIP](https://google.aip.dev/).
-1. In cases of conflicts between AIP and the proto guide, follow AIP. For instance, the enum name should be `HELLO` instead of `TYPE_HELLO`.
-
-## Go
-
-1. https://google.github.io/styleguide/go/
-
-## TypeScript
-
-1. https://google.github.io/styleguide/tsguide.html
-1. https://google.github.io/styleguide/jsguide.html
-1. [Frontend Style Guide](fe-style-guide.md).
-
-## Database Schema
-
-1. [Schema Update Guide](schema-update-guide.md)
-
-## Writing
-
-1. [Writing Guide](writing-guide.md).