Ask HN: How do you organize your code?

3 points by blackhaj7 ↗ HN
I have a new computer and want to start fresh so I am looking for inspiration.

On my old computer I stored everything under ~/code

This got unwieldy so I then had a few folders: ~/code/focus ~/code/bin ~/code/2023 etc

How do you organize your code?

Got any other organization tips e.g. on dotfiles?

6 comments

[ 6.4 ms ] story [ 28.3 ms ] thread
Stuff that I'm actively working on is in ~/dev. Once I'm no longer actively working on it, I move it to ~/Projects with a subdir name that is the name of the project. I don't do any further organization than that because filesystem tools make it easy for to find things from there.

All project notes are in a Wiki I host on my main server. These notes include where the project files are being stored. In practice, the wiki is my primary gateway/index to the projects.

The one hiccup to this is with projects that aren't software-only. CAD files, PCB layout files, photos, etc. I don't put them in ~/dev because in my mind, that's for software. So I just put them straight into ~/Projects. It's not ideal to have project files split like that, but I haven't come up with a better solution yet.

Sounds like a good setup! Thanks
Honestly it's a mess. I still do unwieldy naming schemes like:

    PROOJECT1-FINAL-WORKING-COPY-A
    PROJECT2-NEW-FINAL-V1
    PROJECT2-NEW-FINAL-V2
But once it's on Github, it automatically gets version controlled, so I can roll back to a working state if I make a mistake.
Oh I have plenty of project-name-new-newer-newests!
I have taken to just using git's local repository. That way my version control history stays local with the project itself. I've found it to be a lot easier to manage that way than having a central repository that holds all my projects.

Although I'm considering moving away from git to a different version control system, so this may change.

I had this same issue when working with Jupyter notebooks during my data science days, but after getting used to using GitHub on a team, all my code is just neatly organized in separate folders/repositories and every update is committed. It's fairly effortless now.