First off, thank you for considering contributing to our Todo Application! 🎉
This document provides guidelines and steps for contributing. Following these guidelines helps communicate that you respect the time of the developers managing and developing this open source project.
- Code of Conduct
- Getting Started
- Development Setup
- Coding Guidelines
- Commit Messages
- Testing
- Documentation
This project and everyone participating in it is governed by our Code of Conduct. By participating, you are expected to uphold this code. Please report unacceptable behavior to [[email protected]].
- Check if the issue already exists
- Use our issue template when creating a new issue
- Provide a clear title and description
- Add appropriate labels
- Include steps to reproduce if reporting a bug
- 🐛 Bug Report
- ✨ Feature Request
- 📝 Documentation
- 🔄 Refactoring
- 🎨 UI/UX
- Fork the repository
- Create a new branch:
git checkout -b feature/your-feature-name # or git checkout -b fix/your-bug-fix
- Make your changes
- Write or update tests if needed
- Update documentation if needed
- Commit your changes (see Commit Messages)
- Push to your fork
- Open a Pull Request
- Link the related issue(s)
- Provide a clear description of the changes
- Include screenshots for UI changes
- Ensure all tests pass
- Request review from maintainers
-
Clone the Repository
git clone https://github.com/yourusername/todo-app.git cd todo-app
-
Backend Setup
# Install Go dependencies go mod download # Setup environment variables cp .env.example .env # Edit .env with your configuration # Run the server go run main.go
-
Frontend Setup
cd client npm install # Setup environment variables cp .env.example .env # Edit .env with your configuration # Run the development server npm run dev
- Follow standard Go formatting guidelines
- Use meaningful variable and function names
- Write comments for complex logic
- Handle errors appropriately
- Use interfaces when appropriate
// Good Example
func GetTodoByID(id string) (*Todo, error) {
if id == "" {
return nil, errors.New("invalid ID")
}
// ... rest of the code
}
// Bad Example
func Get(i string) (*Todo, error) {
// ... code without validation
}
- Use functional components and hooks
- Follow component file structure
- Use meaningful component and prop names
- Include PropTypes or TypeScript types
- Keep components small and focused
// Good Example
const TodoItem = ({ todo, onComplete }) => {
return (
<div className="todo-item">
<span>{todo.title}</span>
<button onClick={() => onComplete(todo.id)}>Complete</button>
</div>
);
};
// Bad Example
const Item = (props) => {
return <div onClick={props.click}>{props.t}</div>;
};
Follow the Conventional Commits specification:
<type>(<scope>): <description>
[optional body]
[optional footer]
Types:
feat
: New featurefix
: Bug fixdocs
: Documentation changesstyle
: Code style changes (formatting, etc.)refactor
: Code refactoringtest
: Adding or updating testschore
: Maintenance tasks
Examples:
feat(api): add endpoint for updating todo status
fix(ui): resolve todo list rendering issue
docs: update API documentation
- Write unit tests for all new functions
- Ensure existing tests pass
- Use table-driven tests when appropriate
- Mock external dependencies
func TestCreateTodo(t *testing.T) {
tests := []struct {
name string
input Todo
wantErr bool
}{
// Add test cases
}
// ... test implementation
}
- Write tests for components using React Testing Library
- Test user interactions
- Test error states
- Write integration tests for critical flows
describe('TodoItem', () => {
it('should render todo text', () => {
// Test implementation
});
});
- Update README.md if you change setup steps
- Document new environment variables
- Update API documentation for new endpoints
- Add JSDoc comments for new components
- Include comments for complex logic
### Create Todo
POST /api/todos
Request Body:
{
"title": "string",
"completed": boolean
}
Response:
{
"id": "string",
"title": "string",
"completed": boolean,
"createdAt": "string"
}
Contributors who submit a substantial pull request will be added to our Contributors list in the README.md file.
Feel free to contact the maintainers if you have any questions. We're here to help! 🚀
Thank you for contributing to make this project better! 🙌