In the Software as a Service (SaaS) distribution model, the
software belongs to the service provider and clients act as
tenants who pay to use the software. However, sparse documentation
and problem-specic solutions imply that building
a scalable, secure and congurable Software as a Service
is not an easy task. This paper describes a reusable approach
for implementing Single Database, Multitenant Software as
a Service from existing Web Applications by adding multitenancy
as an aspect of the Software. The approach uses
architectural components, design patterns and current mainstream
programming language functionality without requiring
extensive changes to the original Web application. We
used our approach to develop both a real-world use case,
built in Ruby on Rails, and a reference application, built in
Java, which is freely available.