Multiple databases in project (EU and US versions)

Hi!

I have developed a NextJS with Vercel Blob and Supabase.

My potential customers in the EU needs to store their data in EU, while american customers want their data in the USA.
Is there any way to do this? Seems like I can only create a single Vercel Blob pr. project?

Also, I need to migrate data from a EU blob to a US location - is there an easy way to do this?

Best,
Emil

1 Like

Did you know there’s another category dedicated to v0 topics? A human should be here soon to help, but the answer may already be available even faster in one of these other posts.

Our docs are a great place to start.

We also have a walkthrough to help guide your workflow.

And these recordings can give you a look at v0 features and strategies in action shown by our Community:

https://community.vercel.com/tags/c/events/42/v0

I did my own migration in the meantime, but I still need advice on how to run 2 seperate supabase and 2 vercel blobs in the same project.
Thanks!

1 Like

We’re running a database-per-customer setup. On a high level these will be kinda similar.

Firstly you will need a way to get the customers location. I assume it has to be saved somewhere. You could save it within your user object and return it in your auth JWT token for quick access. Alternatively you could determine it from a subdomain, e.g. us.myapp.com or eu.myapp.com.

If you have a Vercel deployment in multi region (EU and US) you can also use VERCEL_REGION for determining the location. (Feature request: region based env var overwrite :slight_smile: )

Personally I would let the user select eu/us in the onboarding and save it on the user object e.g. with your auth provider and use this as a source to determine the users location.

Secondly you need to route to the correct environment vars based on the obtained location. Initialize your supabase client or whatever APIs you have with a different env var depending on the location. E.g. SUPABASE_US_DB_URL or SUPABASE_EU_DB_URL.

It will look roughly like this:

3 Likes

Fantastic - thank you. Sounds pretty simple. Are you running Vercel Blob too? Because as far as I can see I would need to create a dummy project to create another blob - and then copy the Env. variable to the real project.

1 Like

You can create a Blob storage independent of a Vercel project from Dashboard > Storage > Create Database > Storage. Let me know if you need more information.

About you question:

Also, I need to migrate data from a EU blob to a US location - is there an easy way to do this?

No, there’s no direct way of doing it. You can use the SDK to list, download, and then upload to new blob.

1 Like

THank you! I already migrated using a script - that was no trouble :slight_smile:

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.