Buildly is designed to
eliminate development friction by automating the setup of clean,
architecture-focused folder structures. It supports React (for
components), Next.js (for pages/modules), and Express.js (for API
endpoints), pre-populating essential files with starter code.
Key Features
**Multi-Framework Support:** Specialized scaffolding for React,
Next.js, and Express.js.
**Standardized Architecture:** Automatically includes extended
folders like `hooks`, `forms`, `constants`, and `interface` to
enforce best practices.
**Configurable Extensions:** Supports generation with `.js`, `.jsx`,
`.ts`, and `.tsx` file extensions.
**Boilerplate Content:** Files are pre-populated with ready-to-use,
minimal code to ensure immediate usability.
2. Installation & Core Command
2.1 Installation
Install **Buildly** globally via npm to make the command available in
any directory on your system:
npm install -g buildly
Alternatively, you can run it directly using `npx` without a global
installation:
npx buildly g <name> --[framework option]
2.2 The Generate Command (`g`)
The primary command is `g` (generate), which takes the module name
(the folder name) and a framework flag.
Command Syntax
buildly g <ModuleName> <Options>
Available Options
Option
Description
Generates Structure For
--react
Generates a modular folder structure for a standard React
component or module.
React (Components)
--next
Generates a folder structure suitable for a Next.js App Router
Page.
Next.js (Pages)
--express
Generates a dedicated folder for Express.js API logic (Routes,
Controllers, Schemas).
Express.js (API)
--no-extend
Skips the creation of extended subfolders (`components`,
`forms`, `hooks`, etc.), resulting in a minimalist structure.
All Frameworks
3. Framework Guides and Boilerplate
3.1 React Scaffolding
Example Command (Using `Home` as module name):
buildly g Home --react
Generated Structure:
Home/ ├─ index.jsx
(Main Functional Component) ├─
components/ │ └─ index.jsx
(Placeholder for nested components)
├─ forms/ │ └─ form.jsx
(Custom hook/stateful form component)
├─ constants/ │ └─ index.js
(For module-specific constants)
├─ hooks/ │ └─ index.js
(For module-specific custom hooks)
└─ interface/ └─ index.js
(For TypeScript interfaces/types - often used even in JS projects
for reference)
File Boilerplate Examples:
Home/index.jsx (Main Component)
View Boilerplate
import React from "react";
export default function Home() {
return <div>Home component loaded</div>;
}
import { useState, useEffect } from "react";
export function useHome() {
const [state, setState] = useState(null);
useEffect(() => {
setState("Hello from hook");
}, []);
return { state, setState };
}
3.2 Next.js Scaffolding
Example Command (Using `Dashboard` as module name):
buildly g Dashboard --next
Generated Structure:
Dashboard/ ├─ page.jsx
(App Router Page Component) ├─
components/ │ └─ index.jsx
(Internal components for the page)
├─ forms/ │ └─ form.jsx
(Page-specific forms - note: uses 'form.jsx' instead of
'index.jsx' for forms/forms)
├─ constants/ │ └─ index.js ├─ hooks/ │ └─ index.js └─ interface/ └─
index.js
File Boilerplate Examples:
Dashboard/page.jsx (Main Page)
View Boilerplate
import React from "react";
export default function Dashboard() {
return <div>Dashboard component loaded</div>;
}
Note: The boilerplate for `forms/form.jsx`, `hooks/index.js`,
`constants/index.js`, and `interface/index.js` in Next.js
scaffolding is identical to the React scaffolding.
3.3 Express.js Scaffolding
Example Command (Using `User` as module name):
buildly g User --express
Generated Structure:
User/ ├─ index.js
(Main export/entry point for the resource)
├─ router/ │ └─ user.router.js
(Defines API routes and links to controller methods)
├─ controller/ │ └─ user.controller.js
(Contains all the business logic)
└─ schema/ └─ user.schema.js
(Mongoose/Joi schema for data validation or modeling)