Custom generate

In this guide, we’ll walk you through customizing your fastree.config.json file to match your project needs. 🚀

🛠 Why Customize?

Customizing fastree.config.json allows you to:

  • Define custom folder structures
  • Add specific file templates
  • Include nested files & folders
  • Automate feature-based generation

📌 Basic Structure

Here's the default format of fastree.config.json:

{
  "structure": [
    {
      "path": "src/components",
      "folders": [
        {
          "name": "<feature-name>",
          "files": [],
          "folders": []
        }
      ],
      "files": [
        {
          "name": "<feature-name>-component.tsx",
          "template": "ReactComponent"
        }
      ]
    }
  ]
}

🎯 Customizing Folders & Files

🏗 Adding More Folders

Want to generate additional folders inside a feature? Modify the folders section:

{
  "path": "src/modules",
  "folders": [
    {
      "name": "<feature-name>",
      "folders": [
        { "name": "components", "files": [] },
        { "name": "hooks", "files": [] },
        { "name": "utils", "files": [] }
      ],
      "files": []
    }
  ]
}

📌 Now, when you run npx fastree generate Auth, it will create:

src/modules/Auth/
├── components/
├── hooks/
├── utils/

📂 Adding Files Inside Nested Folders

You can add files inside nested folders as well:

{
  "path": "src/features",
  "folders": [
    {
      "name": "<feature-name>",
      "folders": [
        {
          "name": "components",
          "files": [
            {
              "name": "<feature-name>-button.tsx",
              "template": "ReactComponent"
            }
          ]
        }
      ],
      "files": []
    }
  ]
}

Running npx fastree generate dashboard will create:


src/features/dashboard/
├── components/
│ ├── dashboard-button.tsx

🚀 Running Your Custom Setup Once you've customized your config, use the following command to generate structures:

npx fastree generate <feature-name>

This will create a feature-structure with all your specified folders and files.

Now you're all set to customize your project structures effortlessly! 🎉 Happy coding! 🚀