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.
Vercel integrates with the Next.js network. To learn more about using Next.js with MongoDB, including deploying in Vercel without this official integration, you can also see Integrate MongoDB Into Your Next.js App.
The integration with Vercel requires that you:
Use an existing personal or team account in Vercel.
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.
If you use a personal Vercel account for your MongoDB integration, and want to switch to an integration for a team to the same Atlas organization, you must disconnect an existing integration in Atlas, and add a new integration with a team scope.
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.
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:
MONGODB_URIenvironment 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
/myFirstDatabaseas 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.
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.
Go to MongoDB Atlas Integration in Vercel and click Add integration.
Choose one of the Vercel scopes from the drop-down menu:
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.
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:
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.
Select an Atlas organization from the drop-down, or create a new Atlas organization.
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.
From here, you can perform these tasks:
To link additional clusters in your organization to projects in Vercel, use the Link clusters button on the Atlas Integrations page for Vercel.
Use this procedure for an already configured integration. To configure an initial integration, see Add a Vercel Integration.
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.
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.
You can add or remove Vercel projects that you linked to an Atlas cluster.
Atlas displays existing linked Vercel projects.
To edit existing links, in the right-side list, choose 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.
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.
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.
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.