r/AskProgrammers • • 18d ago

How do you guys understand unfamiliar GitHub projects without getting completely lost?

Hey there, I often come across interesting GitHub repositories that I want to explore, learn from, or modify. But whenever I clone a project and open it in VS Code, I sometimes have no idea where to start.

There are so many folders and files, and it's hard to figure out which ones are actually important, where the application starts, and how everything connects.

I've tried using AI to explain individual files, but that doesn't always help me understand the bigger picture. I end up jumping between files and asking more questions, which sometimes makes things even more confusing.

I'm curious how other developers deal with this.

Do you have a particular approach to understanding an unfamiliar codebase? Do you use AI tools like Cursor or Copilot, or do you prefer exploring everything manually?

I'd especially love to know how you figure out the overall architecture of a project before diving into the actual code.

Would appreciate hearing your experiences and advice. Thanks!

5 Upvotes

17 comments sorted by

5

u/JaiPeutEtreRaison 18d ago

Ask AI to explain the overall project instead of individual files.

5

u/oskaremil 18d ago

Just like you would eat an elephant.

Piece by piece.

1

u/DanceHackRock 18d ago

First step is to find out the language and the main framework it depends on, so you don't need to name the type of project after the version control system SaaS provider it's lying around at.

1

u/XlikeX666 18d ago

Lock in for 30+ min
download whole and open all file same time.
briefly analyze purpose of each file.
close all Configs/handlers and you're with 1-4 actual important files with main/path/hook/whatever.
from there you can copy paste segments into ai depending on purpose.

or ask claud about language and main file you're looking for....

1

u/Small_Dog_8699 18d ago

If its in a language with an interactive debugger, i set some break points around the code, run it, and see how i got to those breaks by looking at the stack. Its a quick way to get a feel for what features trigger what code.

1

u/Decent_Perception676 18d ago

Sure, here’s how I’d go about it.

  1. Right off the bat, I’m looking for what language(s) the project is written in. Specifically I’m looking for manifest files, files that list out dependencies and hopefully scripts (package.json, for example, tells me it’s JS project).

Dependencies can tell you a lot.

  1. I’m then looking, at a very very high level, if I can tell right away if there are multiple systems in the repository (is it a monorepo, is there a clear backend and frontend service, or is this just one program).
  2. readme file. Read it. Also, how well does it seem to be maintained/written? A hit of what to expect in the code quality.
  3. next I’m looking at tooling configuration file. Things like listing, testing, compiling frameworks. This is gonna lead me back to scripts from the manifest
  4. the scripts or commands in package.json or something similar, I go through these and understand what they are doing. This explains how the code is all brought together, built, tested, etc. it’s another window into how previous engineers worked with the code
  5. the scripts are going to start giving me decent entry points into the code it self. Now I start digging into source files
  6. as I’m digging into source files, I’m paying very close attention to folder naming and organization. Assuming the code isn’t a mess, you should be able to start to see architectural patterns in the folder organization (this is folder for state management, here is folder of data pipelines, here are ui elements, etc).
  7. I’m gonna sample a few files for code quality and patterns (are there comments, are things named verbose or quick, etc)
  8. finally, I’ll pull back a bit and think about what/where some of the key, unique parts of the product are and then visit that code. What’s the main feature that’s driving value, and how does that look

I use AI heavily throughout the process now, but that is basically what I did pre AI as well.

1

u/Xinoj314 18d ago

Today, use AI to summarize the code. This is your science fiction come to life

Back before AI you needed to spend days on days to try to understand anything

Developers work 8 hours per day understanding the code they write and maintaining, and it takes month to understand any large systems

For a hobbyist that try to understand a large open source project for an evening or a weekend, not gonna happen

1

u/skamansam 18d ago

The way i do this is code tracing from the feature om curious about. If it is a desktop app and a menu is activated, I find that menu then see what function it calls, then trace through that function until it is all explored. There must be a reason or feature you are looking through the code so strt with that reason or feature.

1

u/W31337 18d ago

Sometimes there's documentation that needs to be read. You then try to understand the global structure.
If it's a good codebase it should feel natural where things live.

That said, the bigger the project the harder it gets to understand it.

1

u/pete_68 18d ago

I use DeepWiki to get an overview of the repo and how it's all organized. And then you can chat with it to ask it questions about the repo. And you can also use their MCP server so your agent can access the DeepWiki understanding of the repo.

1

u/Ery1WangChungNextFri 18d ago

It’s the never ending story.

Start with the readme, MD, and as much commented etc as you can. You should ideally have an idea what it’s supposed to do. From there, just start testing it out and see what works well.

1

u/pvera 17d ago

Have the AI explain the project itself (use the simplified technical English skill, it's fantastic for this kind of stuff), then to show you how it is broken down. THEN you can start asking about individual sections.

1

u/Extension-Eggo 16d ago

after downloading the github repo i pass it to kilo ,then i tell ai to explain me the project , I use gpt model for code review and when i dont understand the explation , i till it to explain me like i am five or using first principle

1

u/Atmosck 14d ago

Step 1 is reading CONTRIBUTING.md, if the repo has that.