rsmern
v0.2.4
Published
Simple MERN Stack template generator written completely in Javascript.
Downloads
4
Maintainers
Readme
RSMERN
Simple MERN Stack template generator written completely in Javascript.
Quick Links
Usage
Install the package globally by doing:
npm install -g rsmern
Create a new project by executing:
rsmern init <project-name>
Backend Specific Features
Create a new feature by executing:
cd <project-name>/backend
rsmern create:feature <featurename>
Example: The command
rsmern create:feature category
will create a CategoryModel insrc/models
, a CategoryController insrc/controllers
and a CategoryRouter insrc/routers
. Note that, it doesn't actually add it to the API Router, you'll have to do that manually by editing thesrc/routes.ts
file.
// In: src/routes.ts
...
import CategoryRouter from "./routers/category_router";
...
...
export function ApiRouter() {
const router = Router();
// Add your router here like this..
router.use("/category", CategoryRouter());
...
return router;
}
...
...
NOTE: The
create:feature
command is only meant for the backend. Make sure to change the current directory to backend before proceeding.
Other Commands
npm run watch => Launches the tsc compiler in watch mode
npm run dev => Launches the development server using Nodemon
It is recommended to open two terminal windows. One for
npm run watch
and another one fornpm run dev
for the best dev experience.
Frontend Specific Features
The frontend is generated using Vite and has TailwindCSS already set up.
You can start by editing src/screens/index.jsx
.
NOTE: Running
npm run build
in the frontend directory will automatically build the static files and place them insidebackend/public
for serving.