An Amazing Boilerplate for your next SaaS item, written in Django

An Amazing Boilerplate for your next SaaS item, written in Django

While building our past item, it was needed to compose a backend to deal with standard SaaS elements like clients, memberships, plans, accounts, and so forth. Since we shut down, we chose to open source the SaaS backend for anybody to utilize.

This article makes sense of the information base composition for any conventional djangosaas boilerplate and the codebase for regular APIs, for example,

  • Login
  • Information exchange
  • Reset Password
  • Data about a welcomed client to pre-fill information exchange structure
  • Welcome colleague
  • Me

Data set models for SaaS.

To monitor every one of the different enrolled organizations and the plans that those organizations are bought into, we want a blueprint that seems to be this.

Each enrolled business could likewise have various clients utilizing that record.

Initially utilized this composition to fabricate a portable application meeting recording device we needed to sell as a SaaS and planned our construction along these lines.


To store data about the various types of plans that the SaaS offers. It would help if you offered a free arrangement with limited capacities and at least one paid plan with extra usefulness.

Past this, this model could have more fields contingent on the utilization case. With regards to Session Fox, we offered plans given the number of meeting accounts and number of utilizations, so the extra fields in the Plan model for Session Fox were

  • Max accounts
  • Max applications


Addresses an arrangement membership by a business. It will like this contains a reference to the business and plan. It can be utilized to check if an active membership is present for a given business and, assuming this is the case, which plans the business bought into.

It can likewise be utilized to recharge, overhaul or deactivate a membership given the arrangement span expiry, notable credits for a specific business, and so on.

Begin time and End time address one pattern of an arrangement. For example, if an arrangement spans 15 days, and the membership started on the fifteenth of August, begin time would be the fifteenth of August, and the end time would be the thirtieth of August.

An occasional undertaking will recover all memberships where the end time has elapsed. Given the bought-in plan, this errand will choose whether to recharge the arrangement or deactivate the membership. For running occasional undertakings, we use a time loop.

New Businesses Sign-up

When another business joins, a membership is naturally made with an accessible arrangement. Since most of the new information exchanges were beta clients, we wanted a method for updating those clients to a limitless arrangement. To do this, we made a passage in the arrangement model called limitless arrangement where max accounts and max applications was a vast number and changed their relating membership model section to reference the limitless arrangement.

You can likewise utilize this model to store data that resets when another arrangement cycle begins. For example, once the business reached the maximum recording limit in Session Fox, we needed to keep any other accounts from that business. So we kept a field called current keep included in this model. This field is increased at whatever point another meeting recording is made. When it arrives at the highest furthest reaches of the comparing plan, the recording API will return a reaction suitably.

Since we were running an occasional errand to refresh the membership's beginning time and end season, we utilized a similar undertaking to reset the momentum recording count so that the following arrangement cycle begins from nothing.


Any extra fields that are well defined for a business can be placed in this model. For the client to call the APIs, an API_KEY would be given, and this field can be set in the action plan.

Business Team Member

Since we have all models expected to follow SaaS memberships for a business, we want a model to monitor every one of the clients that are getting to the item. These clients could be

  • Different colleagues from a similar business
  • Bots

Whether or not the client is a bot or a colleague from the business, we want a method for characterizing what consents a specific client will group. Regarding API calls should be made to the server by the SDK and the dashboard. To do this, the SDK would be given an entrance token, yet this entrance token shouldn't group consent to get to the dashboard APIs.

Django makes things more straightforward; this is the way

  • Joined with Django-rest-system, API creation turns out to be exceptionally unimportant
  • Simple to oversee verification and consents utilizing auth token.

The above information base models can be converted into Django models like this.

Overseeing clients and consent

The Business Team Member model addresses a solitary client. Anyway, there is a compelling reason to expressly fields for username and secret phrase. Instead, we can utilize Django clients. This Model given by Django abstracts the client confirmation framework, and it naturally stores passwords as hashes. The client can likewise be enacted or deactivated by utilizing the dynamic field. Thus the Business Team Member model can essentially contain a foreign key to the Django client model.


Utilizing the Django rest structure, each Django client made in the framework can be relegated an entrance token. Assuming this entrance token is available in the header of an API call, Django-rest-system naturally questions the client to which this token has a place and connects it to the API demand.

Check the comment section below for additional information, share what you know, or ask a question about this article by leaving a comment below. And, to quickly find answers to your questions, use our search Search engine.

Note: Some of the information in samples on this website may have been impersonated or spoofed.
Was this article helpful?  +
Share this with others:

Comments, Questions, Answers, or Reviews

There are no comments as yet, please leave one below or revisit.

To protect your privacy, please remove sensitive or identifiable information from your comments, questions, or reviews. We will use your IP address to display your approximate location to other users when you make a post. That location is not enough to find you.

Your post will be set as anonymous because you are not signed in. An anonymous post cannot be edited or deleted, therefore, review it carefully before posting. Sign-in.

Write Your Comment, Question, Answer, or Review

An Amazing Boilerplate for your next SaaS item, written in Django