MongoDB Atlas - Migrate GraphQL to Neurelo
Last updated
Last updated
Neurelo is a platform designed to simplify the process of working with databases for developers. It offers features such as building and managing schemas with Text-to-Schema support, GraphQL APIs (with SDKs) auto-generated from your schema with documentation and a playground, custom GraphQL API endpoints for complex queries with MQL support, multiple CI/CD environments, schema-aware mock data generation, and more.
This is a guide to help MongoDB Atlas users get started with Neurelo and Neurelo's GraphQL APIs.
For a complete reference on Neurelo's auto-generated GraphQL APIs, check out our Neurelo API Reference (GraphQL) documentation.
If you prefer a more visual experience, please check out the video version of this guide.
Navigate to https://dashboard.neurelo.com/ to access the Neurelo dashboard. Once there, you'll find the option to sign in to your existing account if you already have one, or if you don't have an account, you can create a new Neurelo account using the "New to Neurelo? Create an Account" option on the page. A step-by-step guide on how to create an account can be found in Neurelo’s documentation.
Projects are applications that developers build and run with Neurelo. This is the primary “working” entity where all things start inside Neurelo. A project exists inside an Organization and has its own set of entities such as data definitions, environments, dashboards, data sources, etc.
After signing in to your Neurelo account, you will be directed to your Neurelo Dashboard. This is your central hub for managing your projects.
If you have a new account, you will see the option to create a new project as one of the first things you need to do to get stated. If you already have another project in your account, look for an orange button on the top-right of the Dashboard with a + icon and the word "New" inside it. This button is designed for creating new projects.
Clicking on it will open the “New Project” modal. Enter the project information and click “Create”.
Once done, you will be presented with Neurelo’s quick start guide, which provides a simple step-by-step onboarding process to Neurelo.
As we are migrating an existing MongoDB Atlas App Services app, we will use the “Connect a Data Source” option. On clicking the “Connect Data Source” button in there, a “New Data Source” modal opens up.
To find the “Connection String”, we need to collect MongoDB connection details from the Atlas UI. To do this, start by logging in to Atlas.
Next, go to the Overview page for your project. If your desired project is not active in the UI, choose the appropriate project from the Projects menu in the top-left navigation panel. Select "Databases" from the options in the left navigation panel.
On the "Database Deployments" page, locate the database deployment (cluster) you wish to connect to, then click on the "Connect" button associated with that deployment.
Now, from the Connect page, select "Compass". Copy the connection string from the Compass view as shown:
The connection string is needed in the following format -
mongodb+srv://<username>:<password>@<cluster-num>.<cluster-name>.mongodb.net/<database-name>
You must replace the username, password, cluster-num, cluster-name and add the database-name in the above string
Once done, copy the connection string over to the “New Data Source” modal. If your password has special characters, you can open up "Advanced Settings" and input the password there. Neurelo will encode the password and update the connection string it will use.
Please select the Neurelo Gateway that is nearest to your MongoDB Atlas instance.
You may need to allow Neurelo IPs to connect to your Atlas instance. In which case, please select "Yes" for the "Is your database behind a firewall or a security group?" option and then copy the IPs displayed for your project. Once you have the IPs, please go into MongoDB Atlas’ Network permissions and add them there to allow Neurelo to connect to your instance.
Make sure to test your connection details with Neurelo’s "Test Connection" button. If all’s good, click on Submit to connect this data source with Neurelo. This will create a new data source for your project. You can always come back to the Data Sources view to verify database details including the health check history.
Once the data source is added, Neurelo will introspect your schema in the database. To visualize the introspected schema, go back to the quick start guide (navigate back to the Quick Start guide by clicking on "Dashboard" in the left sidebar of your project view) and in the “Build Definitions” section click on your schema name.
This should open up Neurelo’s Visual Schema Builder view, where you can visualize and iterate on the introspected schema. You can refer to this further by reading our documentation on Neurelo Schema Editor.
Now, let us create a Neurelo environment, followed by starting the runners. Think of environments in Neurelo as runtime workspaces that allow you to run your Neurelo GraphQL APIs using a specific version (commit) of your schema definition against a specific data source (in this case, our "Atlas" 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 back to the Quick Start guide by clicking on "Dashboard" in the left sidebar of your project view and click on the "Create Environment" button. Next, fill in the environment details, which include the commit you’d like your environment to run against, and your gateway preferences. For now, we will select the introspected commit and use the gateway we used when adding our Atlas data source in the earlier step. We have also enabled observability, which will allow us to monitor and analyze the environment's GraphQL API performance.
Upon creating an environment, you will see an environment view similar to the following:
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 supports both REST and GraphQL APIs for your schema. To switch to the GraphQL mode of the APIs tab, click on the GraphQL option on the top.
Here is an example of an API reference created for a sample Posts object:
Furthermore, Neurelo also creates a GraphQL specification using your schema, which you can download by clicking on the "Specs" option.
The APIs tab is also a hub where you can test and explore the provisioned GraphQL APIs using the “API playground”. However, before we explore it further, it is important to start the environment runners and create an API key.
A runner (API server) in Neurelo is the main component that executes and manages all API calls. In Neurelo's Cloud Data API 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 GraphQL API requests and process them against the configured data source within an environment.
To do so, click on the "Start Runners" button on the top right of your environment’s view.
Next, to create an authentication token to use with the APIs, navigate to the “API keys” 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.
Neurelo also supports fine-grained access control mechanisms. To learn more about it, refer to our documentation on Access Policies.
Well done! Your GraphQL APIs are now ready to be used.
It's time now to experiment with Neurelo's API endpoints. Navigate back to the “APIs” tab and click on the “API playground” button, which should open Neurelo's API playground. Once open, click on the "GraphQL” view on the top-right side of the playground to toggle into the GraphQL mode.
To learn more about how to build and test your provisioned GraphQL APIs, check out our comprehensive Neurelo API Reference docs for GraphQL.
Once you have built and tested your GraphQL API, you can then use Neurelo’s “Code Examples” located in the playground itself to easily integrate the API over to the language of your choice.
If you would like to define a rather complex query for some operations on your database, you can leverage Neurelo’s “Custom Queries” feature. These essentially allow you to create Custom GraphQL API endpoints. You can learn more about them in our guide on Writing and Committing Custom Queries.
Neurelo also provides a range of SDKs designed to work seamlessly with the APIs generated from your schema. Currently, we offer SDKs for Python, Typescript/Javascript, and Golang. To learn more about their integrations check out our step-by-step installation guide and our tutorial on its usage.
To learn more about how you can get up and running with Neurelo’s GraphQL APIs, check out our sample tutorial on Building a Restaurant Management System with Neurelo and MongoDB using GraphQL in just a few minutes.
Neurelo lets you build your applications (working with a MongoDB Atlas database) very quickly and easily, all the way from building and extending a schema for your intent, mock data generation, multiple environments with observability, and instant GraphQL APIs with an API Server ready for consumption.
Feel free to try other examples, and check out the many other features of Neurelo which makes it way easier to build your applications with databases.
Once you have confirmed that your GraphQL API endpoints are fully migrated and operational with Neurelo, you may proceed to delete your MongoDB Atlas App Services app to prevent incurring unnecessary costs. Please remember that Atlas GraphQL endpoints will no longer be supported starting March 12, 2025.
If you need help onboarding with Neurelo, or have questions about Neurelo's GraphQL APIs or any other capabilities, please send an email to support@neurelo.com or join Neurelo's Discord server using this invite link.