# Files and Folders Holiday Coding *February 28, 2025*
## Agenda - What is Holiday Coding? - Inspiration - Dive in! - Recap and Q&A

Holiday Coding

Holiday coding is improving production systems by applying understanding through effort. It is a playful way of learning on the job in off-time.

Playful
Effort
Production

!Holiday Coding

Defined as what it is not.

No Exams
No Expectations
No straight path
## Inspiration and Hooks These are lessons learned, not laws. Ideas to spark your interest.
## Files and Directories - reality (including filth) - architecture - the "right" way - the "old" way - wishes
## Directories
## by Broad Function - `src/` - `test/` - `dist/` - `lib/` - `bin/`

Hidden

                  .vscode/
                  .git/ 

Sorting

                  ~archive/
                  01_something/
                  2024-02-28/ 

Intention

                    _my_internal_folder/
                    CONFIG/

Ruby on Rails

              
                my-rails-app/
                ├── app/
                │   ├── assets/
                │   │   ├── config/
                │   │   ├── images/
                │   │   ├── javascripts/
                │   │   └── stylesheets/
                │   ├── channels/
                │   ├── controllers/
                │   ├── helpers/
                │   ├── jobs/
                │   ├── mailers/
                │   ├── models/
                │   └── views/
                ├── lib/
                │   ├── assets/
                │   └── tasks/
                ├── log/
                ├── public/
                ├── storage/
                ├── test/ or spec/
                │   ├── controllers/
                │   ├── fixtures/
                │   ├── integration/
                │   ├── models/
                ├── tmp/
                ├── vendor/
                ├── bin/
                ├── config/
                │   ├── environments/
                │   ├── initializers/
                │   ├── locales/
                ├── db/
                │   ├── migrate/
              
            

React

              
                my-react-app/
                ├── node_modules/
                ├── public/
                ├── src/
              
            

Nuxt

              
                my-nuxt-app/
                ├── assets/
                │   ├── css/
                │   └── images/
                ├── components/
                ├── composables/
                ├── content/
                ├── layouts/
                ├── middleware/
                ├── pages/
                ├── plugins/
                ├── public/
                ├── server/
                │   ├── api/
                │   └── middleware/
                └── store/
              
            

EmberJS

              
                my-ember-app/
                ├── app/
                │   ├── adapters/
                │   ├── components/
                │   ├── controllers/
                │   ├── helpers/
                │   ├── models/
                │   ├── routes/
                │   ├── services/
                │   ├── styles/
                │   └── templates/
                ├── config/
                ├── node_modules/
                ├── public/
                ├── tests/
                │   ├── acceptance/
                │   ├── helpers/
                │   ├── integration/
                │   └── unit/
                └── vendor/
              
            

.NET

              
                MyAspNetApp/
                ├── Controllers/
                ├── Models/
                ├── Views/
                │   ├── Home/
                │   └── Shared/
                ├── wwwroot/
                │   ├── css/
                │   ├── js/
                │   └── lib/
                ├── Properties/
                └── bin/
              
            

CDK

              
                my-cdk-app/
                ├── bin/
                ├── lib/
                ├── test/
              
            

Serverless

              
                my-serverless-project/
                ├── src/
                └── tests/
              
            

Laravel

              
                laravel-project/
                ├── app/
                │   ├── Console/
                │   ├── Exceptions/
                │   ├── Http/
                │   │   ├── Controllers/
                │   │   ├── Middleware/
                │   ├── Models/
                │   └── Providers/
                ├── bootstrap/
                ├── config/
                ├── database/
                │   ├── factories/
                │   ├── migrations/
                │   └── seeders/
                ├── public/
                ├── resources/
                │   ├── css/
                │   ├── js/
                │   ├── lang/
                │   └── views/
                ├── routes/
                ├── storage/
                │   ├── app/
                │   ├── framework/
                │   └── logs/
                ├── tests/
                │   └── Feature/
                │   └── Unit/
                ├── vendor/
              
            

Oclif

              
                my-oclif-cli/
                ├── bin/
                │   └── run
                ├── src/
                │   ├── commands/
                └── test/
                    └── commands/
              
            

