Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create an SaaS Application?

I don't know how else to say it so I'm just going to explain my ideal scenario and hopefully you can explain to me how to implement it...

I'm creating an application with the Zend Framework that will be hosted with DreamHost. The application will be hosted on its own domain (i.e. example-app.com). Basically, a user should be able to sign up, get their own domain sampleuser.example-app.com or example-app.com/sampleuser which points to, what looks like their own instance of the app, which is really a single instance serving up different content based on the url.

Eventually, I want my users to be able to create their own domain (like foobar.com) that points to sampleuser.example-app.com, such that visitors to foobar.com don't notice that the site is really being served up from example-app.com.

I don't know how to do most of that stuff. How does this process work? Do I need to do some funky stuff with Apache or can this be done with a third party host, like DreamHost?

Update: Thanks for the advice! I've decided to bite the bullet and upgrade my hosting plan to utilize wildcard subdomains. It's cheaper than I was expecting! I also found out about domain reseller programs, like opensrs.com, that have their own API. I think using one of these APIs will be the solution to my domain registration issue.

like image 382
Andrew Avatar asked Jun 16 '09 06:06

Andrew


People also ask

What makes an application SaaS?

Software as a service (or SaaS) is a way of delivering applications over the Internet—as a service. Instead of installing and maintaining software, you simply access it via the Internet, freeing yourself from complex software and hardware management.

What is SaaS application example?

Google's G Suite, also known as Google Workspace is a popular example of a SaaS. Google Apps consists of Gmail, Contacts, Calendar, Meet, Chat for communication, Drive for storage, Currents for employee management, Google Docs Suits for content creation, and education edition.

What programming language is used for SaaS?

Programming language (Python) While JavaScript and SQL are the most popular for general purposes, Python is a good choice for SaaS, as it is readable and flexible.


1 Answers

Subdomains are easy. In hosting environements, in most cases, apache is configured to catch all subdomain calls below the main domain. You just need to have a wildcard DNS defined, so *.example-app.com are pointed to IP of your server. Then your website should catch all calls to those subdomain names.

Other domains are hard. They need to be configured as virtual hosts in Apache - see http://httpd.apache.org/docs/1.3/vhosts/name-based.html - that means it will be difficult to automate that, especially in hosting environement - unless your host gives you some API to do just that (easy and more feasible scenario would be to have a distinctive IP assigned to your website, then you can catch all with your Apache - it's probably possible to configure using your hosting control panel or works out of the box - and then just point DNS servers to your IP).

Then, after you have configured your Apache to point all necessary calls to your website, you can differnetiate application partitions per subdomain in this way:

  • get the host header from HTTP request
  • have a database table containing all subdomain names you're serving
  • make a lookup to that database table to determine instance, or user, id and use it later for filtering data / or selecting a database, if you'll go with a "database per application instance" schema.

Good luck :)

like image 154
Michał Chaniewski Avatar answered Oct 04 '22 20:10

Michał Chaniewski