Skip to content

Latest commit

 

History

History
178 lines (131 loc) · 4.29 KB

File metadata and controls

178 lines (131 loc) · 4.29 KB

Contributing to Todo API

First off, thank you for considering contributing to Todo API! It's people like you that make this project better for everyone.

Code of Conduct

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 the project maintainers.

How Can I Contribute?

Reporting Bugs

Before creating bug reports, please check the existing issues to avoid duplicates. When you create a bug report, include as many details as possible:

  • Use a clear and descriptive title
  • Describe the exact steps to reproduce the problem
  • Provide specific examples to demonstrate the steps
  • Describe the behavior you observed and what you expected to see
  • Include screenshots if applicable
  • Include your environment details (OS, Node.js version, etc.)

Suggesting Enhancements

Enhancement suggestions are tracked as GitHub issues. When creating an enhancement suggestion, include:

  • Use a clear and descriptive title
  • Provide a detailed description of the suggested enhancement
  • Explain why this enhancement would be useful
  • List any alternative solutions you've considered

Pull Requests

  1. Fork the repository and create your branch from main
  2. Make your changes following our coding standards
  3. Add tests if applicable
  4. Update documentation if needed
  5. Ensure all tests pass by running npm test
  6. Run the linter with npm run lint:fix
  7. Format your code with npm run format
  8. Write a clear commit message following our commit message guidelines
  9. Submit your pull request

Development Setup

  1. Fork and clone the repository

    git clone https://github.com/YOUR-USERNAME/ToDo-APIs.git
    cd ToDo-APIs
  2. Install dependencies

    npm install
  3. Create a branch for your changes

    git checkout -b feature/my-new-feature
  4. Set up environment variables

    cp .env.example .env
  5. Run the development server

    npm run dev

Coding Standards

TypeScript Style Guide

  • Use TypeScript for all new code
  • Follow the existing code style
  • Use meaningful variable and function names
  • Add JSDoc comments for public APIs
  • Keep functions small and focused
  • Use async/await instead of callbacks

File Organization

  • Place new features in appropriate directories
  • Keep related code together
  • Use index files to expose public APIs
  • Maintain separation of concerns

Testing

  • Write tests for new features
  • Maintain or improve code coverage
  • Use descriptive test names
  • Test edge cases and error conditions

Commit Messages

Follow the Conventional Commits specification:

  • feat: New feature
  • fix: Bug fix
  • docs: Documentation changes
  • style: Code style changes (formatting, etc.)
  • refactor: Code refactoring
  • test: Adding or updating tests
  • chore: Maintenance tasks

Examples:

feat: add pagination to todo list endpoint
fix: resolve memory leak in todo model
docs: update API documentation for new endpoint

Project Structure

todo-api/
├── src/
│   ├── config/         # Configuration files
│   ├── controllers/    # Request handlers
│   ├── middleware/     # Express middleware
│   ├── models/         # Data models
│   ├── routes/         # API routes
│   ├── types/          # TypeScript types
│   ├── utils/          # Utility functions
│   ├── app.ts          # Express app setup
│   └── server.ts       # Server entry point
├── tests/              # Test files
└── ...

Running Tests

# Run all tests
npm test

# Run tests in watch mode
npm run test:watch

# Run tests with coverage
npm test

Code Quality

# Lint code
npm run lint

# Fix linting issues
npm run lint:fix

# Format code
npm run format

# Check formatting
npm run format:check

Building

# Build the project
npm run build

# Clean build
npm run build:clean

Questions?

Feel free to open an issue for any questions or concerns. We're here to help!

License

By contributing, you agree that your contributions will be licensed under the MIT License.