DEV Community

Creating a Subscription SaaS Application with Django and Stripe

Cory Zue on May 28, 2020

Software-as-a-service (SaaS) subscription businesses are among the fastest-growing companies in the world today. Every day, developers and aspiri...
Collapse
 
nyamador profile image
Desmond

Amazing Post Cory.
I've been trying to figure out multi tenant Saas applications with Django . But my one question has always been with infrastructure. Does this mean that every new instance of the multitenant saas app spins up a new server instance or kubernetes cluster?

Collapse
 
czue profile image
Cory Zue

Thanks Desmond!

Re multi-tenancy, it depends on how you architect it. This book is a good starting point. If you go with one of the simpler options like the shared database / shared schema approach then you don't need to worry about infrastructure. But if you go all the way to "completely isolated tenants using Docker" then yeah - you need to do quite a lot of devops to get things working!

Collapse
 
simo97 profile image
ADONIS SIMO

Awesome, thank for the book recommandation also.

I have similar issue but with database design. Actually i am separating tenant via schemas and i am using AWS i feel like with this GDPR law i will have to store "EU tenant" informations in a database within an EU region but i have no clue of how to do this separation (knowing that there is some informations in the shared tenant ).
Any idea please ?

Thread Thread
 
czue profile image
Cory Zue

Hmm, that's not something I have much experience with. I imagine you could "fork" the tenant at the app-level (e.g. set up a clone at eu.myapp.com) or the DB-level (where I guess you'd have to route app-layer traffic based on a chosen user setting), with varying tradeoffs.

The former has the advantage of having the whole backend be colocated and in the EU which should help with performance, but comes with the operational overhead of maintaining two sites. The latter would maybe be a simpler set up for the end-user but introduce more latency behind the web server if you're making DB requests across an ocean.

Hope that helps!

Thread Thread
 
simo97 profile image
ADONIS SIMO

Yeah thank you. I will dive into those path to know more.

Collapse
 
nyamador profile image
Desmond

Awesome!
I really appreciate your help🙏

Collapse
 
ohduran profile image
ohduran

Great post, I've learnt a lot!

Maybe the first step before integrating that is having an MVP ready? If you know your way on Docker and have some React knowledge, I've built a cookiecutter that allows you to jumpstart the whole SaaS business and deploy it to Heroku in a breeze. Check it out here: github.com/ohduran/cookiecutter-re...

Collapse
 
czue profile image
Cory Zue

Thanks ohduran!

You're definitely right that you'd want some kind of MVP app ready before trying to get anyone to pay for it. :)

Thanks for sharing your template! I'm a big fan of cookiecutter!

Collapse
 
steelwolf180 profile image
Max Ong Zong Bao

Wow, you literally spend tons of time to do this is really awesome article.

Collapse
 
czue profile image
Cory Zue

Haha, thanks! Yeah I probably spent 40+ hours on this... :)

Collapse
 
steelwolf180 profile image
Max Ong Zong Bao

Wow massive & important work, I wanted to write something on Django and e-commerce. Which was super overwhelming for me when I look for it like people who are using wagtail for it.

Thread Thread
 
czue profile image
Cory Zue

Thanks Max! I'd love to see that! I've done Django+ecommerce, but mostly just selling one or two products on my own sites, nothing complex or at scale.

Collapse
 
ssijak profile image
Saša Šijak

Good post on the technical side.

But, regarding Stripe, after all the pain of integrating it, you discover that you have to handle tax hell in some way, and as a solo developer or a small team for a new SaaS that is almost unmanageable. And than you either break the law and hope for the best, or move to something like Paddle.

Tax Hell = Needing to charge VAT for all customers from Europe and pay it back to respective countries, but there are nuances and exceptions. Some other countries have other schemes. And US has tax nexus laws per state.

Collapse
 
simo97 profile image
ADONIS SIMO

Interesting point this is something we don't really look for when we do this payment stuff on website.
(tutorial's authors didn't spoke about that, lol)

Collapse
 
agenteand profile image
Luis Solis • Edited

Amazing post.
When will we see more posts?
I do not know if I missed something, but it is not clear how you attach ProductMetada class to stripe plan.
I'm waiting for: Feature-gating (restricting access to content based on a user's Subscription)

Thanks Cory

Collapse
 
simo97 profile image
ADONIS SIMO • Edited

One more time, thanks a lot for this, it come at the RIGHT time as i am working on a such platform with Django, but i had to re-write the example to work in REST (DRF) context and React.js.

Now i am wondering, what type of subscription is good if i want to price my SaaS per user per month ?

I saw metered , fixed-price and per-set but i am not sure which one will be the right. i saw them here: stripe.com/docs/billing/subscripti...

Collapse
 
paqman85 profile image
Glenn Paquette

Amazing Corey! This is just such an amazing post. :)

Collapse
 
heyfirst profile image
First Kanisorn Sutham

Thanks for sharing Cory!

Collapse
 
techt01ia profile image
Techtolia

If you are looking the latest solution of Stripe subscription integration in ASP.NET, check out the demo >>> techtolia.com/StripeSubscriptions/