How to get started contributing to Open source projects

I realize it might be scary and you don't know where to start, here are some steps to begin in open source:

  1. Identify your strong suit: What is your forte? what tech stack are you comfortable with.
  2. Master Git and Github (Check References section for tutorials and references on that) or you can follow Microsoft's guide to open source.
  3. Check An Intro to Open Source - Tutorials by DigitalOcean to guide you on your way to contribution success here on GitHub.
  4. Check course on How to Contribute to an Open Source Project on GitHub .
  5. The free code camp comprehnsive guide and I advice you to start contributing with small issues and low hanging fruits, up for grabs suits you for that.
  6. Look for an open source project that interests you and also use the tech stack you are comfortable with.

Now that's easier said than done, but there are some details that people oversimplify.

Gotchas

  1. You need to understand the code base and how the components work with each other.
    1. While this works well with monorepos or small projects, it isn't always neccessary, usually the modules and classes aren't intertwined.
  2. I advise you take a bottom up approach, meaning read the issue, understand where does it belong, go to the code and analyze it. Start contributing.

1. Select the Right Project

  • Start Small: Begin with projects labeled "good first issue," "beginner-friendly," or similar tags. These issues are designed to help newcomers onboard easily.
  • Choose Familiar Domains: Pick a project in a language or domain you’re comfortable with (e.g., Python for data science, JavaScript for web development).
  • Read Documentation: Ensure the project has clear contributing guidelines, a README file, and good documentation.

2. Understand the Big Picture

  • Read the README: This file usually contains the project’s purpose, how it works, and how to set it up.
  • Study the Architecture: Look for any architecture diagrams or explanations. If not available, try to infer the structure from the folder layout.
  • Try the Application: If possible, run the software locally to get a sense of how it works.

3. Prepare Your Environment

  • Clone the Repository: Set up the project locally on your machine.
  • Install Dependencies: Follow the setup instructions in the README.
  • Learn the Tooling: Understand the tools used in the project, such as Docker, testing frameworks, or CI/CD pipelines.

4. Explore the Codebase

  • Identify Entry Points:
    • Look for the main file or entry point (e.g., app.py, index.js, main.c).
    • Trace the flow from the entry point to understand how the application initializes.
  • Understand Modules:
    • Divide the code into manageable chunks (modules or packages).
    • Look for directory names, filenames, and comments to understand what each part does.
  • Follow Data Flow: Focus on understanding how data moves through the application.

5. Use Debugging Tools

  • Logging: Add print statements or logs to see how functions work.
  • Debuggers: Use IDE debuggers to step through the code (e.g., PyCharm for Python, VS Code for JavaScript).
  • Tests: Run existing tests to see which parts of the code they cover and learn about edge cases.

6. Communicate with the Community

  • Join Discussions: Engage in discussions on the project’s forums, Slack, Discord, or GitHub Issues page.
  • Ask Questions: Don’t hesitate to ask about specific functions or sections of the code. Most maintainers are happy to help newcomers.
  • Follow Issues: Observe how others are solving issues to learn the process.

7. Start Contributing

  • Work on Small Issues: Begin with documentation updates, bug fixes, or adding tests.
  • Write Tests: If a feature doesn’t have tests, add them to improve coverage.
  • Submit Pull Requests (PRs): Follow the contribution guidelines and submit PRs for review. Even small changes help build confidence.

8. Build Your Skills

  • Read Code: Regularly read open-source code to improve your understanding.
  • Practice Git: Learn version control commands like branching, rebasing, and resolving merge conflicts.
  • Understand Common Patterns: Study design patterns, architecture principles, and common frameworks used in your chosen project.

Tools to Help You Understand Large Codebases:

  1. Code Navigation Tools:
    • Sourcegraph: Powerful code search and navigation.
    • IDEs like VS Code or IntelliJ provide file and symbol searching.
  2. Visualization Tools:
  3. Documentation Generators:
    • Tools like Doxygen or Sphinx for generating docs from code comments.

Mindset:

  • Patience: Large codebases take time to understand.
  • Consistency: Regularly spend time exploring the codebase.
  • Celebrate Small Wins: Even minor contributions are steps forward.

Happy contribution :))

References

  1. Freecodecamp - How to contribute to open source.
  2. Getting Started in Git
  3. Git docs
  4. Git and GitHub tutorial.
  5. Atlassian tutorial
  6. Video beginner guide.
  7. Learn Git in 1 hour.
  8. Get started with Git.
  9. كيف يمكنك المساهمة ف المشاريع مفتوحة المصدر

Did you find this article valuable?

Support Mostafa Mansour by becoming a sponsor. Any amount is appreciated!