Static IP guide
Connecting to MongoDB with a static IP from a Node app on Vercel
Atlas plus Vercel is one of the most common Node stacks, and the secure way to pair them is an Atlas IP Access List containing just Fixie's two addresses. Mongoose passes proxy options straight to the MongoDB driver, so the whole setup is four fields parsed from FIXIE_SOCKS_HOST.
Recommended setup
Use Fixie Vercel integration for MongoDB connections from a deployment environment with changing outbound IPs. Store the proxy value in FIXIE_SOCKS_HOST, then configure Node.js to route outbound traffic through Fixie before connecting to MongoDB.
Set up Fixie on Vercel
Add the Fixie Vercel integration, create a proxy in the Fixie dashboard, and connect it to the Vercel project and environment. The integration can create FIXIE_SOCKS_HOST in Vercel Environment Variables for the connected project.
Pull Vercel environment variables locally
vercel env pull
grep FIXIE_SOCKS_HOST .env.localImplementation
The example below shows the core application-side change. Keep credentials in environment variables and avoid committing proxy, database, or API secrets.
Connect to MongoDB through FIXIE_SOCKS_HOST
const mongoose = require('mongoose');
const fixieValues = process.env.FIXIE_SOCKS_HOST.split(new RegExp('[/(:\\/@)/]+'));
mongoose.connect(process.env.MONGODB_URI, {
proxyUsername: fixieValues[0],
proxyPassword: fixieValues[1],
proxyHost: fixieValues[2],
proxyPort: Number(fixieValues[3]),
}).then(() => {
console.log('Connected to MongoDB');
});Good to know
- Vercel's guidance of caching the Mongoose connection in a module-level variable still applies, but add retry logic: an idle function may find the proxied connection closed and need to reconnect.
- Remove
0.0.0.0/0from the Atlas access list once Fixie is live — leaving it in silently negates the allowlist.
Allowlist and test the static IPs
- Open the Fixie dashboard and copy the outbound IP addresses for this proxy.
- Add both IPs to the MongoDB network access list.
- Deploy the updated Node.js app on Vercel.
- Run a small connection test before sending production traffic.
Related guides
- Making API requests with a static IP from a Node app on Vercel
- Connecting to MongoDB with a static IP from a Node app on Heroku
- Connecting to Postgres with a static IP from a Node app on Vercel
- Connecting to MongoDB with a static IP from a Node app on Render
- Connecting to MySQL with a static IP from a Node app on Vercel
- Connecting to Amazon Redshift with a static IP from a Node app on Vercel