kushkapadia / kushkapadia/servitect

Config-Based Generation of Models, Routes, and Controllers

Open
#8 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
46
Forks
4
PR merge metrics
No merged PRs in 30d

Description

**Objective**: Automate the generation of Mongoose models, API routes, and controllers based on a configuration object for faster backend development.

#### Description:
We need to develop a code generator that dynamically generates Mongoose models, API routes, and controllers using a predefined configuration file. This will save development time by reducing repetitive coding tasks. The servitect should be able to recreate entire codebase given the config file.

**Deliverables**:
- A fully functional generator script that, when executed, generates:
- Mongoose models in `models/`.
- Controllers in `controllers/`.
- API routes linked to the respective controllers.
- Authentication middleware in `middlewares/auth.js`.
- `.env` file with environment variables.

**Example Config Structure**:
```js
{
models: {
User: {
attributes: {
userId: { type: "ObjectId", primaryKey: true },
/* other attributes of the model */
},
routes: {
create: { method: "POST", url: "/api/users" },
/* other routes that are required for the model */
},
admin: true /* expose to admin panel */
/* other parameters like auth */

},
/* other models here */
},
config: {
env: {
MONGO_URI: "...",
/* Environment variables */
}
}
}
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the configuration example in the issue, then locate the repository's existing generator entry point; no entry point or tests are named. Done means one configuration can generate models in models/, controllers, linked API routes, middlewares/auth.js, and a .env file, while supporting the listed model and route settings.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, mongodb, nodejs
Domain
api, backend, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.