Our own documentation called the product Gitea. It is Hanzo Forge, so it now says so — README family, CONTRIBUTING, docs/, and the per-package READMEs. Three kinds of "Gitea" are not branding, and they stay: - MIT attribution: the copyright header template, the LICENSE, and the "white-label fork of Gitea" statement in each README. - Provenance: modules/git came from go-gitea/git, the Actions token design was proposed upstream in #24635, the base is 1.26.4 of go-gitea/gitea. - Addressing values: /data/gitea and /etc/gitea, the gitea-data PVC, the GITEA__ env prefix, X-Gitea-* headers. LLM.md's inventory of these is unchanged. Links that pointed at upstream infrastructure described a project this fork is not. Contributor issues, security reports and documentation now land here; the Crowdin sync, the GiteaBot backporter, the blog PR and the dl.gitea.com asset checks describe no lane this repo has, and the release section now records the one it does — tag, push to canonical, semver image, universe pin. Four references were dead as written, not merely upstream: - docs/setup.md is docs/build-setup.md - build/backport-locale.go does not exist - .github/workflows does not exist here; the workflows are .hanzo/workflows - the -X ldflags named code.gitea.io/gitea symbols, which this binary has none of, so the linker set nothing. The module path is github.com/hanzoai/git and cmd.PIDFile defaults to /run/gitd.pid. gitea help and gitea completion are gitd. gitea-runner is git-runner. The GitHub repo is hanzoai/forge now, so the clone and fork URLs point there. ghcr.io/hanzoai/git is untouched: a package is not renamed by a repo rename and the running deployment pins that image. The Go module path is untouched for the same reason — go.mod still declares github.com/hanzoai/git. Co-authored-by: Hanzo Dev <[email protected]>
4.0 KiB
Frontend development guidelines
This document covers frontend-specific architecture and contribution expectations. For the general workflow see CONTRIBUTING.md, and for building and testing see development.md and testing.md.
Background
The frontend uses Vue 3, Fomantic-UI (built on jQuery) and Tailwind CSS. Pages are rendered with Go HTML templates. Source files live in:
web_src/css/: CSS stylesweb_src/js/: JavaScript and TypeScriptweb_src/js/components/: Vue componentsweb_src/js/features/: feature modules wired up at page loadtemplates/: Go HTML templates
Dependencies
Frontend dependencies are managed with pnpm. The same rules as
for backend dependencies apply, except the
relevant files are package.json and pnpm-lock.yaml, and new versions must always
reference an existing published version.
Framework usage
Mixing frameworks arbitrarily makes code hard to maintain. Recommended combinations:
- Vue3
- Vanilla JavaScript
- Fomantic-UI (jQuery), deprecated, we vendored a specific version with a lot of changes.
Avoid combinations such as Vue with Fomantic-UI. Vue components may reuse Fomantic-UI CSS classes for visual consistency. Use Go templates for simple or SEO-relevant pages and Vue for complex, interactive pages. Hanzo Forge uses Vue 3 without JSX to keep HTML and JavaScript separate.
Note
Fomantic-UI is not an accessibility-friendly framework. Hanzo Forge patches some ARIA behavior, but accessibility work is ongoing — prefer semantic HTML and test keyboard/screen-reader behavior where you can.
Conventions here
- Keep features in their own files or directories.
- Use kebab-case for HTML
ids and classes, ideally with 2-3 feature keywords. - Prefix classes to avoid short-name conflicts between different frameworks.
- Create a new class name when overriding framework styles instead of editing the framework's own classes, or fix the framework's source to fix all cases.
- Prefer semantic elements such as
<button>over generic<div>s. - Avoid
!important; when it is unavoidable, document why. - Prefix custom DOM events with
ce-.
CSS
Prefer Tailwind utility classes with the tw- prefix, and the flex-* layout
helpers over per-child margins. Hanzo Forge also ships a small set of custom helpers:
gt- for general helpers and g- for framework-level helpers (see
web_src/css/helpers.css); use these only when a Tailwind utility does not exist.
Write class attributes as a single readable unit in templates:
<div class="flex-text-inline {{if .IsFoo}}tw-hidden{{end}}"></div>
TypeScript
- Use
import typefor type-only imports. - Prefer
@ts-expect-errorover@ts-ignore. - Use the
!non-null assertion (rather than?./??) when a value is known to always exist. - Only mark a function
asyncwhen it actually usesawaitor returns aPromise. Avoid async event listeners; if unavoidable, calle.preventDefault()before the firstawait. For a deliberately un-awaited call, assign it:const _promise = asyncFoo().
Data fetching
Use the GET, POST, PUT, PATCH, and DELETE wrappers from
web_src/js/modules/fetch.ts.
DOM attributes
Avoid node.dataset because of its camel-casing behavior; use node.getAttribute
in new code. Never bind user-provided data directly onto DOM nodes.
Showing and hiding elements
- In Vue, use
v-ifandv-show. - In Go templates and plain JavaScript, use the
.tw-hiddenclass together with theshowElem(),hideElem(), andtoggleElem()helpers fromweb_src/js/utils/dom.ts.
UI component gallery
When running Hanzo Forge in development mode, standardized UI components are available at
/devtest (for example http://localhost:3000/devtest). These pages are also used
by the e2e tests.