10 ms·
Nile: Serverless Postgres for modern SaaS
- flashgordon 3y agoThis is brilliant. Founders are top notch. They truly understand control plane development needed for true regional services. Cant wait to see more of this!
- XCSme 3y agoNote that your page has a horizontal scrollbar on a 4K screen.
- gwen-shapira 3y agoNile co-founder here :) Nice surprise to see our launch here. Happy to answer any questions...
- candiddevmike 3y agoAfter reading the landing page, I have no idea what I would use this for or what a tenant means. How do I manage my schema? How do I do migrations? Is this thing running all the time? What's the tech stack underneath?
- infra_dev 3y agoNile CEO here. Thanks for the feedback. Let me try to explain it a bit. Modern SaaS applications are multi-tenant. We’re the first database that virtualizes tenants into the database. A tenant is primarily a company, an organization, or a workspace in your product that contains a group of users. This enables seamless tenant isolation, per-tenant backups, and placement on multi-tenant or dedicated infrastructure, anywhere on the planet. You can do all this with the experience of a single Postgres! You don’t have to manage multiple databases, build complex permissions for isolation, or write buggy scripts to read specific tenant data from backups. On top of the tenant model, we provide opt-in user management capabilities, customer-specific vector embeddings, and instant tenant admin dashboards. You manage schemas like how you manage with standard Postgres. Your favorite tooling should work. When you make the schema change, Nile pushes the schema to all the tenants. For the user, it is like interfacing with a single Postgres instance. We have built a Rust based layer internally to manage tenants, route them, shard them if needed and have multiple tenants talk to each other. Happy to chat more. My email is ram@thenile.dev
- drdaeman 3y ago> Modern SaaS applications are multi-tenant. This is true in a sense “most modern SaaS apps have at least two unrelated users or user groups” (forgive me please if I’m wrong here, but that’s how I loosely understand “multi-tenant”), but it’s not exactly clear why this is important. I strongly suspect that the majority of modern SaaSes don’t do any database-level tenant isolation or per-tenant backups. The smaller the company the less it’s likely. Row-level security is a very rare sight to behold, even in regulated areas (certifications like HIPAA compliance don’t really require this). The best they do if they’re really global (I’m sure most are only global in “we accept users from anywhere”, but not so much under the hood - even though cloudy sales pitches love to paint a different picture, most SaaSes I’ve seen were one or two-region deployments) is try to move/shard data closer to the the user’s region. I think one concrete example (as simple as possible) would help a lot.
- maweaver 3y agoI think it makes more sense if you think of it in terms of "B2B" SaaS applications. Think selling a subscription to a medium-sized company, all in one geographical location, where data is shared between all users of that organization, and very carefully not shared outside of that group. For a more concrete example, think Salesforce. I'm not sure that I would generalize that to all modern SaaS applications though.
- infra_dev 3y agoNile CEO here. Here are a few use cases that can help you. We believe SaaS is 95% of new companies today and it is very broadly applicable. Happy to chat further if interested 1. GitHub helps a group of developers manage and deploy their code. Each Github organization is a tenant, and the developers within those organizations are users. 2. Salesforce or Hubspot helps sales reps manage their leads. Each company is a tenant, and the users are the sales reps. 3. Ring is a home security company that provides alarm services to different households. Each household is a tenant, and people living in a house using their service are users. 4. Toast is a platform to help build software for restaurants. The restaurants are tenants, and the employees of the restaurants are the users.
- gwen-shapira 3y agoIt is a Postgres, so schema and migrations work exactly as they would elsewhere. Tenants are your customers. It is normal for SaaS to have either a schema per tenant or one schema and tenant_id column in most tables. Nile provides you with both experiences at the same time.
- jadbox 3y agoAt first pass, I'm impressed with the multi region/tenant built-in support. I take it that changing a region is as changing the table row key. I wonder though about this strategy strictly place user's data as an entry into the data store... what if my users travel a lot between regions? Is the best strategy that upon user login to update their region in all their related tables?
- gwen-shapira 3y agogreat point! If they travel a lot, you may want the data in one location (although it still depends, moving data is often faster than flying to a different region). Tenant placement is especially great if their location has data residency requirements. We discovered that companies with many EU customers need this.
- infra_dev 3y agoNile CEO here. Nile provides tenant virtualization. Each tenant has a group of users within them. Typically, you would choose one location for a tenant. This will be based on your customer location. This would mostly stay the same. The users in a company could travel, but the choice of region is usually decided by where the company is located. Yes, you would be able to change the location of a tenant and the data will be moved to a new region but this usually happens if there is a major decision about location in a company.
- jadbox 3y ago> This would mostly stay the same. The users in a company could travel, but the choice of region is usually decided by where the company is located. For most of my apps, I have very little idea on their region aside from their login IP origin, and we get a high level of multi-region travels (like conference organizers). I'd encourage you to transform the notion of a tenant transfers from a 'major decision' to 'assume users will/should switch to closest tenant login'. It looks like your platform already allows this move-tenant-on-login approach, but I'd love to see more docs and more tests around that use-case.
- 3y ago
- rkuodys 3y agoCool product if it works as promised with one caveat - I have saas app on django. I would happily migrate it from current setup to something that promises Tenant separation out of the box. But I'm not dropping the framework anytime soon. How will that work together?
- infra_dev 3y agoNile CEO here. We work out of the box with Django. We are working on providing examples and tutorials for Django soon.We definitely want to play well with the ecosystem.
- flashgordon 3y agoGolang demos/samples with Gorm/Xorm please (pretty please)!
- gwen-shapira 3y agoNoted :) I was checking out Xorm last night. It looks awesome!
- pbowyer 3y agoBe great to have an example for Symfony (PHP) and Doctrine ORM too.
- gwen-shapira 3y agoOoh, yes! I need to get a Django and other Python examples going. With Flask it is fairly straightforward - you add the tenant configuration to the DB connection when you pick it up to serve a request. The Java and NodeJS examples do something similar if you need to see the idea.
- k4rli 3y agoI have no need for the product currently but website's really nice with the black-white color schema; I rarely see a website that actually feels as nice. Can't check currently on phone but this is probably nextjs underneath, right?
- gwen-shapira 3y agoIndeed! How did you guess?
- brosciencecode 3y agoThis looks like an interesting take on serverless Postgres! Is this type of multi tenant separation enough for the kinds of users who care about it? I’d imagine a lot of the concerns around multi-tenant would be related to potential application layer bugs that can co-mingle data.
- manfromnowhere 3y agoData isolation, recovery, backups are a big problem in the world of SaaS, especially at huge scale. Companies end up hiring a dedicated infra team to handle such issues.
- theturtletalks 3y agoMakes sense, but if you're doing multi-tenancy, why not deploy a postgres database for each user so co-mingling is not even possible? That would make on-prem deployments easier to migrate to as well.
- randlet 3y ago> why not deploy a postgres database for each user so co-mingling is not even possible This is the approach we took and I think it helps with IT review docs.
- infra_dev 3y agoNile lets you do this without incurring the operational complexity of managing multiple databases. We let you place the virtual tenant DB either on one multitenant Postgres DB or a dedicated Postgres. So, you can actually create a dedicated one for each of your tenant in Nile but interact with them like a single Postgres instance. We take care of schema updates across them, client-side routing and metadata management
- randlet 3y ago> We let you place the virtual tenant DB either on one multitenant Postgres DB or a dedicated Postgres. Sounds promising, but by "a dedicated Postgres." do you mean a different server or just a different db on the same server? I'm trying to get at how the cost would change between the two solutions. Right now we can run N databases on the same Postgres server for roughly the same cost as running a single multitenant db. Switching to "server per customer" seems like it would be cost prohibitive.
- iFire 3y agoCode is not released. LICENSE Apache-2.0 https://github.com/niledatabase/niledatabase/blob/main/LICENSE.txt https://github.com/niledatabase/niledatabase/blob/main/LICEN... Edited: This is the docs repo.
- benpacker 3y agoThis is the docs repo
- infra_dev 3y agoNile CEO here. Yes, this is docs, examples and our website right now. Our background is in open source for the last 15 years. We helped build Apache Kafka and grow the community to a very successful one. We believe open source should be done well and hope to consider it once we have the bandwidth to provide DIY ways to run Nile.
- deleted 3y ago[deleted]
- jxi 3y agoHow does this differ from Neon?
- infra_dev 3y agoNile CEO here. We do offer serverless Postgres but that is where the similarity ends. We’re the first database that virtualizes tenants into the database. This enables seamless tenant isolation, per-tenant backups, and placement on multi-tenant or dedicated infrastructure anywhere on the planet. You can do all this with the experience of a single Postgres. Here are some examples that can help you to understand the type of use cases. Most applications are multi-tenant and this is what we help with. 1. GitHub helps a group of developers manage and deploy their code. Each Github organization is a tenant, and the developers within those organizations are users. 2. Salesforce or Hubspot helps sales reps manage their leads. Each company is a tenant, and the users are the sales reps. 3. Ring is a home security company that provides alarm services to different households. Each household is a tenant, and people living in a house using their service are users. 4. Toast is a platform to help build software for restaurants. The restaurants are tenants, and the employees of the restaurants are the users. Happy to chat more. My email is ram@thenile.dev
- kjfdslakj 3y agoDon't take this the wrong way, because I think serverless postgres is a major achievement. But would you say multitenant means use Nile, and for everything else, use neon?
- infra_dev 3y agoIf you are building a static website (usually your website) or building a social networking product like Facebook, I would not recommend Nile. We recommend Nile for any usecase where you are serving multiple groups of users. In our experience, 95% of applications in the market today seem to fall into this category.
- deleted 3y ago[deleted]
- sgammon 3y agoLove Nile!! We worked with their team on a project last year. I absolutely cannot say enough about how great they are. If you are building multi tenant saas you should totally look at them!!
- manfromnowhere 3y agoHow does the vector embedding work? Do you store the embeddings per tenant and let the application search for it?
- infra_dev 3y agoNile CEO here. Yes, you can store embeddings per tenant and search for it. You can read more about vector embeddings and how we support it here https://www.thenile.dev/docs/ai-embeddings https://www.thenile.dev/docs/ai-embeddings
- jeroen79 3y agoWhat makes this serverless?, adding an extra "tenant" layer does not affect it being run on one or more servers.
- infra_dev 3y agoNile CEO here. Nile abstracts away compute machines and provides an experience where you can easily scale up or down based on the load you push. Specifically, Nile lets you do the following - Create a database and start querying it. Nile takes care of adding capacity to tenants as workload increases. - Pay for what you use. You will only pay for what you use. We have plans for pricing where you can pay based on usage per tenant. This will ensure your business value is aligned with the cost of your database. For example, a customer on your free tier may not be an active user and you would not pay for them in Nile. - We have built multitenancy into Postgres and a gateway layer that routes. This helps us to scale to zero with instant availability when you want to scale back up. - You can create even a million tenants if you have that many customers. - We have built connection pooling into Nile. This helps to provide limitless connections as you grow
- orliesaurus 3y agoI thought Cassandra DB was a version of this, am I wrong?
- ranguna 3y agoCassandrs is nosql, so I'm not sure how it can be a version of a serverless postgres provider.
- orliesaurus 3y agofair point
- makoz 3y agoDisclaimer work at AWS. I'm still trying to understand the scaling story better. When we say serverless it mentions automatically scaling when it detects some sense of resource pressure. If I have a "hot tenant-database", does that mean this shard will be scaled automatically without impact to existing queries? Or would there be some "blip". I suppose it's unavoidable in edge cases but curious about the regular ones as well. It's an incredibly cool CX you have here with the automated query routing/tenancy story though, looking forward to what happens in this space.
- kjfdslakj 3y agoAnyone use this and and the incumbent neon.tech?
- swyx 3y agoneon and supabase are both the up and comers in the postgres world i think. the real incumbents are the AWS RDSes of the world and their azure and gcp equivalents.
- bob1029 3y agoWould it be fair to compare this to things like Azure SQL Server Hyperscale architecture? My first impression of the docs indicates this is a similar idea but for Postgres.
- beoberha 3y agoThey don’t seem to get into their architecture under the hood. The novel aspect seems to be that they have tenants as a first class member of the database
- infra_dev 3y agoAzure SQL Server Hyperscale architecture gives you plenty of scale but does not do anything to help with managing tenants. I will explain what Nile tries to do. Happy to follow up. The most foundational element in SaaS is a tenant. It makes a lot of sense to build this core concept into the database. Imagine having a lot of virtual tenant databases that can be co-located on one physical Postgres (multi-tenant) for better cost, and some of them can be placed on a dedicated database for better isolation. The virtual tenant DBs can be located anywhere on the planet for low latency or compliance. The client can route to the right tenant seamlessly without routing logic in the application. Isolating tenants into their own virtual DBs is great, but you will also want to be able to share data across tenants where it makes sense. Backups should be available for each tenant, and it should be possible to restore them instantaneously. Schema changes should be applied seamlessly across all the tenant DBs, and it should also be possible to do staged rollouts for different tenant tiers. While supporting all this, all the standard SQL capabilities should work across the tenants for admin operations. All the standard Postgres tooling should work. You want the experience of a single Postgres. This is what Nile tries to achieve. A model that gives you fine-grained control over your tenants. You create, scale, locate, pay all by tenants.
- jroseattle 3y agoHow would I incorporate Nile into a disaster recovery or failover plan?
- niklearnstodev 3y agoHaving never worked on a multi-tenant SaaS app, is this how multi-tenancy is typically implemented (a per-tenant-database)? Is there a certain scale at which this becomes the ideal pattern? If so, has anyone made the shift from a single-database approach to a per-tenant-database approach?
- sb8244 3y agoI'd say it's probably not the typical implementation. Mainly because it's a pain to implement and manage. I guess that's why this was created though. It's definitely an intriguing tool. I did shift in past from single database to sharded via citus. The actual migration was smooth, but 6+ months of work went into ensuring compatibility. There's ways to nearly guarantee compatibility without actually using a sharded approach, like enforcing all tables have a uniform shard key.
- niklearnstodev 3y agoGood point, this product does make this approach far more palatable. Curious if the sharding strategy that you were shifting to was company-based, as is implemented in this case?
- sb8244 3y agoYup! I lean towards a tenant ID approach. I ALWAYS use a library that enforces these tenant checks on queries. Ruby (https://github.com/citusdata/activerecord-multi-tenant https://github.com/citusdata/activerecord-multi-tenant) and Elixir (I wrote https://github.com/sb8244/ecto_tenancy_enforcer https://github.com/sb8244/ecto_tenancy_enforcer) are the ones I have experience with.
- api 3y agoSometimes it is. Often it's done in the database itself, but then you have to be very careful you never have a query that returns data that belongs to someone else.
- manfromnowhere 3y ago
- jmtucu 3y agoDoes it work with Drizzle ORM?
- gwen-shapira 3y agoWe don't have an official example yet, but I expect it will work. So far every JS framework that uses https://node-postgres.com https://node-postgres.com works great and so no reason to think Drizzle wouldn't.
- mdaniel 3y ago> You can sign up for our waitlist today to try it out. I guess this gets a pass since it's not a "Show HN" but that junk drives me crazy
- infra_dev 3y agoNile CEO here. I agree, and I am with you. I can vouch that this is not done with any malicious intent. We were not ready for HN yet but here we are. Our goal was to work with initial users to really polish the product before we open it up to everyone. We understand this would discourage some to not join and we hope to get them back once we are available for general availability.
- yencabulator 3y agoEven worse is the Github link to a practically empty repository.
- golondon 3y agoJust for the tradition, I would like to leave a comment: "I don't see how this will work. There is nothing here you can't do with Postgres schemas"
- gwen-shapira 3y agoTechnically true, since we did all that with Postgres :)
- endigma 3y ago"Grow for years" only really works if your SaaS also exists in years. I can't imagine deciding to run a production DB with a custom RLS thing going on without being able to directly port that off-provider in a worst case scenario. Supabase sort of gets around this by being open source, but even then depending on their custom setup gives me a little anxiety. Not sure about other managed/"serverless" Postgres.
- infra_dev 3y agoNile CEO here. Nile will promise to make the experience of moving out of Nile really easy. This is one our core product principles. We want users to stay for the value we provide. Nile user permissions are optional. You can decide to use any third-party provider for it. We are in the design phase for permissions at this point. We would love to get your feedback to understand more about your concerns https://github.com/orgs/niledatabase/discussions/159 https://github.com/orgs/niledatabase/discussions/159
- infra_dev 3y agoI do also want to mention that we don't fork Postgres. We have built tooling around Postgres using extensions and gateway layers on top of it.
- endigma 3y agoThis doesn't necessarily mean that any user could pick up and switch to a different PG instance, as such a young provider maybe look at having some docs for migrating off-platform as a sort of assurance. Maintaining those docs might also help you prevent adding or changing things that would introduce lock-in, it should be a consideration for every feature or API change.
- infra_dev 3y agoAgree. We will prioritize how to migrate from Nile. At the Postgres level we don't want any lock-ins. We would have APIs that simply SaaS workflows that users may choose to use.
- KRAKRISMOTT 3y agoWhat's the cold start time like? Neon's performance is horrible.
- infra_dev 3y agoNile CEO here. You can place tenants on multitenant DB or a dedicated Postgres DB. Placing the tenants on multitenant DB is the default. This has no cold start time since the instance/container is shared. If you choose to place a tenant on a dedicated tenant DB, you would have cold time of a few seconds. We are building this as we speak and will have more numbers to share soon. However, if you have chosen to place a tenant on a dedicated DB, these typically would be critical customers who are actively using the DB and may never want the instance to go down. We are exploring provisioned compute tokens for this purpose.
- tristan957 3y agoWhat cold start times have you experienced? I work at Neon, so I'm more than happy to pass along your experience if you want to share it with me. You can email me at tristan at neon.tech. Or you can reply here.
- mj4e 3y agoHave you tried Neon recently? There were some big improvments rolled out in the late summer - https://neon.tech/blog/cold-starts-just-got-hot https://neon.tech/blog/cold-starts-just-got-hot
- saisrirampur 3y agoVery cool. This is Sai, ex-Citus and currently PeerDB. You are promising many features incl. region aware tenant placement, tenant level metrics, easy tenant isolation etc. which would really help multi-tenant SaaS customers. Back during my days at Citus, we spent many cycles to a build a database for SaaS. We built some (not all) the features you mentioned and saw customers really finding value. Congrats on the launch. I would love to try out Nile in the future!
- infra_dev 3y agoThanks sai. Great to hear from you! I have been following PeerDB and you folks are doing great work.
- rsweeney21 3y agoIs there a mechanism for replicating shared/system data across tenants? Can I deploy into a specific AWS or GCP region?
- infra_dev 3y agoCurrently, we support only AWS but do want to support other cloud providers. Technically, you can even have one DB that spans across cloud providers with your tenants, but we have not yet seen many use cases for multi-cloud. W.r.t replicating data across tenants, could you give an example use case for it?
- rsweeney21 3y agoLet's say I'm building a CRM and I want to have an "industry" or "cities" table that is the same across all tenants. I want a copy of cities in each tenant for referential integrity, but I also need to update it periodically across all tenants.
- infra_dev 3y agoGreat question. Nile supports shared tables for this purpose. Shared tables are regular tables that can be shared across all the tenants in another table. We have example use cases and how this works in Nile here https://www.thenile.dev/docs/tenant-sharing https://www.thenile.dev/docs/tenant-sharing. Let me know if this works for you.
- rsweeney21 3y agoThat sounds like exactly what I was looking for. Impressive!
- pier25 3y agoDoes this support listen/notify, PG extensions, etc?
- infra_dev 3y agoWe do plan to support a bunch of extensions soon. We do support pg_vector at this point. Would love to know if you have any favorite ones. Also, could you share the use case for listen/notify? We currently do not support it but have plans for something that gives you the same functionality.
- pier25 3y agoAs far as extensions I think postgis should be pretty much a default in all PG installations these days. I use listen/notify and triggers as some sort of pubsub.
- joshstrange 3y agoThe tenants concept is really cool and something I'm fighting with right now. I actually went single-tenant from day 1 (not exactly on purpose) and it's a been a pain to find a DB solution that will work well for me. I absolutely love PlanetScale but having 1 database per client means paying for 1 plan per client. I'm B2B so I have way fewer "clients" but my load is incredibly spiky for each client (75% of the time they have near-0 usage, 20% of the time they have a tiny amount of usage, and the 5% they use a bunch). As it stands right now their heavy load never overlaps so I've been mulling over a move to an RDS cluster where I can run multiple databases on the same hardware. I'm not super interested in migrating to Postgres (though I think my app would move relatively easily, I don't use anything super MySQL-specific, it's just what I know) but I'll be watching this project as it moves forward. I'd really like to not manage my own DB, it's not where I'm strong and I'd rather focus on other things.
- infra_dev 3y agoSorry to hear your problems. We would be a great fit for your use case. We are serverless and support spiky workloads. You can map your clients to tenants in Nile. Let us know if anything changes on your side in the future. I would love to connect.
- hobofan 3y agoI've been interested to see what Nile will be since the Twitter pre-announcement, and: uff. The tenant capabilities are nice to have, but even when building a tenant-focused SaaS not really a big draw. The examples shown even come down to "you can achieve 80% of this by just adding a tenant column everywhere". When comparing this to e.g. Supabase, their autogenerated REST/GraphQL APIs solve a lot more significant pain points, especially when starting out.
- infra_dev 3y agoSorry to hear that. We understand each one will have a different set of problems. From our experience and talking to others, it is usually not as simple as adding a tenant_id column. You typically care about security from day one and want to be really careful how you isolate customers. You would also want to add user and organization management easily to the product. We have made these steps really easy without having to spend time writing complex permission logic and potentially buggy code. We also are able to provide query insights by tenant since the database understands tenant boundaries. There are also other things that I have mentioned in the blog. Having said that, if our users want autogenerated APIs, we would be more than happy to invest in it. We did have plans for it but in our conversations most did not bring it up. Hopefully, we can convert you to love Nile as we grow.
- hobofan 3y ago> You would also want to add user and organization management easily to the product. That's usually something that I'd outsource as much as possible to Auth0 (yikes, considering the last days), as building out the UIs and state handling for all user auth and management flows is a huge chore. I think recently Clerk has set a new standard on how easy that can be. I'd be surprised if a database product could compete in a meaningful way in that area. I'm looking forward to see what Nile evolves to! (IIRC Supabase also didn't look that enticing when it first appeared on the map). In general I'm really happy to see databases as such an active space of innovation again.
- mattashii 3y agoI wonder how this compares to e.g. Citus with some triggers and RLS on top. As this does regional accesses of shared and modifiable data, does Nile implement or guarantee snapshot consistency for cross-shard queries? Citus doesn't have this yet, iirc. From the docs, I assume Nile does something like the following: - "smart partitioning" of tables on tenant_id when tenant_id is detected on table creation. These partitions are either region-local when the tenant is located in that region, or foreign tables. (Alternatively, non-local tenant data is replicated with e.g. logical replication/LR, or triggers) - global tables are replicated across all regions, again presumably with LR - RLS on the smart partitioned tables, which applies the tenant filter when nile.tenant_id is set. Do you have any docs where I can read up on this in more detail? All in all this looks like a real neat project. Congrats on launching.