mirror of
https://github.com/cf-sonr/motr.git
synced 2026-01-12 02:59:13 +00:00
1.2 KiB
1.2 KiB
MOTR Development Guide
Commands
- Build:
task build- Compiles WASM withGOOS=js GOARCH=wasm go build -o web/vault.wasm . - Generate:
task gen:templ- Generate Go code from templ templates - Generate:
task gen:sqlc- Generate Go code from SQL queries - Test:
task test- Run all tests withgo test -v ./... - Run single test:
go test -v ./path/to/package -run TestName - Serve:
task serve- Run development server withbunx live-serverin web directory
Code Style
- Imports: Standard library first, external packages second, local packages last
- Formatting: Use gofmt
- Types: Prefer explicit types over interface{}
- Naming: Follow Go conventions (CamelCase for exported, camelCase for unexported)
- Error Handling: Always check errors and return them when appropriate
- Domain Structure: Keep domain logic in
/xdirectory with handler.go, model/ and view/ subdirectories - Templates: Use templ for HTML templating
- Database: Use sqlc for type-safe SQL queries
- Middleware: Place middleware in pkg/[service]/middleware.go
Architecture
MOTR follows a modular architecture with domain-driven design principles. WebAssembly is used for browser execution with progressive web app capabilities.