mirror of
https://github.com/hanzoai/base.git
synced 2026-10-21 03:41:50 +00:00
# Conflicts: # apis/record_auth_with_otp.go # core/base_backup.go # go.mod # go.sum # plugins/jsvm/internal/types/generated/types.d.ts # tools/router/rereadable_read_closer_test.go # ui/dist/assets/AuthMethodsDocs-C2aSYmNv.js # ui/dist/assets/AuthRefreshDocs-BapWJLRK.js # ui/dist/assets/AuthWithOAuth2Docs-Ck_pnbL8.js # ui/dist/assets/AuthWithOtpDocs-D8uWq_C5.js # ui/dist/assets/AuthWithPasswordDocs-BQyMhAeO.js # ui/dist/assets/BatchApiDocs-rvUuWLZE.js # ui/dist/assets/CodeEditor-DrMyw8z_.js # ui/dist/assets/CreateApiDocs-XWzcGuMB.js # ui/dist/assets/DeleteApiDocs-CScE0aw3.js # ui/dist/assets/EmailChangeDocs-CxOtrB4s.js # ui/dist/assets/FieldsQueryParam-BzNUQIb5.js # ui/dist/assets/FilterAutocompleteInput-Dm2G2coC.js # ui/dist/assets/Leaflet-DyumpnOc.js # ui/dist/assets/ListApiDocs-CdOzMZnr.js # ui/dist/assets/PageInstaller-vIXdffAJ.js # ui/dist/assets/PageOAuth2RedirectFailure-ClpyaW_B.js # ui/dist/assets/PageOAuth2RedirectSuccess-BLZml1eK.js # ui/dist/assets/PageRecordConfirmEmailChange-Cm3O2YD1.js # ui/dist/assets/PageRecordConfirmPasswordReset-D0XfuL45.js # ui/dist/assets/PageRecordConfirmVerification-CYyNYH_v.js # ui/dist/assets/PageSuperuserConfirmPasswordReset-BvlQ0_9t.js # ui/dist/assets/PageSuperuserRequestPasswordReset-gUPMclJZ.js # ui/dist/assets/PasswordResetDocs-DMF1vqE0.js # ui/dist/assets/RealtimeApiDocs-CNVij_C2.js # ui/dist/assets/UpdateApiDocs-CwQ3ZhFQ.js # ui/dist/assets/VerificationDocs-DUeWWjrS.js # ui/dist/assets/ViewApiDocs-gocWxbTE.js # ui/dist/assets/index-CWGqJiyp.js # ui/dist/index.html
83 lines
3.1 KiB
Markdown
83 lines
3.1 KiB
Markdown
# Contributing to Base
|
|
|
|
Thanks for taking the time to improve Base!
|
|
|
|
This document describes how to prepare a PR for a change in the main repository.
|
|
|
|
- [Prerequisites](#prerequisites)
|
|
- [Making changes in the Go code](#making-changes-in-the-go-code)
|
|
- [Making changes in the Admin UI](#making-changes-in-the-admin-ui)
|
|
|
|
## Prerequisites
|
|
|
|
- Go 1.25+ (for making changes in the Go code)
|
|
- Node 18+ (for making changes in the Admin UI)
|
|
|
|
If you haven't already, you can fork the main repository and clone your fork so that you can work locally:
|
|
|
|
```
|
|
git clone https://github.com/your_username/base.git
|
|
```
|
|
|
|
> [!IMPORTANT]
|
|
> It is recommended to create a new branch from master for each of your bugfixes and features.
|
|
> This is required if you are planning to submit multiple PRs in order to keep the changes separate for review until they eventually get merged.
|
|
|
|
## Making changes in the Go code
|
|
|
|
Base is distributed as a Go package, which means that in order to run the project you'll have to create a Go `main` program that imports the package.
|
|
|
|
The repository already includes such program, located in `examples/base`, that is also used for the prebuilt executables.
|
|
|
|
So, let's assume that you already done some changes in the Base Go code and you want now to run them:
|
|
|
|
1. Navigate to `examples/base`
|
|
2. Run `go run main.go serve`
|
|
|
|
This will start a web server on `http://localhost:8090` with the embedded prebuilt Admin UI from `ui/dist`. And that's it!
|
|
|
|
**Before making a PR to the main repository, it is a good idea to:**
|
|
|
|
- Add unit/integration tests for your changes (we are using the standard `testing` go package).
|
|
To run the tests, you could execute (while in the root project directory):
|
|
|
|
```sh
|
|
go test ./...
|
|
|
|
# or using the Makefile
|
|
make test
|
|
```
|
|
|
|
- Run the linter - **golangci** ([see how to install](https://golangci-lint.run/usage/install/#local-installation)):
|
|
|
|
```sh
|
|
golangci-lint run -c ./golangci.yml ./...
|
|
|
|
# or using the Makefile
|
|
make lint
|
|
```
|
|
|
|
## Making changes in the Admin UI
|
|
|
|
Base Admin UI is a single-page application (SPA) built with Svelte and Vite.
|
|
|
|
To start the Admin UI:
|
|
|
|
1. Navigate to the `ui` project directory
|
|
2. Run `npm install` to install the node dependencies
|
|
3. Start vite's dev server
|
|
```sh
|
|
npm run dev
|
|
```
|
|
|
|
You could open the browser and access the running Admin UI at `http://localhost:3000`.
|
|
|
|
Since the Admin UI is just a client-side application, you need to have the Base backend server also running in the background (either manually running the `examples/base/main.go` or download a prebuilt executable).
|
|
|
|
> [!NOTE]
|
|
> By default, the Admin UI is expecting the backend server to be started at `http://localhost:8090`, but you could change that by creating a new `ui/.env.development.local` file with `HZ_BACKEND_URL = YOUR_ADDRESS` variable inside it.
|
|
|
|
Every change you make in the Admin UI should be automatically reflected in the browser at `http://localhost:3000` without reloading the page.
|
|
|
|
Once you are done with your changes, you have to build the Admin UI with `npm run build`, so that it can be embedded in the go package. And that's it - you can make your PR to the main Base repository.
|