Java

              
                my-java-app/
                ├── src/
                │   ├── main/
                │   │   ├── java/
                │   │   │   └── com/
                │   │   │       └── example/
                │   │   └── resources/
                │   └── test/
                │       ├── java/
                │       │   └── com/
                │       │       └── example/
                │       └── resources/
                └── target/
              
            

ProductHub API

              
                producthub-api
                ├── bin
                ├── coverage
                │   └── lcov-report
                │       ├── lib
                │       │   ├── handlers
                │       │   └── models
                │       └── test
                │           └── helpers
                ├── docs
                ├── scripts
                │   ├── customer-instances
                │   └── test_events
                ├── src
                │   ├── core
                │   │   ├── constructs
                │   │   └── stacks
                │   ├── services
                │   │   ├── amplitude
                │   │   │   ├── infra
                │   │   │   ├── src
                │   │   │   └── tests
                │   │   ├── api
                │   │   │   ├── infra
                │   │   │   ├── src
                │   │   │   └── tests
                │   │   ├── auto-archiving
                │   │   │   ├── infra
                │   │   │   ├── src
                │   │   │   └── tests
                │   │   ├── cognito
                │   │   │   ├── infra
                │   │   │   ├── src
                │   │   │   └── tests
                │   │   ├── create-customer-instance
                │   │   │   ├── infra
                │   │   │   ├── src
                │   │   │   └── tests
                │   │   ├── dynamodb-migration
                │   │   │   ├── infra
                │   │   │   ├── src
                │   │   │   └── tests
                │   │   ├── dynamodb-to-eventbridge
                │   │   │   ├── infra
                │   │   │   ├── src
                │   │   │   └── tests
                │   │   ├── initiative-versioning
                │   │   │   ├── infra
                │   │   │   ├── src
                │   │   │   └── tests
                │   │   ├── integrations
                │   │   │   ├── infra
                │   │   │   ├── src
                │   │   │   └── tests
                │   │   ├── measurements
                │   │   │   ├── infra
                │   │   │   ├── src
                │   │   │   └── tests
                │   │   ├── mixpanel
                │   │   │   ├── infra
                │   │   │   ├── src
                │   │   │   └── tests
                │   │   ├── secret-rotation
                │   │   │   ├── infra
                │   │   │   ├── src
                │   │   │   └── tests
                │   │   └── websockets
                │   │       ├── infra
                │   │       ├── src
                │   │       └── tests
                │   └── shared
                │       ├── authorizers
                │  
                ├── tests
                │   ├── bruno
                │   ├── config
                │   ├── helpers
                │   └── postman
                ├── tools
                └── ~archives
                    └── migrating-dynamodb-table

              
            

Unix

              
                /
                ├── bin/
                ├── boot/
                ├── dev/
                ├── etc/
                ├── home/
                ├── lib/
                ├── lib64/
                ├── media/
                ├── mnt/
                ├── opt/
                ├── proc/
                ├── root/
                ├── run/
                ├── sbin/
                ├── srv/
                ├── sys/
                ├── tmp/
                ├── usr/
                │   ├── bin/
                │   ├── include/
                │   ├── lib/
                │   ├── local/
                │   ├── sbin/
                │   └── share/
                └── var/
                    ├── cache/
                    ├── lib/
                    ├── lock/
                    ├── log/
                    └── tmp/
              
            

Windows

              
                C:\
                ├── Program Files\
                │   └── ...
                ├── Program Files (x86)\
                │   └── ...
                ├── ProgramData\
                │   └── ...
                ├── Users\
                │   ├── Default\
                │   ├── Public\
                │   └── \
                ├── Windows\
                │   ├── System32\
                │   ├── SysWOW64\
                │   ├── Temp\
                │   ├── WinSxS\
                │   └── ...
                ├── PerfLogs\
                └── ...
              
            
