3.2 KiB
3.2 KiB
Contributing Guidelines
Development Setup
- Fork the repository
- Clone locally:
git clone https://github.com/yourusername/akiyama-manga.git
cd akiyama-manga
- Create a feature branch:
git checkout -b feature/your-feature
Code Style
Go Code
- Follow Go Code Review Comments
- Run
go fmt ./...before committing - Use
golangci-lintfor linting
make fmt
make lint
Naming Conventions
- Functions:
camelCase - Constants:
UPPER_SNAKE_CASE - Variables:
camelCase - Structs:
PascalCase
Comments
- Export comments should start with the name
- Unexported functions should be documented
- Complex logic should have inline comments
// GetMangaByID retrieves a manga by its UUID
func (s *MangaService) GetMangaByID(id uuid.UUID) (*models.Manga, error) {
// Implementation
}
Frontend Code
HTML/CSS
- Use semantic HTML
- Follow CSS naming conventions (kebab-case)
- Mobile-first responsive design
JavaScript
- Use vanilla JavaScript (no jQuery)
- Use
constby default,letwhen necessary - Use template literals for strings
Testing
Write tests for all new features:
go test -v ./...
go test -v -coverprofile=coverage.out ./...
Commit Messages
Follow conventional commits:
feat: add search functionality
fix: correct manga rating calculation
docs: update API documentation
refactor: simplify user service
test: add upload tests
Pull Request Process
- Update documentation
- Add/update tests
- Run linter and tests locally
- Create descriptive PR title and description
- Link related issues
Architecture Guidelines
Backend
- Models - Data structures with GORM tags
- Services - Business logic
- Handlers - HTTP request/response handling
- Middleware - Cross-cutting concerns
- Storage - External storage (S3)
Frontend
- Templates - Server-rendered HTML
- Static - CSS and JavaScript assets
- Responsive - Mobile-first design
Database Migrations
For schema changes:
- Modify model in
internal/models/models.go - Application will auto-migrate on startup
- Document breaking changes
Adding Features
New Endpoint
- Create handler in
internal/handlers/ - Add route in
cmd/server/main.go - Create service method if needed
- Add tests
- Document in
API.md
New Database Table
- Create model in
internal/models/models.go - Add to migration in
internal/database/db.go - Create service if needed
- Add handlers
Documentation
Update docs for:
- New features
- API changes
- Configuration options
- Deployment procedures
Performance Considerations
- Use database indexes for frequently queried fields
- Implement pagination for large datasets
- Cache frequently accessed data
- Minimize S3 API calls
Security
- Never commit credentials
- Validate all user input
- Use parameterized queries
- Implement rate limiting
- Use HTTPS in production
Release Process
- Update version numbers
- Update CHANGELOG
- Create release tag
- Build release artifacts
- Create GitHub release
Questions?
- Check existing issues and discussions
- Review documentation
- Ask in pull requests or issues