I'm just getting started on a multitenant application for the lending / finance space. I've looked into Apartment, Milia, Act_as_tenant, etc. but none seemed to really fit what I'm trying to do.
I'll need different types of accounts. The interface / view templates will be different for a lender, for example, than for a borrower. I'm anticipating needed a lot of different classes, functionality, and different API's across the different types of accounts. This starts to sound like something that would be a good basis to start thinking about a services oriented architecture and a distributed system, however, for efficiency and time, I don't want to jump into that at the outset. I'd prefer to keep it as a monolith to start and break it out should the need arise in the future.
Here is what I was thinking as a general structure:
The issue I ran into with Apartment, for example, is the inability to add models that are unique to a specific type of tenant. For example, Lenders will have the ability to submit a Bid (loan offer with terms) to a borrower (so that the borrower can recieve multiple offerst from multiple lenders). I don't want to have a Bid added for a Borrower account in the DB as well, nor would I like the Bid excluded from the tenant and placed in a global space.
I was thinking that I could have Account type isolated into its own gem / engine so it would be similar to Dan Manges article about building a modular Rails monolity app with gems. The only difference is that in the /app folder I'd have the shared functionality between the tenants.
I have so many questions I'm not sure where to start! General feedback on this structure, how to go about accomplishing this, any potential resources you might know of, etc. is all welcome! So glad to be a part of GoRails! I hesitated too long to join!
Join 27,623+ developers who get early access to new screencasts, articles, guides, updates, and more.