## Observations - Directories group things that belong together - Directories indicate core features: `middleware`, `router` - Directories are related: `src/` with `test/`
## Libraries
## Ruby (Gem) ``` my_ruby_gem/ ├── bin/ │ └── console # Optional executables (e.g., gem binaries) ├── lib/ │ ├── my_ruby_gem.rb # Main entry point │ └── my_ruby_gem/ │ └── version.rb # Nested modules/classes ├── spec │ └── my_ruby_gem_spec.rb ├── Gemfile ├── my_ruby_gem.gemspec ├── Rakefile # Task automation (test, build, etc.) └── README.md ```
## JAVA (Library) ``` my-java-library/ ├── pom.xml # Maven configuration (dependencies, build settings) ├── src/ │ ├── main/ │ │ ├── java/ │ │ │ └── com/ │ │ │ └── example/ │ │ │ └── MyJavaLibraryClass.java │ │ └── resources/ # Non-code assets (e.g., config files) │ └── test/ │ ├── java/ │ │ └── com/ │ │ └── example/ │ │ └── MyJavaLibraryClassTest.java │ └── resources/ └── target/ └── ... # Build outputs (JAR files, compiled classes) ```
## NodeJS (npm package) ``` my-npm-package/ ├── package.json # Project metadata (name, version, scripts, dependencies) ├── package-lock.json # Exact versions of installed dependencies (npm) ├── index.js # Main entry point ├── lib/ # Additional library code (optional) ├── test/ # Test files (e.g., using Jest, Mocha, etc.) ├── .gitignore └── README.md ```
## C# (Library) ``` MyCSharpLib/ ├── src/ │ └── MyCSharpLib/ │ ├── MyCSharpLib.csproj # Project definition (dependencies, build settings) │ └── Class1.cs # Library code ├── tests/ │ └── MyCSharpLib.Tests/ │ ├── MyCSharpLib.Tests.csproj │ └── Class1Tests.cs ├── .gitignore ├── README.md └── Directory.Build.props (optional shared build settings) ```
## Python (PyPi) ``` my_python_package/ ├── my_python_package/ │ ├── __init__.py │ └── module.py ├── tests/ │ └── test_module.py ├── setup.py ├── pyproject.toml (optional) ├── requirements.txt (optional) ├── README.md └── MANIFEST.in (optional) ```
## PHP (Composer) ``` my-php-library/ ├── composer.json # Defines package metadata and dependencies ├── composer.lock # Locked versions of installed dependencies ├── src/ │ └── MyPhpLibrary/ │ └── SomeClass.php # Library source code (PSR-4 namespace) ├── tests/ │ └── SomeClassTest.php # Test files (using PHPUnit, Pest, etc.) ├── vendor/ # Composer-installed dependencies (generated) ├── phpunit.xml # PHPUnit configuration (optional) ├── .gitignore └── README.md ```
## EmberJS (Add-on) ``` my-addon/ ├── addon/ │ ├── components/ │ └── ... ├── addon-test-support/ │ └── ... ├── app/ │ ├── components/ │ └── ... ├── config/ ├── tests/ │ └── dummy/ │ ├── app/ │ └── config/ ├── .editorconfig ├── .ember-cli ├── .gitignore ├── ember-cli-build.js ├── index.js ├── package.json ├── README.md └── testem.js ```
## Wordpress (Plugin) ``` my-plugin/ ├── my-plugin.php # Main plugin file (header info, hooks) ├── readme.txt # WordPress.org plugin repo readme ├── includes/ │ └── class-my-plugin.php # Core plugin logic (classes, helpers) ├── admin/ │ ├── class-my-plugin-admin.php # Admin-specific logic │ └── partials/ │ └── my-plugin-admin-display.php ├── public/ │ ├── class-my-plugin-public.php # Front-end logic │ └── partials/ │ └── my-plugin-public-display.php ├── assets/ │ ├── css/ │ │ └── admin.css │ └── js/ │ └── admin.js └── languages/ └── my-plugin.pot # Translation template file ```
## Gatsby Plugin ``` my-gatsby-plugin/ ├── package.json # Plugin metadata (name, version, main entry) ├── README.md # Usage instructions, examples ├── gatsby-browser.js # Runs in the browser (optional, if plugin needs browser APIs) ├── gatsby-node.js # Node APIs for build process (often used) ├── gatsby-ssr.js # Server-side rendering APIs (optional) ├── index.js # Main entry point (optional if specified in package.json) └── src/ └── someUtil.js # Additional source files (optional) ```
## Internal or External Lib `npm install {package}` `ember install {addon}` `/lib` is a good first step! If terminology is disconnected from your apps domain, it might be better to look at `lib/`
## Observations - Libraries are shaped by language conventions. - It is not uncommon to see plugin libs be a strange hybrid of a plugin and an app. - Plugins are an interesting peak into the working of frameworks.
## Files
## Preferred Casing Language and Framework dependent `some-file.js` `someFile.js` `some_file.js`
## Singular vs Plural `model/users.js` vs. `user.js` `controller/user.rb` vs. `users.rb` `config/environment.rb` vs. `environments.js`
## File Extensions - Type: `.js` | `.rb` | `.sh` | `.md` | `.bat` - Status: `.bak` | `.old` - Data Format: `.json` | `.jsonl` | `.csv` | `.md` | `.yml` | `.ini` - Classify: `.test.js` | `.spec.js` | `.d.ts` - Bespoke: `.rake` | `.task` | `.h` | `.config`
## Magic File Patterns - Test files are being detected throughout a codebase testing for the `.spec` and `.test` pattern - Type files are being ignored `.d.ts` - Date sorted `2025-02-28/`
## Entry Files - `index.ts` - `index.html` - `__init__.py` turns a directory into a package. - `lib/my_gem.rb` for a gem called my_gem. (convention) - `main.go` - Java and C# look for `Main()` method instead.
The `AWS CDK` has interesting magic on lambda functions bundling. ``` const authHandler = new NodejsFunction(this, "auth"); ``` Searches for this file pattern. ``` api.ts # holds the infra code api.auth.ts # holds a lambda function references as the "auth" function. ``` While writing the infra code, it feels fast. It's not very convenient when you scale.
## Repeat? `app/controllers/users.rb` or `app/controllers/users_controller.rb`

