- Live Link
- Postman Collections - Postman collections are also available in JSON format in this repo
- Technical Article
- Demo Link
- LinkedIn Post
Go to your favourite browser and visit The Spawner
- Enter your app name, email, slug(this should be unique), and password
- Click on add a new model
- Enter the model name(lowercase preferably) and select if you want JWT and Passport Auth in your app. If isAuth is set to True, then you must provide an attribute with the name password
- Click on Add Attribute to give your model some attribute(or property)
- Enter the attribute name, type, required status and Attribute Ref(if you want to connect this attribute to a model)
- If type is ObjectId, then Attribute Ref must be provided
- If type is Array, then it is considered to be an array of ObjectIds (if ref is given), otherwise as an array of Strings
- Enter as many attributes and models as you like
- Click on Save to generate your backend application
- Please wait for a couple of seconds for Download button to appear on the top right
- Now you can download your zipped app and enjoy the full fledged backend application
Go to your favourite terminal and run the following commands
git clone https://github.com/duttrohan0302/spawner cd spawner // To install the dependencies npm install && npm run client-install
MONGOURI=<Your MongoDB URI>
npm run dev
Now you can go to http://localhost:3000 to create your backend application. Follow the same instruction as using the app online
Apart from downloading the app using the download button, locally you can also get your backend app in the apps directory in the root folder. You can also get the zipped backend app in the client/public/zips directory. Just look for your slug.
You must send an object in the POST request having the following properties
Terminology and conditions for
JSON object-
- schema is an array containing the details of your models,each object is one unique model
- attributes is an array of all the attributes in this model, if
isAuthistrue, password must be there as one of the attributes- If type for an attribute is
ObjectId,refmust be given- If type is
Arrayandrefis not given, attribute will be anarrayofStrings, and ifrefis given, then anarrayofObjectId
{
"name":<name of your app>,
"email": <your email>,
"slug": <app-slug(no spaces)>,
"password": <your password>,
"schema":[{
"name":<model-name>,
"isAuth": true if you have passwords in this model, provides JWT Auth and bycrptJS encryption),
"attributes":[
{
"name":<attribute-name>,
"required":<is attribute compulsory or not>,
"type":<One out of 'String','Number','Date','Buffer','Boolean','Mixed','ObjectId','Array'>,
"ref":<If this particular attribute is linked to some model, give that model's name>
}
]
}]
}
Fire up the postman app and send a POST request to the url with the following JSON Object as the body(raw)
Url can be https://the-spawner.herokuapp.com/app (if you want to use the online api) or http://localhost/app (if you want to use your local api, make sure you have cloned the project and it is running correctly)
E.g. of JSON object
{
"name": "appName",
"email": "appEmail@gmail.com",
"slug": "appslug",
"password": "123456",
"schema": [
{
"name": "user",
"isAuth": true,
"attributes": [
{
"name": "email",
"type": "String",
"required": true
},
{
"name": "password",
"type": "String",
"required": true
}
]
},
{
"name": "state",
"attributes": [
{
"name": "name",
"type": "String",
"required": true
}
]
},
{
"name": "district",
"attributes": [
{
"name": "name",
"type": "String",
"required": true
},
{
"name": "state_id",
"type": "ObjectId",
"required": false,
"ref": "state"
}
]
}
]
}
Once you get a successful response, if you used the online api, go to https://the-spawner.herokuapp.com/zips/your-app-slug.zip to download the zipped backend folder.
If you used the local end point, go to the root project folder and get your folder from
/apps/or the zipped file from/client/public/zips/. Look for a folder/zipped file with your slug name.
Feel free to drop in pull requests for any improvements that you see fit, I would love to make this better and collaborate with you all.
Rohan Dutt