-
Notifications
You must be signed in to change notification settings - Fork 0
Development Guide
Gary Norman edited this page Oct 7, 2025
·
1 revision
- Follow Effective Go
- Use
gofmtfor formatting - Run
go vetbefore committing - Write tests for new features
- Use vanilla JavaScript (no frameworks)
- Follow consistent naming conventions
- Comment complex logic
- Use ES6+ features appropriately
- Use CSS variables for theming
- Follow BEM naming convention where appropriate
- Keep selectors specific but not overly nested
- Use Flexbox and Grid for layouts
Follow conventional commits format:
type(scope): subject
body (optional)
Types:
-
feat: New feature -
fix: Bug fix -
docs: Documentation -
style: Code style changes -
refactor: Code refactoring -
test: Testing -
chore: Maintenance
Example:
feat(auth): add password reset functionality
Implements password reset via email with secure tokens.
Includes rate limiting to prevent abuse.
-
main- Production-ready code -
feature/*- New features -
fix/*- Bug fixes -
docs/*- Documentation
- Create a feature branch
- Make your changes
- Write/update tests
- Update documentation
- Submit PR with description
- Address review comments
- Squash and merge
go test ./...go test -tags=integration ./...Use the interactive menu:
make menumake build
make runmake configure
make build-image
make run-containerThe application runs a pprof server on localhost:6060:
# CPU profile
go tool pprof http://localhost:6060/debug/pprof/profile
# Heap profile
go tool pprof http://localhost:6060/debug/pprof/heap
# Goroutines
go tool pprof http://localhost:6060/debug/pprof/goroutineLogs use the Catppuccin Mocha color scheme for readability:
- Pink: Errors and important info
- Green: Success messages
- Blue: General info
- Yellow: Warnings
- Create handler struct in
internal/http/handlers/ - Implement handler methods
- Add to registry in
internal/http/routes/registry.go - Define routes in
internal/http/routes/routes.go
- Create migration in
migrations/ - Define model in
internal/models/ - Create SQLite implementation in
internal/sqlite/ - Run migration:
bin/codex migrate
- Create template in
assets/templates/ - Register in
internal/view/render.go - Use in handler
- Use database indexes for common queries
- Cache template parsing
- Minimize middleware overhead
- Use connection pooling
- Profile with pprof regularly
- Always validate user input
- Use parameterized SQL queries
- Hash passwords with bcrypt
- Implement rate limiting
- Sanitize HTML output
- Use HTTPS in production
- Set secure cookie flags