How to group?

Frameworks by function. Services by service.

                user_handler.js
                user_controller.js
                user_validator.js
              

                handlers/user.js
                controllers/user.js
                validators/user.js
              

                users/handler.js
                users/controller.js
                users/validator.js
              
## Test File Location? Given: `app/models/user.js` Where do you put your test file? `app/models/user.test.js` or `test/models/user.test.js`
## Different for Lib directory? `lib/utils/some_parser.js` Generally leads to `lib/utils/some_parser.test.js`
## Ownership What generated a file? Who generated a file? Will it be re-generated? Colleague / Framework / Plugin
## Source Control Is the file in source control? Does it have to be?
## Magic files and Folders
## .DS_Store Thank you Apple.
## Docker - Dockerfile - docker-compose.yml - dockerignore
## Git - `.gitignore` - `.gitkeep` - `.gitattributes` - `.gitmodules` - `.mailmap` - `.git-blame-ignore-revs`
## Linting & Editors - `.prettierrc` - `.eslintrc` - `.editorconfig`
## Observations These files are power houses with a lot of features. If you want to wonder, magic files are magical!
## Holiday Wanderings

TREE


              brew install tree
              tree -d -L4
              tree -L4
            
            
## Why?! - What does each directory do? - Is it a language convention? - Is it native to a framework? - It it native to an included library? - Are files "properly" located? - Why the !@# is there not a single config directory?
## Generated Files Check your `dist/` folder. Which part of your application generates each file?
## Cleanup Create a file name convention. Make all files comply.
## Clean Checkout Learn about all `.git{something}` files. Go through the codebase and apply them.
## Restructure Be inspired. Restructure your codebase.
## To Lib or not to Lib? Which parts of your codebase could be an internal or external lib? Internal or External Add-on? Make it so.
## Du-du-duplicate? How many linters? How many editor configs? How many test frameworks? How many entry points into environments?
## The Recipé Power through Reality! - Wander and be inspired. - Pick a concept - Apply it in full on production code. - The more 'grunt work' it needs, the more satisfying it will be.
# Your Turn
## Discussion Time - What inspired you? - Where did you wander?
# Thank You!