Page cover image

Building a Restaurant Management System with Neurelo and MongoDB using GraphQL in just a few minutes

Author: Parth Parikh (

“I suppose I ought to eat or drink something or other; but the great question is ‘What?’” - Lewis Carroll, Alice's Adventures in Wonderland


In this tutorial, we will see how Neurelo can help you get started with your application building from zero to one, with MongoDB as the database, in a few minutes. Neurelo helps turn your database into APIs, which you can then use to facilitate communication with your application. It makes working with databases way easier and removes many of the complexities developers face when building their applications with databases.

As the title suggests, throughout the tutorial we will be focusing on building a Restaurant Management System.

Creating a Schema

To start with, let us build a new project. To do so, navigate to Neurelo’s dashboard and create a new project. This is the primary "working" entity where everything begins within Neurelo.

Starting a New Project

To create a new project, navigate to and click on the "New" button in the dashboard. A "New Project" modal will open up, where we will fill in our basic project information, including selecting our database engine – we are going to choose MongoDB here.

On clicking “Create”, you should see the quick start dashboard, which provides a step-by-step onboarding process to Neurelo.

Connecting a Data Source

As part of the first step, we will be adding a new MongoDB data source. If you already have an existing MongoDB instance, you can connect it by clicking on the “Connect Data Source” button. If you don’t have a data source at hand, we can ask Neurelo to instantly provision one for us on MongoDB Atlas, by going to the “clicking here” highlight

Once the “New Data Source” modal opens up, you can provision a new instance on MongoDB Atlas for your project by entering a new database password and clicking on the “Submit” button.

It generally takes about a few seconds to a minute for Neurelo to provision one for you. Your Quick Start dashboard will show the following if the database provisioned successfully -

Once provisioned, the next step is to build the schema for your project. For this, click on the “Build Schema” button. This will open up Neurelo’s definition tab, where you will see the “Schema Builder”.

Schema AI Assist

Neurelo’s schema builder provides a UI interface to easily construct your schema manually, or you can code them in JSON or YAML formats, but Neurelo makes it way easier to get started with schemas for your project based on your intent using the intuitive Schema AI Builder. To use it, simply click on the “Load a Sample Schema” button. This will in turn open up a “Schema Templates” modal. Next, click on the “Schema AI Assist” option.

Doing this will open up Neurelo’s “Schema AI Assistant” playground. Next, we can simply enter a simple prompt like “Restaurant Management System” to see it in action!

Et voila! And just like that, we have a good reference schema for you to take inspiration from or just start using directly. On completion you will see the generated schema in the schema builder view.

Neurelo's AI has generated 5 objects (collections) in this schema, in this case - restaurants, menus, reservations, users, and reviews.

Note - The generated schema may be different for you even with the same prompt.

The structure of the generated schema is as follows:

  • restaurants: id, name, cuisine, rating, contact_number, email, Address

    • Address: street, city, state, country, zip_code

  • menus: id, restaurant_id, name, items of MenuItem

    • MenuItem: name, description, price

  • reservation: id, restaurant_id, user_id, reservation_time, number_of_people, special_requests

  • users: id, username, email, password, phone_number

  • reviews: id, restaurant_id, user_id, rating, comment, review_date

Quite extensive! Isn't that neat ? If you would like to make adjustments to this schema, invoke the "AI Assist" button and describe what you would like e.g. add inventory and suppliers, or change rating to average_rating in restaurants, or you can even try and re-generate a different schema for the prompt.


Next, let us Commit this schema. For this, we can leverage Neurelo's "Git Schema" functionality to commit this initial schema. To do so, click on the commit button at the top right and enter your commit message.

Tip: You can click on the "History" button to view all your commits. You can also check out the state of your schema at an older commit by clicking on the particular commit.

ERD View

Now that we have a new schema, let's visualize it. To do so, you can use Neurelo’s ERD functionality, right from the schema view.

If you'd like to see which objects are related to others in the ERD, simply click on the object whose relationships you want to explore and you get a focused view with only those objects -

Creating an environment

Now that we have provisioned a new database and have created a schema, let's explore how we can connect this schema to our empty MongoDB database and use Neurelo to automatically build API endpoints for us.

To do this, we need to create a Neurelo Environment, followed by starting the runners. Think of environments in Neurelo as runtime workspaces that allow you to run your Neurelo APIs using a specific version (commit) of your schema definition against a specific data source (in this case, our "Evaluation DB" one).

Neurelo environments are designed to naturally align with typical Software Development Life Cycles (SDLC) as applications are developed, tested, deployed, and operated. Simply put, they help manage different stages of your project, whether it's development, testing, or production. In our scenario, we will create a testing environment.

To do so, navigate to the "Environments" tab on the left sidebar of your project view and click on the New environment button. Next, fill in the environment details, which include the commit you’d like your environment to run against, and your data source/region preferences. For this tutorial, we will select the latest commit and use the same region (AWS-US East) as our "Evaluation DB" data source. We have also enabled observability, which will allow us to monitor and analyze the environment's API performance.

Upon creating an environment, you’ll be greeted with the following environment view:

API Reference

There is a lot going on here, so let's break it down. The APIs tab is generated and automatically updated in sync with your schema. It shows two things: a comprehensive documentation of your auto-generated API endpoints and an API reference for all the API endpoints that Neurelo has created for your schema. Neurelo auto-generates both REST and GraphQL APIs for your schema.

Here is an example of an API reference created for our restaurants object:

The APIs tab is also a hub where you can test and explore your REST and GraphQL APIs using the API Playground, which we will thoroughly explore shortly. Furthermore, Neurelo also creates both OpenAPI and GraphQL specifications along with a Postman Collection using your schema, which you can download by clicking on the "Specs" tab.

Let us now circle back to our restaurant management system. Now that we have our schema, data source, and environment all set up, let's figure out how we can get some test data into our database so that we can play around with Neurelo's auto generated APIs and eventually build our application around it.

Data Generator

Neurelo provides a simple, one-click solution for this called "Data Generator". You can find this in the top right corner of the environment's view. Upon clicking it, you will be presented with an option to choose the size of your test data. For our purposes, we will select “Small” to get around 10 records.

Click on start and that should be it! You can easily visualize the new data in your database using Neurelo’s "Data Viewer". But before we do that, we need to start the runners.

A runner in Neurelo is the main component that executes and manages all API calls. In Neurelo's Cloud Data Access Platform, a runner is a part of every environment inside a project. Runners need to be started for the application to be able to handle API requests and process them against the configured data source within an environment. The data viewer also requires these runners to be started.

To do so, click on the "Start Runners" button on the top right of your environment’s view.


Next, navigate to the Data Viewer tab. You will be prompted to create a new API key. Make sure to copy and save this key somewhere safely, as we will be using this quite a bit in the following sections.

Data Viewer

Once you have created your API key, you will be able to visualize your data, in the Data Viewer tab:

Notice how the data is quite realistic! This is because Neurelo uses AI to intelligently generate mock data that aligns with your schema and its attribute contexts. In fact, even the relationship identifiers should be correctly mapped between your collections. For example, notice how restaurant_ids for reservations are mapped with restaurant ids, across two different collections in the screenshot below!

This is quite helpful when working on APIs that require relationship querying/filtering.

Using the Auto-Generated APIs

API Playground

With our mock data in place, it is finally time to experiment with Neurelo's API endpoints. Navigate back to the APIs tab and click on the API playground icon, which should open Neurelo's API playground.

Neurelo supports APIs in both REST and GraphQL formats. We will be focusing on GraphQL APIs for this tutorial. However before we do that, let us also give the REST APIs a quick spin up by trying the "Find many restaurants" API. For this, simply go to the "Headers" tab in the API playground, and input the API key from before. When done, click on Send, and we should see all the restaurant records in our database.

To fetch only the first record, you can add a value of 1 to the "take" parameter in the "Parameters" tab. You can do much more complicated querying with these APIs. The REST APIs are quite extensive, and to further see them in action, we encourage you to check out our tutorial on “Building a Real Time Chat Application with Neurelo and MongoDB”.

GraphQL APIs

Let us now explore the GraphQL APIs. To switch the API playground’s view from REST to GraphQL, simply turn on the GraphQL toggle on the top right corner.

Let us now perform the same "Find many restaurants" API call but with GraphQL. This can be structured as follows:

To order the results in ascending order by id, simply change the findManyrestaurants to findManyrestaurants(orderBy: {id: asc}). Similarly, we can work with skip, take, cursor, where, and distinct parameters. For example, say we want to sort the restaurants by their ids in descending order, and we would like to filter the results such that only contact numbers starting with “3” are fetched. This can be done with the following query:

Similarly, a create operation to “create one user” can be performed as follows:

You can even use Neurelo's APIs to perform complex create, update, and delete queries. A thorough documentation on this is provided in our “Neurelo API Reference (GraphQL)" guide.

Language-Specific Code Examples

Another feature of API playground is its ability to automatically generate language-specific example code. Presently, the playground supports TypeScript/JavaScript (TS/JS), Python, and Go code snippets. It also generates cURL commands. To find these example codes/commands, navigate to the “Code” tab on the top right of the API playground.

Here is an example of an auto generated cURL command:

Here’s yet another example, this time with TypeScript/JavaScript:

Similar with Python:

Postman Collections

If you prefer using Postman, you can also download Neurelo’s prebuilt Postman collections and import it to your Postman client as follows. To get the Postman collection, you can download the collection from the "APIs" section in your environment.

Note: The downloaded spec varies depending on whether you are in the REST or GraphQL section. To download a Postman collection for GraphQL, ensure you switch to the GraphQL tab in the API documentation before downloading.

To import the downloaded collection into your Postman app, start by clicking the 'Import' button within Postman.

Then, import the JSON-based Postman collection file you downloaded from Neurelo.

Completing these steps will generate a new Postman collection corresponding to your schema.

Neurelo structures each collection by creating individual folders for each object in your schema, organizing these folders according to the auto-generated API endpoints. Each object is equipped with auto-generated POST HTTP methods to find, aggregate, and group objects; to create one or multiple objects; and to delete/update one or more objects.

Once the Postman collection has been imported into Postman, you need to configure the {{baseUrl}} and set the X-API-KEY to be used in the header for the API calls.

  • You can get the {{baseUrl}} for your environment by navigating to the Environments section in your project

You can set these globally (and then they will be used for all the API calls). To set them globally, click on the Collection Name in your Workspace and it will show you tabs including "Authorization" and "Variables".

  1. Click on the "Authorization" tab and enter the X-API-KEY for your environment in the "Value" field. Once you input the API Key, the value should look something like this

  2. Click on the "Variables" tab and enter the URL for your environment under "Current Value" Once you enter the URL, it should look something like this

Important - Remember to click "Save" at the top right to make sure your changes will be used

Finally, to execute an API request, simply populate the graphql body as needed. For guidance on building APIs, refer to the API reference materials for GraphQL.

For instance, to “update one restaurant”,

And that’s it! This should provide you the fundamentals to build your restaurant system application or something similar with Neurelo. For more information, be sure to checkout the rest of our Neurelo documentation.


If you prefer a more visual learning experience, check out the video for this tutorial

Last updated