DEV Community

Where do you keep your code?

Sean Crossey on December 04, 2017

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 ...
Collapse
 
ardennl profile image
Arden de Raaij

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.

Collapse
 
ben profile image
Ben Halpern

I'm surprised they wouldn't have that.

Collapse
 
ardennl profile image
Arden de Raaij

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!

Collapse
 
isaacdlyman profile image
Isaac Lyman

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.

Collapse
 
buinauskas profile image
Evaldas Buinauskas

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

Collapse
 
weswedding profile image
Weston Wedding

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

Collapse
 
dansilcox profile image
Dan Silcox

C:\git

Collapse
 
codemouse92 profile image
Jason C. McDonald

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.

Collapse
 
seanxe profile image
Sean Crossey

firing ranges is a great term!

Collapse
 
dmfay profile image
Dian Fay • Edited

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.

Collapse
 
pbouillon profile image
Pierre Bouillon

~/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

Collapse
 
seanxe profile image
Sean Crossey

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?

Collapse
 
pbouillon profile image
Pierre Bouillon

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.

Collapse
 
lukaszkuczynski profile image
lukaszkuczynski • Edited

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
Collapse
 
aurelkurtula profile image
aurel kurtula

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.

Collapse
 
z0al profile image
z0al • Edited

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 )

Collapse
 
ghost profile image
Ghost

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.

Collapse
 
dallas profile image
Dallas Reedy

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.

Collapse
 
nibra profile image
Niels Braczek • Edited

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>

Collapse
 
matchilling profile image
Mathias Schilling 💾 • Edited

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)

Collapse
 
subbramanil profile image
Subbu Lakshmanan • Edited

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

Collapse
 
programazing profile image
Christopher C. Johnson

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

Collapse
 
dougmckechie profile image
Douglas McKechie

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.

Collapse
 
linuxguist profile image
Nathan S.R.

I have written a free and open source software for storing various things in it, by all teams and sharing it here, through this small post: dev.to/linuxguist/storing-various-...

Collapse
 
ameliagapin profile image
Amelia Gapin

Pretty much the same here.

~/Projects/<project-name>

and

~/Projects/go/

since Go requires projects to be in the go directory

Collapse
 
hohonuuli profile image
Brian Schlining • Edited

For work related stuff:

~/workspace/{projectName}

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

~/playspace/{projectName}

Collapse
 
willemw profile image
Willem Wollebrants • Edited

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 :)

Collapse
 
erinlmoore profile image
Erin Moore

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.

Collapse
 
eaglecheow profile image
eaglecheow

Usually ~/dev/ProjectName

Collapse
 
roger profile image
Roger Stach

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

Collapse
 
pmcgowan profile image
p-mcgowan

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

Collapse
 
ramlev profile image
Hasse R. Hansen

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)