N
Neon17mo ago
eager-peach

Multi tenant application with Neon and Vercel

Hi there, We are developing a multi tenant, business management app and we are considering to use Neon, alongside Vercel. Here are some details about the app - The app will have one project in Vercel for all clients - We will use one individual DB for each client/tenant - The app will connect to a different DB based on the tenant url In Neon, we are considering to use on project, with multiple databases. The problem we are encountering is that when you want to restore a DB in Neon (e.g. because of a data loss), all the databases from that branch are restored. Is there any way to manage backups at database level, and not branch level? Is there any better way to structure multi tenant apps in Neon? Thank you!
5 Replies
harsh-harlequin
harsh-harlequin17mo ago
Is there any better way to structure multi tenant apps in Neon?
The best way is to create a project per tenant This gives you control over the database region, backups and you have granular control when restoring your database
eager-peach
eager-peachOP17mo ago
Understood, but does that mean that I have to provide a distinct compute engine for each customer? I am afraid that will become very cost inefficient very quickly. More that that, the database is (currently) used 100% of the time (for minute to minute checks). Is there any alternative to this? Or did I understood the compute approach wrong?
harsh-harlequin
harsh-harlequin17mo ago
Actually, each project's compute can scale up or down automatically So if each one of your users has different usage, it might lead to more cost savings
More that that, the database is (currently) used 100% of the time (for minute to minute checks).
So with autoscaling you can have the minimum compute size to be very small. So if it's running 24/7 it won't be too much
eager-peach
eager-peachOP17mo ago
Understood. We want to use bigger compute engines, that group a lot of tenants (each with their individual DBs), all under the same project. We believe that is the best approach when using multiple tenants (shared resources, separate data). With the proposed approach, we will result in higher cost. We need to find other DB provider in this case. Thanks for the clarification.
harsh-harlequin
harsh-harlequin14mo ago
https://discord.com/channels/1176467419317940276/1176467419938701375/1289308541638934578 We published a video about multi-tenancy that you can check out

Did you find this page helpful?