mirror of
https://github.com/rjNemo/rentease.git
synced 2026-06-06 02:36:49 +00:00
2.2 KiB
2.2 KiB
Repository Guidelines
Project Structure & Module Organization
main.go: application entrypoint (HTTP server).internal/: core app code by layer:server/(HTTP handlers/routes),service/(business logic),repository/(data access),driver/(external integrations),config/(env config),view/(templ views/viewmodels).
internal/view/*.templare source templates; generated files areinternal/view/*_templ.go.cmd/cron/: cron entrypoint.assets/: static assets.docs/: documentation/images.scripts/andtmp/: tooling/artifacts.- Tests live next to code as
*_test.go.
Build, Test, and Development Commands
make dev: run local dev stack with Docker Compose and hot reload.make run: build and run production image locally.make test: rungo test ./....make format: runtempl generate,templ fmt, andgo fmt.make lint: rungolangci-lint run ./....make stop: stop dev containers.- Local (without Docker):
go run .,go test ./....
Coding Style & Naming Conventions
- Go style is standard
go fmt(tabs, canonical imports). - Package names: lowercase, no underscores.
- File names: lowercase with underscores when needed.
- Exported identifiers:
PascalCase; unexported:camelCase. - Keep handler/controller code thin; place business rules in
internal/service.
Testing Guidelines
- Use Go
testingwith table-driven tests where practical. - Name files
*_test.go; testsTestXxx; benchmarksBenchmarkXxx. - Cover success and failure paths for changed logic.
- Run
make test(orgo test ./...) before opening a PR.
Commit & Pull Request Guidelines
- Prefer Conventional Commits:
feat(scope): ...,fix(scope): ...,chore: .... - Keep commits focused and atomic.
- PRs should include: clear summary, linked issue (e.g.,
#51), and screenshots for UI changes. - Call out config/env changes and any migration or deployment impact.
Security & Configuration Tips
- Config is environment-driven with
APP_prefix (seeinternal/config/config.go). - Example parser model override:
APP_OPENAI_MODEL=gpt-5-nano. - Never commit secrets; keep them in local
.env/ deployment secret manager.