loading...

Where do you keep your code?

seanxe profile image Sean Crossey ・1 min read

How do you organise your code on your machine? I don't mean github/bitbucket, but actually on your hard drive?

I always create a directory called "Projects" under my username:

/Users/seanxe/Projects/

Inside there i group into various folders:

  ├── github.com/
  |   ├── username/
  |   ├── username/
  ├── project1/
  ├── project2/
  ├── playground/
  |   ├── js-test-1

How do you organise your code?

Discussion

markdown guide
 

A folder called projects/ with clients, school, sideprojects and templates as subfolders.

What I'd really love though, is for DropBox to come with a .gitignore like file so I can finally stash everything on Dropbox, minus the node_modules and such.

 

I'm surprised they wouldn't have that.

 

Right? If you google the issue you'll find hundreds of requests for it, and some workaround solutions, but if Dropbox would just natively support it, that would be so nice!

 

C:\Code\{project_name}. I try to keep the complete path as short as possible, because once in a while I end up having to type the whole thing into a terminal.

 

Almost same here! C:\Projects\{project_name} to keep path names short.

 

My variation: D:\development\projects with SDKs or compiled libraries in D:\development\sdk

 
 

In my home folder, I have a directory titled Code/, which contains all my programming work overall. Within that, I have Repositories/ for anything tracked by Git (I also have a repos/ link in my home folder to that. I also have a few other folders for different types of code - stuff I'm studying, "firing ranges" (for testing ideas outside of Git), and so forth.

 

firing ranges is a great term!

 

Almost everything's in ~/work. I keep a ~/scripts for useful Bash/SQL/etc files that don't belong in source control and that I don't want to commit to my dotfiles for various reasons.

If I'm working on a complex project with multiple modules, I'll create ~/work/projectname and group them under that.

 

~/Workspace/<Language>/<theme>/<project>
For example: ~/Workspace/Python/mailing/easy_mail

It helps me to keep an organized structure when I need to switch between different projects from different languages and it's more understandable when open in Sublime Text

 

That's really interesting!

So if you had a client side app written in JS, and an API (that complements the client side app) written in python, they would be in completely different locations?

Does that not get frustrating having them "so far apart", so to speak?

 

In this case, I group it into the main language folder. For example, if I have a huge project in language X but also using some Y, then I include it into the structure:
~/Workspace/X/<project_type>/<project_name> with sub folders matching my structure (/third_parties, /tools, etc.)

But indeed, when I will work on projects containing several languages, it would be a mess and I would change this.

 

I have two directories:

  • ~/source for personal projects
  • ~/work/source for company projects

The structure in bot directories is the same. Here my work directory:

source
├── customer-1
├── documents
│   ├── README.md
│   ├── note
│   ├── presentation
│   ├── resource
│   └── todo
├── github.com
│   ├── google
│   ├── hoxu
│   ├── jooby-project
│   ├── logiball
│   └── paul-hammant
└── monorepo

Because we working with a monorepo, I have not so many more directories in my source folder. The document directory contains all my presentations, nodes, etc. in a company wide available git repository.

 

I always have issues with that!! I don't know if directory layout should be techonology- or business- centric..

For example..
I am working on some little AWS project. There is current dir layout

- prj
--- aws-python
------Wallet <LambdaPython app>
-------- android
-----------Wallet Android client app

should it be rather:

- prj
-------- Wallet
---------- Android
---------- lambda
 

Almost the same as the others wrote here, I do keep all my work under ~/x/projects.

The reason behind the x folder is historical, and I only keep it for backward compatibility (with the old me 😂). And yes, I ONLY use Linux based distros on my local machine, mostly Ubuntu.

Under the "projects" dir I usually (not always, especially if it's one-time contribution) keep the subfolder names follow {report owner}/{repo name} convention, which basically mirrors my GitHub work (my rule is, if it's not on GitHub then it's probably in ~/x/trash )

 

All my projects are in /www

|-- www
|   |--- 2015
|   |--- 2016
|   |--- 2017
|   |     | --- DailyDesigns
|   |     | --- DailyExperiments
|   |     | --- DailyNode
|   |     | --- Other

I use gitlab to manage my git repos and it allows me to create groups. The group names reflect the same names as the above. Even though you didn't ask for it. The way I manage my gitlab helps me navigate my hard drive very nicely.

 

on macOS, in /Users/<user-name>/Code/ (a.k.a. ~/Code):

├── _sandbox/   <--- for any experiments, tutorial follow-alongs, etc.
├── github.com/ <--- for all things hosted on GitHub.com
|   ├── <group-or-username>/
|   |   ├── <project-name>/
├── gitlab.com/ <--- for all things hosted on GitLab.com
|   ├── <group-or-username>/
|   |   ├── <project-name>/
├── <git|hub|gitlab>.<private-server-name>/ <--- for any self-hosted instances of GitLab
|   ├── <group-or-username>/
|   |   ├── <project-name>/
├── local       <--- for all things that aren’t simply experiments but are only hosted locally

For example: ~/Code/github.com/dallas/grommet/ for my fork of the Grommet repo on GitHub.

 

I use one level more than most people for OS projects:

~\Development\<github-organisation>\<repo-name>

For bespoke client development, it is

~\Clients\<client-name>\<project-name>

 

I prefer a somewhat more flat structure and so far keeping all my code in a dev/ directory within my home path has worked out pretty well for me. Of course, that requires meaningful namespaces for your projects but as we all know:

There are only two hard things in Computer Science: cache invalidation and naming things. (Phil Karlton)

 

I have a folder "WSpace" in the home folder. So it's "/Users/Subbu/WSpace", and I have organized all the projects under two main categories Work, Personal.

--> /Users/Subbu/WSpace

----> Personal
------> Project 1
-----------> Project 2

---------> Work
-----------> Project 1
-----------> Project 2

 

On my work laptop I am using Ubuntu so all my web projects live in sub directories of /var/www/

At home I run xampp on windows so all my web projects live in sub folders of C:/xampp/htdocs/

In both cases I can view the sites in my web browser as apache is set up to run them from there.

As for non-web projects such as desktop apps I just use the default location for visual studio projects.

 

Anything on a remote public server (GitHub, etc):
C:\User\Sources\Repos

Anything on a remote private server (Visual Studio Team Services):
C:\User\Sources\Private

Anything that never leaves my machine:
C:\User\Sources\Local

 

For work related stuff:

~/workspace/{projectName}

For demos, trying new stuff out, and playing with others git repos:

~/playspace/{projectName}

 

I have the following structure:

~/projects/[client-name]/[project-name]/

In this folder there are 2 folders:
/briefing <= holds psd-files, pdf's, notes I make
/project <= all the code is here, under version control (github mostly, but depends on the client)

I used to have a seperate folder for my personal projects, but I find it easier to make time for them when I treat them the same as more professional, "pay for food and stuff"-projects :)

 

Pretty much the same here.

~/Projects/<project-name>

and

~/Projects/go/

since Go requires projects to be in the go directory

 

I name my dev folder '~/workspace' because... I think it's the default in Eclipse? I don't even use Eclipse anymore. It just made sense so I kept it going out of continuity.

 

I wrote on how I organize my files here. Feel free to check it out.

 

~/source => repos
~/programming => misc code / projects not in source control
~/bin => scripts / executables

 

I have all my projects in /var/www/CUSTOMER/PROJECT

And my apache is set up with virtualdocroots

CUSTOMER.PROJECT.dev or CUSTOMER.PROJECT.devs (if webroot is in ./web)