What is your directory structure like for programming?
from crimsonpoodle@pawb.social to linux@lemmy.ml on 03 Nov 01:33
https://pawb.social/post/15890311

For most of college, I’ve kept it simple: I’d create a directory in my home folder for each project, then eventually move older or inactive ones into ~/programming/. When I change devices or hit file size limits, I’ll compress and send things to my NAS.

This setup has worked pretty well so far. But now that I’m graduating and my projects keep stacking up, I’m starting to wonder if there’s a more efficient system out there.

Curious—how do you all organize and store your projects? Any tips or methodologies that have made your lives easier over time?

The only person I’ve talked to about this is my mentor who’s been programming since the 60s (started on the IBM 1620 and Bendix G15) and he just mostly keeps projects in directories in his home directory and uses his godly regular expressions skills to find things that way. Makes me wonder if I’m overthinking it…

#linux

threaded - newest

vinnymac@lemmy.world on 03 Nov 01:44 next collapse

Similar question was recently asked here

Generally what I’ve seen work well in my career and is consistent across thousands of devs I’ve worked with: ~/[whateverFolderNameYouWillRemember]/[organization]/[project]

I recommend when it comes to finding things to just use a fuzzy finder, such as fzf.

fool@programming.dev on 03 Nov 05:41 collapse

Building on this, I recommend zoxide instead of only fzfing or regexping.

For people who like to keep everything they ever create, like college students, you can use z 18.04/1 to get to a directory like ~/hw/random-school/fresh-1/analysis-18.04/pset1.

Lets you nest without fear.

(Also, about your question: I’ve personally used ~/git/<projname>/ and ~/git/<org>/<projname> at the same time – e.g. ~/git/aur/fuzzel-git)

nous@programming.dev on 03 Nov 01:53 next collapse

When I change devices or hit file size limits, I’ll compress and send things to my NAS.

Whaaatt!?!!? That sounds like you don’t use git? You should use git. It is a requirement for basically any job and there is no reason to not use it on every project. Then you can keep your projects on a server somewhere, on your NAS if you want else something like github/gitlab/bitbucket etc. That way it does not really matter about your local projects, only what is on the remote and with decent backups of that you don’t need to constantly archive things from your local machine.

crimsonpoodle@pawb.social on 03 Nov 23:49 collapse

Yeah I think a local Git server would be good, will try our forgejo since people seem to like it— I’ve been using git for a lot of projects but not so much for large files and HW stuff since when using GitHub there are size limitations. Does seem like it would be freeing to be able to delete whatever I want from my workstation without worrying about losing stuff

deathmetal27@lemmy.world on 04 Nov 01:13 collapse

Size limitations? In git?

What is the average size of your source code files?

Normally you’d never run out of space in git unless you’re committing large binary files.

scratchandgame@lemmy.ml on 03 Nov 05:14 next collapse

~/real

~/real/cprac

~/real/git

danielquinn@lemmy.ca on 03 Nov 09:39 next collapse

  • Keep everything in an external git service. You can use third party services like Codeberg, GitLab, or GitHub, or host your own on your NAS.
  • When you’re not working on a project and don’t think you’ll need to reference it for a while, just delete it from your laptop. The code always lives in git anyway.

In terms of local storage, I usually have everything in ~/projects/project-name, and I don’t have tiny file size limits because I don’t use FAT32 filesystems — that’s the default filesystem you usually get on USB sticks and external hard drives you buy. You have to format those drives to something like EXT4 (Linux) or NTFS (Windows) or you get stuck with FAT32 which has 2gb file sizes.

N0x0n@lemmy.ml on 03 Nov 09:47 next collapse

What about exFAT? It overcomes FAT32’s limitation and is nearly readable on every OS and has way higher file size limits.

Edit: In case of external storage like USB/hard drive.

danielquinn@lemmy.ca on 03 Nov 11:29 collapse

ExFAT is good for portable devices, but if you’re working with something internally, there’s no reason not to use EXT4 or NTFS.

stewi1914@sh.itjust.works on 03 Nov 10:13 collapse

You’ve forgotten about exFAT my dude. Nothing uses FAT32 anymore. All your usb drives will be exFAT.

danielquinn@lemmy.ca on 03 Nov 11:27 collapse

That’s not been my experience. Lots of drives I’ve bought have been FAT32 out of the box.

stewi1914@sh.itjust.works on 03 Nov 10:17 next collapse

Devs who don’t use git and devops properly are infuriating to work with. I’d recommend getting started with that ASAP.

digdilem@lemmy.ml on 03 Nov 19:31 collapse

I think your reply would have been more useful if you’d given some pointers about how, instead of just “do it right”.

MachineFab812@discuss.tchncs.de on 03 Nov 23:44 collapse

No one should be basing their “how to do it right” on a single forum comment. Talk about scope-creep for the offering of advice.

telepresence@discuss.tchncs.de on 03 Nov 10:46 next collapse

i use coding/languagename/project, where most if not all projects are git repos. so, coding/python/shira, coding/java/datetime examples i have some wildcards for the languages, most of my serverside js stuff lives in coding/node-deno and most of my fullstack webdev stuff lives in coding/webdev

i used to have the coding directory on a hdd, but moving it to an ssd helped a lot when installing things made with node, among other things.

quilan@lemmy.world on 03 Nov 11:34 next collapse

projects/[rust|cpp|python|…]/proj-name

faultypidgeon@programming.dev on 03 Nov 20:03 collapse

I used to do this, but imho the used language is hardly a useful index. When does it happen that you want to see everything written python? For me that’s never.

Also where do you put multi-language projects? Like, go backend with typescript frontend or whatever.

eatham@aussie.zone on 03 Nov 11:43 next collapse

I put stuff in places, then immediately forget where I put them.

MachineFab812@discuss.tchncs.de on 03 Nov 23:39 collapse

“… and God said, let us make man in our own image.”

communism@lemmy.ml on 03 Nov 13:09 next collapse

I don’t have many so I just put them all in ~/own_repos (as opposes to another directory I have for other people’s git repos). Maybe if/when I have more projects I’ll have a more elaborate system.

TimeSquirrel@kbin.melroy.org on 03 Nov 13:16 next collapse

As an addition to your post, I'm also in the process of learning C/C++, and I'm curious also how others arrange their actual project files and include directories. Like, for example, if there's a bunch of classes having to do with UI elements, do you just group them each under their own file all in their own directory? I've also seen projects where everything was just thrown into the top level directory, both headers and implementation files together in a giant pile of source files.

qaz@lemmy.world on 03 Nov 13:27 next collapse

I used to be put everything in ~/Programming at the top level. I later started grouping projects by type (JVM, Web etc.) in subfolders because it was getting hard to find things. This was synced with Nextcloud. However, I then at some point passed 2 million files (200GB) in said folder and decided to search for a better solution.

I ended up using a selfhosted Forgejo instance. It allows for easy code searching across all projects, tagging projects by topic and language, LFS, and has useful project management tools built-in.

UnRelatedBurner@sh.itjust.works on 05 Nov 07:34 collapse

I’ve seen a lot of talk about large file sizes. How can you realistically reach 200GB in text? That’s around 2*10^11 characters. Or do you guys store something else as well, like sqls of data or pictures/textures/models?

qaz@lemmy.world on 05 Nov 08:30 collapse

It consisted of tensors weights, datasets (which can reach several gigabytes), images, 3d models, and roughly 250+ programming projects with binaries, git without LFS and also a lot build files.

Nextcloud was able to sync it all, but syncing was getting so slow that I had to keep my new laptop running for almost an entire day to get all synced to it. It also wasn’t that great at excluding certain folders (like build cache folders or NPM package files), you would have to set up exclusions on each device separately. Another problem with Nextcloud sync was that it would sometimes duplicate projects after had been moved in a subfolder.

Dragonish@lemmy.dbzer0.com on 03 Nov 14:29 next collapse

Hosting my own git server on my NAS made my life easier and better due to the new freedoms it offers. Backups are centralized, and I have all the space i need to keep any interesting code safe. I am using forgjeo now and highly recommend it. You can also use other front ends (or none and just ssh/filesystem) but forgjeo gives me artifacts (ie docker registry), code search, LFS, and more. With my own git server, my local filesystem only has what I am working on recently (or as my workstation space allows). My home folder has a folder for each version control system (git, pijul, svn). Inside of these i have 2 sub folders: <domain>/<repo name>

Some examples of different domains are: open, work, personal, dragonish. I do not separate what forge or remote service in the filesystem, this is a persona boundary.

I use git remote names and branches in each repo to handle what software forge and any upstream/maintainers i need to work with. As an example my work repos only get pushed to my work server (ie, only 1 git remote named origin set to my work’s server), but my open ones will go to forgjeo and github (i setup 2 git remotes, origin and github. origin in this domain goes to my forgjeo). If i have a need i go into some more git branching strategy which I do find has helped me over my life, but I think I am overthinking this post now! keep it all simple enough for what your needs are.

JTheFox@lemmy.world on 03 Nov 14:59 next collapse

I also use a NAS as my primary git server, although I’ve never heard of Forgejo before, but it sounds really interesting and definitely something that I may look into. It sounds really handy to have on hand, especially with code search and LFS. So thanks for introducing that!

crimsonpoodle@pawb.social on 03 Nov 23:47 collapse

Def going to check this out— I think it will solve my biggest problem with GitHub which is just the number of large files I have to deal with— overthought comments are the best comments- thanks!

0x0@programming.dev on 04 Nov 12:42 collapse

Try forgejo, it’s the forge Codeberg uses.

fruitycoder@sh.itjust.works on 03 Nov 19:18 next collapse

${HOME}/Projects/(Personal|Work)/<project name>

If either folder gets to busy I start to create projects Meta folders that normally corospond with a gitlab group.

I just blow out the folders with a good ol rm -rf ./ And git pull if I want to mess with it again.

faultypidgeon@programming.dev on 03 Nov 19:55 next collapse

I push every project I work on right away to my gitea instance. If I expect not to work on something for some time I just delete the local copy.

When I change devices or hit file size limits, I’ll compress and send things to my NAS.

Well, that sounds inconvenient.

crimsonpoodle@pawb.social on 03 Nov 23:45 collapse

Yeah, I really should start using Git for everything, but I’ve been working with a lot of large datasets recently (mostly EEG data). A big part of improving accuracy comes from cleaning the data, which is huge and takes a while to process. I could set up a local Git server to keep track of everything or just save the base data files and regenerate as needed, but on my current setup, that process can take anywhere from 2-6 hours depending on the task. So for now, I’ve just been managing everything locally to save time.

faultypidgeon@programming.dev on 04 Nov 05:16 collapse

git LFS might be for you. If the data takes so long to reprocess I think it is fine to check it in (possibly using LFS).

linearchaos@lemmy.world on 03 Nov 22:59 next collapse

I keep a root folder. On Windows it’s in c:\something on Linux it’s in /something

Under there I’ve got projects organized by language. This helps me organize nix shells and venvs.

Syncthing keeps the code bases and synced between multiple computers

I don’t separate work from home because they don’t live in the same realm.

Only home stuff in the syncthing.

AA5B@lemmy.world on 03 Nov 23:49 next collapse

Everything is in git, and I tend to use IntelliJ as an IDE. So my projects are all in ~/Ideaprojects/[PROJECTNAME]

moreeni@lemm.ee on 04 Nov 04:07 next collapse

I have a dedicated directory with subdirectories for each project and that’s it

DieserTypMatthias@lemmy.ml on 04 Nov 05:41 next collapse

Whatever Cargo generates for me. If I use workspaces, then I put the subprojects to the root of the directory.

BatmanAoD@lemmy.world on 04 Nov 06:36 collapse

I think this is asking about where to keep projects, not how to organize them internally.

DieserTypMatthias@lemmy.ml on 04 Nov 06:48 collapse

Ah, OK. I keep them in the Documents directory.

Linus_Torvalds@lemmy.world on 04 Nov 20:09 collapse

xd

Nibodhika@lemmy.world on 04 Nov 07:06 next collapse

On my personal computer ~/Projects/<name>, you need to remember that real-life is not like college, you won’t be working on a new project every week. If you have more stuff than you can manage like this, you’ve bitten more than you can chew.

On my work computer it’s a bit more complex, because I have to work with other people’s projects as well, so I have a ~/Work folder and in it several folders by type of stuff, e.g. ops for operational stuff such as scripts to deploy stuff or grant permissions, code for servers (and client) code, etc. Also if I’m working on something specific that requires multiple repos I create a folder for that project with the repos inside.

MXX53@programming.dev on 04 Nov 20:24 next collapse

I have a folder for my projects on root and within those projects I have my GitHub repos all contained within their own directory named the same as the project.

If I am learning something, I have a folder for the topic I am learning, and a logseq file with all of my notes. Then I have folders for my book references, one for video or audio references, and then a folder for my practice projects.

Katzenmann@feddit.org on 04 Nov 20:25 collapse

I just have all my active projects under $HOME/projects/ and projects from other people in $HOME/bin/