2.7 KiB
2.7 KiB
Repository Guidelines
Project Structure & Module Organization
sproutgate-frontend/: React + Vite app. Entry atsrc/main.jsx, main UI insrc/App.jsx, styles insrc/styles.css.sproutgate-backend/: Go + Gin API. Entry atmain.go, HTTP handlers ininternal/handlers/, domain models ininternal/models/, storage ininternal/storage/.sproutgate-backend/data/: JSON-backed config and data. Config files live indata/config/, user records indata/users/.- Root scripts
sproutgate.shandsproutgate.batprovide dev and build shortcuts.
Build, Test, and Development Commands
./sproutgate.sh devorsproutgate.bat dev: start backend and frontend dev servers../sproutgate.sh buildorsproutgate.bat build: build the frontend bundle.cd sproutgate-backend && go mod tidy: sync Go dependencies.cd sproutgate-backend && go run .: run the API (default port8080).cd sproutgate-frontend && npm install: install frontend dependencies.cd sproutgate-frontend && npm run dev: run Vite dev server (default5173).cd sproutgate-frontend && npm run build: create a production build.cd sproutgate-frontend && npm run preview: preview the build locally.
Coding Style & Naming Conventions
- Go code should be
gofmt-formatted; packages are lowercase, exported types use PascalCase, JSON tags use lowerCamelCase. - Frontend code follows existing
src/*.jsxpatterns: 2-space indentation, double quotes, components in PascalCase, hooks prefixed withuse. - File naming mirrors current structure: Go files are lowercase (use underscores when needed, e.g.,
secondary_email.go); React components use.jsx.
Testing Guidelines
- No automated test suites are configured yet (no
*_test.goand nonpm testscript). - When adding backend tests, use Go's standard testing (
*_test.go) and rungo test ./...insproutgate-backend/. - If frontend tests are introduced, document the runner and command in
sproutgate-frontend/package.jsonand update this guide.
Commit & Pull Request Guidelines
- Git history currently contains only
Initial commit; there is no established commit convention yet. - Use short, imperative commit summaries; add a scope when helpful (e.g.,
frontend: refine admin table). - PRs should include a concise summary, testing notes, and screenshots for UI changes; call out any config or env var updates.
Security & Configuration Tips
- Backend configuration is stored under
sproutgate-backend/data/config/(admin, auth, email). - Frontend API base URL can be set via
sproutgate-frontend/.envusingVITE_API_BASE. - Avoid committing real credentials or production tokens; use local overrides for secrets.
- API reference lives in
sproutgate-backend/API_DOCS.mdand is served atGET /api/docs.