├── .gitignore ├── .husky └── pre-commit ├── .npmignore ├── .nvmrc ├── .prettierrc ├── LICENSE ├── README.md ├── bin └── create-mf-app.ts ├── eslint.config.mjs ├── package.json ├── src ├── __tests__ │ └── index.test.ts └── index.ts ├── templates ├── application-extras │ └── tailwind │ │ ├── postcss.config.mjs │ │ └── src │ │ └── index.css ├── application │ ├── lit-html │ │ ├── .babelrc │ │ ├── gitignore │ │ ├── index.html │ │ ├── module-federation.config.ts │ │ ├── package.json │ │ ├── rspack.config.ts.ejs │ │ ├── src │ │ │ ├── App.ts │ │ │ ├── index.css │ │ │ └── index.ts │ │ └── tsconfig.json │ ├── preact │ │ ├── .babelrc │ │ ├── gitignore │ │ ├── index.html │ │ ├── module-federation.config.ts │ │ ├── package.json │ │ ├── rspack.config.ts.ejs │ │ ├── src │ │ │ ├── App.tsx │ │ │ ├── index.css │ │ │ └── index.ts │ │ └── tsconfig.json │ ├── react-18 │ │ ├── .babelrc │ │ ├── gitignore │ │ ├── index.html │ │ ├── module-federation.config.ts │ │ ├── package.json │ │ ├── rspack.config.ts.ejs │ │ ├── src │ │ │ ├── App.tsx │ │ │ ├── index.css │ │ │ └── index.ts │ │ └── tsconfig.json │ ├── react-19 │ │ ├── .babelrc │ │ ├── gitignore │ │ ├── index.html │ │ ├── module-federation.config.ts │ │ ├── package.json │ │ ├── rspack.config.ts.ejs │ │ ├── src │ │ │ ├── App.tsx │ │ │ ├── index.css │ │ │ └── index.ts │ │ └── tsconfig.json │ ├── solid-js │ │ ├── .babelrc │ │ ├── gitignore │ │ ├── index.html │ │ ├── module-federation.config.ts │ │ ├── package.json │ │ ├── rspack.config.ts.ejs │ │ ├── src │ │ │ ├── App.tsx │ │ │ ├── index.css │ │ │ └── index.ts │ │ └── tsconfig.json │ ├── svelte │ │ ├── .babelrc │ │ ├── gitignore │ │ ├── index.html │ │ ├── module-federation.config.ts │ │ ├── package.json │ │ ├── rspack.config.ts.ejs │ │ ├── src │ │ │ ├── App.svelte │ │ │ ├── bootloader.ts │ │ │ ├── index.css │ │ │ └── index.ts │ │ └── tsconfig.json │ ├── vanilla │ │ ├── .babelrc │ │ ├── gitignore │ │ ├── index.html │ │ ├── module-federation.config.ts │ │ ├── package.json │ │ ├── rspack.config.ts.ejs │ │ ├── src │ │ │ ├── index.css │ │ │ └── index.ts │ │ └── tsconfig.json │ └── vue3 │ │ ├── .babelrc │ │ ├── gitignore │ │ ├── index.html │ │ ├── module-federation.config.ts │ │ ├── package.json │ │ ├── rspack.config.ts.ejs │ │ ├── src │ │ ├── App.vue │ │ ├── bootloader.ts │ │ ├── index.css │ │ ├── index.ts │ │ └── vue-shim.d.ts │ │ └── tsconfig.json ├── library │ └── typescript │ │ ├── gitignore │ │ ├── package.json │ │ ├── src │ │ └── index.ts │ │ ├── tsconfig.json │ │ └── yarn.lock └── server │ ├── express │ ├── gitignore │ ├── index.ts │ ├── package.json │ └── yarn.lock │ ├── graphql-apollo │ ├── gitignore │ ├── package.json │ ├── src │ │ └── index.ts │ └── tsconfig.json │ ├── graphql-nexus │ ├── gitignore │ ├── package.json │ ├── src │ │ └── index.ts │ ├── tsconfig.json │ └── yarn.lock │ ├── graphql-subscriptions │ ├── gitignore │ ├── package.json │ ├── src │ │ └── index.ts │ ├── tsconfig.json │ └── yarn.lock │ ├── nestjs-auth │ ├── .DS_Store │ ├── .eslintrc.js │ ├── .prettierrc │ ├── README.md │ ├── gitignore │ ├── nest-cli.json │ ├── package.json │ ├── public │ │ ├── .DS_Store │ │ └── placeholder.txt │ ├── src │ │ ├── app.controller.ts │ │ ├── app.module.ts │ │ ├── auth │ │ │ ├── auth.module.ts │ │ │ ├── auth.service.ts │ │ │ ├── constants.ts │ │ │ ├── jwt-auth.guard.ts │ │ │ ├── jwt.strategy.ts │ │ │ ├── local-auth.guard.ts │ │ │ └── local.strategy.ts │ │ ├── config.ts │ │ ├── main.ts │ │ ├── modules │ │ │ ├── authorized │ │ │ │ ├── authorized.controller.ts │ │ │ │ └── authorized.module.ts │ │ │ └── unauthorized │ │ │ │ ├── unauthorized.controller.ts │ │ │ │ └── unauthorized.module.ts │ │ └── users │ │ │ ├── users.module.ts │ │ │ └── users.service.ts │ ├── test │ │ ├── app.e2e-spec.ts │ │ └── jest-e2e.json │ ├── tsconfig.build.json │ ├── tsconfig.json │ └── yarn.lock │ └── nestjs-todo │ ├── .eslintrc.js │ ├── .prettierrc │ ├── gitignore │ ├── nest-cli.json │ ├── package.json │ ├── src │ ├── app.module.ts │ ├── main.ts │ └── modules │ │ └── todos │ │ ├── todo.controller.ts │ │ └── todo.module.ts │ ├── test │ ├── app.e2e-spec.ts │ └── jest-e2e.json │ ├── tsconfig.build.json │ └── tsconfig.json └── tsconfig.json /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | bin/create-mf-app.js 3 | src/index.js 4 | src/types.js 5 | pnpm-lock.yaml 6 | .DS_Store 7 | -------------------------------------------------------------------------------- /.husky/pre-commit: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . "$(dirname "$0")/_/husky.sh" 3 | 4 | pnpm lint 5 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | # https://docs.npmjs.com/misc/developers#keeping-files-out-of-your-package 2 | 3 | #node 4 | yarn.lock 5 | 6 | #misc 7 | .husky 8 | assets 9 | 10 | #tests 11 | test 12 | coverage 13 | 14 | #linters 15 | .eslintrc* 16 | .eslintignore 17 | 18 | #editor settings 19 | .vscode 20 | .idea 21 | .editorconfig -------------------------------------------------------------------------------- /.nvmrc: -------------------------------------------------------------------------------- 1 | v18.16.0 -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "singleQuote": false, 3 | "trailingComma": "es5", 4 | "semi": true 5 | } 6 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Jack Herrington 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # create-mf-app 2 | 3 | [![npm version](https://badge.fury.io/js/create-mf-app.svg)](https://badge.fury.io/js/create-mf-app) [![npm version](https://img.shields.io/npm/dm/create-mf-app.svg)](https://badge.fury.io/js/create-mf-app) 4 | 5 | Creates a Module Federation application, API server, or library based on one of multiple different templates. 6 | 7 | ## Usage 8 | 9 | ```shell 10 | npx create-mf-app 11 | ``` 12 | 13 | These projects are not production complete. They are designed as lightweight projects that can be used to quickly prototype a new feature or library. 14 | 15 | ## CLI Usage 16 | 17 | Without any arguments, the CLI will prompt you for the information required to create the project. 18 | 19 | ```shell 20 | npx create-mf-app@latest 21 | ``` 22 | 23 | You can also get help for the CLI for the options available. 24 | 25 | ```shell 26 | npx create-mf-app@latest --help 27 | ``` 28 | 29 | You can create an application using CLI options: 30 | 31 | ```shell 32 | npx create-mf-app@latest --name my-remote --port 8080 --css Tailwind --template react-19 33 | ``` 34 | 35 | Shorthand versions of each option are also available: 36 | 37 | ```shell 38 | npx create-mf-app@latest -n my-remote -p 8080 -c Tailwind -t react-19 39 | ``` 40 | 41 | ## Programmatic Usage 42 | 43 | ```js 44 | const { buildProject } = require("create-mf-app"); 45 | 46 | buildProject({ 47 | type: "Application", 48 | name: "my-remote", 49 | port: "8080", 50 | framework: "react-19", 51 | css: "Tailwind", 52 | }); 53 | ``` 54 | -------------------------------------------------------------------------------- /bin/create-mf-app.ts: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | import { 3 | intro, 4 | outro, 5 | text, 6 | isCancel, 7 | cancel, 8 | select, 9 | spinner, 10 | } from "@clack/prompts"; 11 | import fs from "node:fs"; 12 | import path from "node:path"; 13 | import { program } from "commander"; 14 | 15 | import { buildProject, Project } from "../src"; 16 | 17 | const applicationTemplates = fs 18 | .readdirSync(path.join(__dirname, "../templates/application")) 19 | .sort(); 20 | 21 | const serverTemplates = fs 22 | .readdirSync(path.join(__dirname, "../templates/server")) 23 | .sort(); 24 | 25 | const templates = [ 26 | ...applicationTemplates.map((t) => ({ 27 | framework: t, 28 | type: "Application", 29 | })), 30 | ...serverTemplates.map((t) => ({ 31 | framework: t, 32 | type: "Server", 33 | })), 34 | { 35 | framework: "library", 36 | type: "Library", 37 | }, 38 | ]; 39 | 40 | program 41 | .option("-n, --name ", "The name of the project") 42 | .option( 43 | "-t, --template