Integrate with Vercel
The Atlas App Services Data API is deprecated. It will reach end-of-life and be removed on September 30, 2025. Refer to the deprecation page in the App Services documentation for details.
You can connect your Atlas clusters to applications that you deploy using Vercel.
Use this page to complete the following tasks:
Connect Vercel users and teams to organizations in Atlas.
Create links from Vercel projects for these users and teams to Atlas clusters.
Enable the Atlas Data API.
To connect the serverless functions that you deployed in Vercel to Atlas clusters, you can also use the MongoDB Node.js driver or the Mongoose ODM library.
Considerations
Accounts in Vercel (Personal or Team)
The integration with Vercel requires that you:
Create a new personal account or create a new team in Vercel.
Use an existing personal or team account in Vercel.
Note
You can add a Vercel integration as a personal account user and then add another Vercel integration as a team user. You can't change the scope of an existing integration from a personal account to a team level account in Vercel.
To switch from a MongoDB integration for a personal Vercel account to an integration with a team scope in the same Atlas organization, disconnect an existing integration in Atlas, and add a new integration with a team scope.
Projects in Vercel
You can link one Atlas cluster to more than one project in Vercel.
To configure the integration, you must have one or more projects in your personal or team Vercel account.
The list of Vercel projects that you can choose for the integration depends on the user or team scope.
IP Access Lists in Atlas and IP Allow Lists in Vercel
Vercel deployments use dynamic IP addresses.
To connect to an Atlas cluster, the IP access list of your Atlas cluster must allow all IP addresses (0.0.0.0/0). If Atlas doesn't find an entry for 0.0.0.0/0 in your Atlas project's IP access list, Atlas adds it on your behalf, as part of the integration workflow.
When you set up the integration, Atlas performs these actions to secure your Vercel connections to the cluster:
Creates a
MONGODB_URI
environment variable that serves as the Atlas cluster's connection string for all Vercel projects that you link this cluster to.When your application doesn't specify a database, the
MONGODB_URI
variable uses/myFirstDatabase
as the default database name. Replace this name with your database name, or if you use a library to interface with MongoDB, ensure that your application's code specifies your database name.Creates a database user,
vercel-admin-user
, in the admin database and grants the built-in readWriteAnyDatabase MongoDB database role to all other non system databases in the cluster.
Add a Vercel Integration
This procedure allows you to create a new account in Atlas with its organization, project, and user role, and then create a new cluster, or use an existing Atlas account, organization, project, and Atlas cluster for integration with Vercel.
To integrate Vercel applications with Atlas clusters, you begin in the Vercel UI.
Navigate to the MongoDB Atlas integration.
Go to MongoDB Atlas Integration in Vercel and click Add integration.
Choose the scope of your integration (user or team).
Choose one of the Vercel scopes from the drop-down menu:
Personal Account
Team
After you set the scope for your integration, you can't change it. To switch to a scope that differs from your chosen scope, disconnect one integration and create another one using this procedure.
Click Continue.
Select Vercel projects to link to an Atlas cluster.
You can choose specific projects or all projects. You can later edit the integration to change the projects. The project list depends on the user or team scope that you specified in the previous step.
Select one of the following options:
All Projects
Specific Projects
Create your MongoDB Account, if you don't already have one.
Choose one of the following options:
If you're using your Google Accounts, follow the steps for signing into it, or create a new Google account.
If you're using your email, it's already filled in and grayed out.
If your company uses federated authentication, use your company's email address. Proceed with the verification steps required for your federated user access.
If you already have an Atlas account, click Log in now. See Log in to Your Atlas Account.
Enter your first and last names, and choose a password. A password must contain at least 8 characters, contain unique characters, numbers, or symbols, and not contain your email address. See Register a new Atlas Account.
Click the checkbox I accept the Privacy Policy and the Terms of Service.
Review the Terms of Service and the Privacy Policy.
Select an Atlas organization to integrate with Vercel.
Select an Atlas organization from the drop-down, or create a new Atlas organization.
Click Continue.
Confirm access to your Atlas organization.
Atlas creates an organization for you. Click I Acknowledge to confirm that you grant Vercel access to your Atlas organization.
To remove access from this Vercel integration to your MongoDB Atlas organization, you must disconnect this integration.
Select an Atlas project to integrate with Vercel from the drop-down, or create a new project.
(Optional). Toggle the Enable the Atlas Data API switch. Enabling the Atlas Data API allows you to use HTTPS to connect to the Atlas databases in this organization.
Create a new free tier cluster, or link an existing cluster to one or more Vercel projects.
If you already have an Atlas account, you can choose an existing organization and project, and then choose an existing cluster.
Ensure that you have the Atlas Project Owner
role.
Choose an Atlas cluster from the drop-down on the left side of the mapping.
Choose one or more Vercel projects from the drop-down on the right side. You can map one Atlas cluster to one or more Vercel projects. The drop-down menu shows one project, or all projects, depending on what you chose for this integration earlier in this procedure. You can later link more Vercel projects to the same Atlas cluster in this integration.
If the selected project doesn't have the 0.0.0.0./0 entry in the Atlas access list, Atlas asks you to acknowledge that you are creating an Atlas cluster with full access due to dynamic IP addresses in Vercel. Atlas sends you an email with this information.
Create a new cluster if you don't have an Atlas cluster. You can later modify the cluster that you created.
Ensure that you have the Atlas
Project Owner
role.Atlas creates a new free tier cluster, and links it to the Vercel projects you selected. You can later link more Vercel projects to the same Atlas cluster.
Click to acknowledge these statements:
The IP Access list contains 0.0.0.0/0, which opens inbound access to Atlas clusters within selected Atlas projects to all IP addresses.
Your Vercel deployment requires this access because it uses dynamic IP addresses to connect to Atlas.
Manage a Vercel Integration in the Atlas UI
To manage the integration with Vercel:
In Atlas, go to the Organization Settings page.
If it's not already displayed, select your desired organization from the Organizations menu in the navigation bar.
Click the Organization Settings icon next to the Organizations menu.
The Organization Settings page displays.
Go to the Organization Integrations page.
Click Integrations in the sidebar.
The Organization Integrations page displays.
Link Additional Atlas Clusters
To link additional clusters in your organization to projects in Vercel:
Note
Use this procedure for an already configured integration. To configure an initial integration, see Add a Vercel Integration.
In Atlas, go to the Organization Settings page.
If it's not already displayed, select your desired organization from the Organizations menu in the navigation bar.
Click the Organization Settings icon next to the Organizations menu.
The Organization Settings page displays.
Go to the Organization Integrations page.
Click Integrations in the sidebar.
The Organization Integrations page displays.
Link another Atlas cluster to one or more Vercel projects.
Click Link Clusters.
The Add Another Cluster Link with Vercel window opens and shows your Atlas organization.
Select an Atlas project.
In the left drop-down list, select a cluster not linked to Vercel. If your project doesn't have another Atlas cluster, you can create one.
In the right drop-down list, select one or more Vercel projects.
(Optional). Toggle the Enable the Atlas Data API switch. Enabling the Atlas Data API allows you to use HTTPS to connect to the Atlas databases in this organization.
Click Save.
You receive a confirmation email from Atlas with the details of your integration.
A new linked Atlas cluster appears in the linked clusters list.
To link a cluster from another Atlas project in your organization to Vercel, repeat this procedure for that project.
Edit or Remove Links to Atlas Clusters
You can add or remove Vercel projects that you linked to an Atlas cluster.
In Atlas, go to the Organization Settings page.
If it's not already displayed, select your desired organization from the Organizations menu in the navigation bar.
Click the Organization Settings icon next to the Organizations menu.
The Organization Settings page displays.
Go to the Organization Integrations page.
Click Integrations in the sidebar.
The Organization Integrations page displays.
To add or remove some Vercel projects, click Edit next to the linked Atlas project.
Atlas displays existing linked Vercel projects.
Edit existing links, in the right-side list, choosing a project from the drop-down. You can:
Click next to a Vercel project in the list to add it to this cluster's integration.
Click to remove some Vercel projects from this integration.
(Optional). Toggle the Enable the Atlas Data API switch. Enabling the Atlas Data API allows you to use HTTPS to connect to the Atlas databases in this organization.
To remove links to all Vercel projects, click Unlink next to the linked Atlas project.
Atlas asks you to confirm that you want to unlink the cluster from the projects. To confirm, click Unlink. Atlas removes the environment variables for Vercel projects that it created when you linked the projects to an Atlas cluster.
If you unlink all projects, Atlas behaves as follows. It:
Doesn't remove your data, database users, or IP access lists that you created for this integration.
Doesn't delete the cluster, or the integration, even though the Atlas UI might show that you have no linked clusters in your integration. To disable the integration, you must disconnect Vercel.
Disconnect a Vercel Integration
Before you disconnect Vercel projects from Atlas clusters, to avoid downtime to any applications connected to the same Atlas clusters, verify that the cluster's users and network access rules don't share other projects and applications connected to this Atlas cluster.
In Atlas, go to the Organization Settings page.
If it's not already displayed, select your desired organization from the Organizations menu in the navigation bar.
Click the Organization Settings icon next to the Organizations menu.
The Organization Settings page displays.
Go to the Organization Integrations page.
Click Integrations in the sidebar.
The Organization Integrations page displays.
Confirm that you want to disconnect this Vercel integration.
Atlas asks you to confirm that you want to disconnect your Atlas organization from Vercel.
Disconnecting the integration may result in downtime for your Vercel applications and any other applications connecting to the Atlas clusters that you linked to Vercel.
To confirm, enter the words Disconnect Vercel
in capital
letters and then click Disconnect Vercel.
Atlas removes the integration by removing the environment variables for Vercel projects that it created when you linked the projects to an Atlas cluster.
Vercel also removes the integration and it no longer displays in the Vercel UI.
After you disconnect the Vercel integration, if you haven't deleted users, access lists, or Atlas Data API keys, you can:
Note
When you remove an integration in the Vercel UI, Atlas also removes the integration and you don't need to disconnect the integration in the Atlas UI.