Skip to content

Instantly share code, notes, and snippets.

@therebelrobot
Forked from nijikokun/doc.md
Created July 22, 2016 22:33
Show Gist options
  • Save therebelrobot/9cbbbec0d0b25a84ce0032276557b4f8 to your computer and use it in GitHub Desktop.
Save therebelrobot/9cbbbec0d0b25a84ce0032276557b4f8 to your computer and use it in GitHub Desktop.
Building Javascript Frontend / Backend Applications

Document for the best design choices you can make for your software.

Terminology

  • DDD - Domain Driven Design
  • FF or FTF - Function First Design, or File-type First Design is structuring your application by it's function before the files such as a directory named components containing all component files.

File Structure

Structuring applications is hard, here are a few resources to help. Most are Domain Driven Design (DDD). It's powerful and works for small to large scale applications.

  • Ember
  • React
    • Organize For Scale
      • Takeaways: DDD Structure, FTF has flaws and why, Organize styles in DDD structured fashion as well.
    • Folder Structure
      • Takeaways: DD-ish Structure, Tests under domain structure easier to manage.
    • Better File Structure
      • Takeaways: DDD Structure, Tests same folder using -spec, tests test whole component.
    • Organizing Redux
      • Takeaways: DD-ish Structure, avoid coupling state to component, avoid circular deps.

Code Structure

  • Components
    • Container Components - Written for React, can be applied to all frameworks.
      • Takeaways: Separate concerns, presentation (rendering) vs computation (fetching & validation & processing)
    • Children Components
      • Takeaways: Pass children to component, separation of parent and child, easier testing.

FAQ

Further Reading

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment