Software as a service, or Saas, requires the application to be built with portability and resilience when porting itself as a web service. The application can vary from functions to forms but they can share some same design principles to become modern web-based services.
12-Factor manifesto was first published in 2011 and widely adopted by many applications. Note that the factors introduced don't necessarily to be applied all at once.
Below table show all factors:
|I||Codebase||One codebase tracked in revision control, many deploys||Pull all code in Git or SVN or HG, etc.|
|II||Dependencies||Explicitly declare and isolate dependencies||Write all software dependencies in a file such as |
|III||Config||Store config in the environment||Read config in the form like |
|IV||Backing services||Treat backing services as attached resources||Read service reference in the config, such as |
|V||Build, release, run||Strictly separate build and run stages||Turning the code into a package (build) somewhere first, and then install the package (release) in production|
|VI||Processes||Execute the app as one or more stateless processes||Make sure the application can run standalone on every server|
|VII||Port binding||Export services via port binding||Expose your service in the form like |
|VIII||Concurrency||Scale-out via the process model||Run application in a set of different types, such as |
|IX||Disposability||Maximize robustness with fast startup and graceful shutdown||Start and shut down quickly|
|X||Dev/prod parity||Keep development, staging, and production as similar as possible||Use vagrant or docker to diminish the difference among different environments|
|XI||Logs||Treat logs as event streams||Write logs and errors into stdin and stderr|
|XII||Admin processes||Run admin/management tasks as one-off processes||Provide CLI for application|
12-Factor methodology describes how to turn your application into a robust, reliable and least-astonishment web service. Some of the rules are absorbed in web frameworks or online platforms. Although some cause debates, it has spread widely. Choose the factors you like when porting your application as service!