Skip to content

Instantly share code, notes, and snippets.

@dexteryy
Last active September 29, 2022 21:26
Show Gist options
  • Save dexteryy/1618d2398e0b24ee250535b7bc358342 to your computer and use it in GitHub Desktop.
Save dexteryy/1618d2398e0b24ee250535b7bc358342 to your computer and use it in GitHub Desktop.
A monorepo structure for large-scale Universal JS projects

The evolutionary path is: monolithic backend-web-framework-based repo -> multi repos with shared infra -> monorepo contains shared infra

The tool support is becoming matured (Yarn Workspace, VSCode's Multi Root Workspaces)

[monorepo]/
 ├── universal-js-app project for product A/
 │    ├── node_modules/
 │    ├── common/
 │    │    ├── components/
 │    │    ├── utils/
 │    │    └── ... (other role folders)
 │    ├── entry point A/
 │    │    ├── common/
 │    │    │    ├── components/
 │    │    │    ├── utils/
 │    │    │    └── ... (other role folders)
 │    │    ├── feature set A/
 │    │    │    ├── components/
 │    │    │    ├── utils/
 │    │    │    └── ... (other role folders)
 │    │    ├── feature set B/
 │    │    │    ├── components/
 │    │    │    ├── utils/
 │    │    │    └── ... (other role folders)
 │    │    └── ... (other feature set folders)
 │    ├── entry point B/
 │    ├── ... (other entry point folders)
 │    ├── Dockerfile
 │    ├── .eslintrc
 │    └── package.json
 ├── API gateway project for product A/
 │    ├── node_modules/
 │    ├── common/
 │    ├── restful/
 │    │    ├── API A/
 │    │    └── ... (other API folders)
 │    ├── Dockerfile
 │    ├── .eslintrc
 │    └── package.json
 ├── universal-js-app project for product B/
 │    ├── node_modules/
 │    ├── common/
 │    ├── entry point X/
 │    │    ├── common/
 │    │    ├── feature set X/
 │    │    ├── feature set Y/
 │    │    └── ... (other feature set folders)
 │    ├── ... (other entry point folders)
 │    ├── Dockerfile
 │    ├── .eslintrc
 │    └── package.json
 ├── API gateway project for product B/
 ├── ... (other project folders)
 ├── common/
 │    ├── components/
 │    ├── utils/
 │    ├── constants/
 │    └── ... (other role folders)
 ├── universal-js-app infra (like webcube)/
 │    ├── node_modules/
 │    ├── framework/
 │    │    ├── AppSkeleton.js
 │    │    └── ...
 │    ├── toolchain/
 │    │    ├── webpack.config.js
 │    │    ├── gulpfile.js
 │    │    ├── docker-compose.yml
 │    │    └── ...
 │    ├── scaffold/
 │    └── package.json
 ├── nodejs-microservice infra (like nodecube)/
 │    ├── node_modules/
 │    ├── framework/
 │    │    ├── restfulService.js
 │    │    ├── graphqlService.js
 │    │    ├── logger.js
 │    │    ├── error.js
 │    │    └── ...
 │    ├── toolchain/
 │    ├── scaffold/
 │    └── package.json
 ├── ... 
 ├── node_modules/ 
 │    ├── universal-js-app infra/  (symlink) -> ../universal-js-app infra/
 │    ├── nodejs-microservice infra/  (symlink) -> ../nodejs-microservice infra/
 │    ├── common/  (symlink) -> ../common
 │    ├── react/
 │    ├── babel-core/
 │    └── ... (other shared dependencies)
 └── package.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment