Skip to content

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

docs: add api guide (#9342)

Danny Xue2c51170bb1d
diff --git a/.gitignore b/.gitignore
index 3638ca43c2..eb463dafeb 100644
--- a/.gitignore
+++ b/.gitignore
@@ -34,7 +34,7 @@ bytebase-build
dist/
docs/openapi/swagger.json
docs/sqlservice/swagger.json
+frontend/public/monaco-workers/
frontend/src/types/sql-review.*.yaml
frontend/src/types/plan.yaml
-
scripts/.air.toml
diff --git a/CODEOWNERS b/CODEOWNERS
index 21d0c5a54e..fc91da5f2a 100644
--- a/CODEOWNERS
+++ b/CODEOWNERS
@@ -2,8 +2,8 @@
* @d-bytebase @bytebase/bytebase-dev
# API and schema
-proto @d-bytebase @ecmadao
-backend/migrator/migration @d-bytebase @ecmadao
+proto @d-bytebase @ecmadao @RainbowDashy
+backend/migrator/migration @d-bytebase @ecmadao @RainbowDashy
# Backend
backend @d-bytebase @ecmadao @bytebase/bytebase-dev
diff --git a/docs/api-style-guide.md b/docs/api-style-guide.md
index cc6a967ff1..aef49e43f0 100644
--- a/docs/api-style-guide.md
+++ b/docs/api-style-guide.md
@@ -1,56 +1,4 @@
-# Bytebase API Style Guide
+# Bytebase API Guide
-Bytebase uses REST API and this doc describes the corresponding API style guide.
-
-The guiding principal for our style guide is **consistency**.
-
-# Methods
-
-## Prefer PATCH over PUT
-
-Most of the time, we only want to do partial update on the resource, and we should use PATCH accordingly. PUT on the other hand means to overwrite the entire resource with the request fields and would more likely to reset existing fields unexpectedly.
-
-# Resource URL naming
-
-## Use resource id for addressing the specific resource
-
-Bytebase uses auto-incremental ID as the primary key for all resources. To address a particular resource, we use GET `/issue/42`. If we want to support other addressing mechanism, we should use query parameters such as `.issue/42?name=foo`
-
-## Use lower case, kebab-case for phrases
-
-Use `/foo/bar-baz` instead of `/foo/barBaz` or `/foo/barbaz`
-
-_Rationale_: To be consistent with [the URL naming from the frontend guide](https://github.com/bytebase/bytebase/blob/main/docs/fe-style-guide.md#use-lower-case-kebab-case-for-phrases). Note, we once used `/foo/barbaz` style and it has its own merits. But because it's a better option to use kebab-case in the frontend URL, and to avoid brain split, we make backend API to conform the same style as well.
-
-## Use singular form even for collection resource
-
-Use `GET /issue` instead of `GET /issues` to fetch the list of issues.
-
-_Rationale_: Plural forms have several variations and it's hard for non-native English speakers to remember all the rules. And in practice, using singular form for collection resource won't cause confusion with the singular resource because they use different resource paths, e.g. `/issue` versus `/issue/:id`.
-
-_Note_: We do aware this is different from the common convention. However, we are not alone, see [this Kubernetes discussion](https://github.com/kubernetes/kubernetes/issues/18622).
-
-## Use a separate `/{{resource}}/batch` for batch operation
-
-If the resource supports batch operation, then use a separate `/batch` endpoint under that resource.
-
-# Messages
-
-## Property Name Convention
-
-We use json messages to communicate between backend and frontend following [Google JSON Style Guide](https://google.github.io/styleguide/jsoncstyleguide.xml). Property names must be camelCased, ascii strings. Variable names in different languages should follow their own language styles, e.g. Go and Vue. However, we must use json annotation for every fields in Go API structs to enforce the same style on the wire and prevent any breaking changes by refactoring because Go will set the json property name based on field name automatically.
-
-We can look at the following example as an interesting case. helloID follows Go style while the wired message use helloId to be consistent with Vue convention.
-
-1. Go struct field: ``` helloID string `json:"helloId"` ```.
-1. Json property name: ``` helloId ```.
-1. Vue template name: ``` helloId ``` => ``` hello-id ```.
-
-# Misc
-
-1. Timestamps should be Unix timestamp (UTC timezone) in seconds whenever possible. The names should be in the format of `xxTs` such as `createdTs`. Timestamps that need precision should be nanoseconds, e.g. perf profiling. The names should be in the format of `xxNs`.
-
-# References
-
-1. [Google's AIP](https://google.aip.dev/)
-1. [Kubernetes API reference](https://kubernetes.io/docs/reference/)
+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 `TYPE_HELLO` should be changed to `HELLO`.
diff --git a/docs/env-guide.md b/docs/env-guide.md
deleted file mode 100644
index c8afbf5968..0000000000
--- a/docs/env-guide.md
+++ /dev/null
@@ -1,43 +0,0 @@
-# Environment Guide
-
-This guide describes the environments used in the Bytebase dev workflow. We use [Render](https://render.com/) to deploy our build for the corresponding environment.
-
-## Environment
-
-| Env | | When created or reloaded | Destroy | URL |
-| ------- | ------------ | --------------------------------------------- | ------------- | ----------------------------------------------|
-| Preview | Read & Write | New **PR** created | **PR** closed | internal-preview-pr-**${PR No}**.onrender.com |
-| Staging | Read & Write | New **Pre-Release** created | **Never** | [staging.bytebase.com](staging.bytebase.com) |
-| Demo | Read Only | New **commits** merged to **the main branch** | **Never** | [demo.bytebase.com](demo.bytebase.com) |
-
-### Preview Environment
-
-Whenever a new PR is created, a preview environment for that PR will be automatically deployed on render.
-You can use the link commented at your PR to do some testing and share with your reviewers.
-
-![Screenshot](https://raw.githubusercontent.com/bytebase/bytebase/main/docs/assets/preview-env1.png)
-
-Any following commits pushed to that PR will trigger an update. However, it may take a while (usually within minutes) for Render to update the environment. We add a 5-digits git commit hash to the version tag at the left bottom, please check this to see whether the preview has loaded your latest commit.
-
-![Screenshot](https://raw.githubusercontent.com/bytebase/bytebase/main/docs/assets/preview-env2.png)
-
-### [Staging Environment (staging.bytebase.com)](https://staging.bytebase.com)
-
-Staging Environment is for release preview, and it would be triggered by a prerelease action in Github.
-
-![Screenshot](https://raw.githubusercontent.com/bytebase/bytebase/main/docs/assets/staging-env1.png)
-
-### [Demo Environment (demo.bytebase.com)](https://demo.bytebase.com)
-
-Demo Environment always reflects the main branch. Every update at the main branch will trigger an update for the Demo Environment.
-
-**We intentionally do this because we adopt trunk based development and we want the main branch to always stay in a deployable state.**
-
-## The Dev Workflow with Environment
-
-1. Design your feature, our [API style guide](https://github.com/bytebase/bytebase/blob/main/docs/coding-guide.md).
-2. Create a Pull Request, and check the preview.
-3. Request a review, our [Review guide](https://github.com/bytebase/bytebase/blob/main/docs/code-review-guide.md).
-4. Make changes if necessary.
-5. Merge to the main branch.
-6. Checkout the [Demo Environment](https://demo.bytebase.com/) to see if your new feature behaves properly.