Five Architectures You Can Quickly Prototype on PaaS
Tags: productivity, webdev, beginners
Published: 2020-03-30 11:17:10

Sometimes, as an architect or developer, you want to try a new architecture or technical solution but just can't seem to find the time to install, configure, debug, and figure out an entirely new concept. Experimentation is a lot of work, project deadlines come first, and new tech is often one of your last priorities. 

However, Platform as a Service (PaaS) can help. One of the advantages of PaaS is the speed and simplicity of pre-configured deployments. You can scroll through a list of options, click a button or two, and have a reference architecture or sample project deployed, running, and ready for experimentation within minutes.

In this article, we'll review five of these architectures you can quickly try out using PaaS. Most all PaaS platforms support prototyping. For our examples, we’ll use Heroku and its “[one-click deploys](https://elements.heroku.com/buttons/)” and [Terraform](https://www.terraform.io/intro/index.html) scripts since they are easy to use. You’ll need a Heroku account to get started, though the basic free plan works for most of these examples (I'll note where you need more)

### 1. RESTful Apps Using the MEAN Stack

[The MEAN stack](https://en.wikipedia.org/wiki/MEAN_(solution_stack)) has become a cornerstone of modern web development. Consisting of [MongoDB](https://www.mongodb.com/), [Express.js](https://expressjs.com/), [AngularJS](https://angularjs.org/), and [Node.js](https://nodejs.org/en/), this stack is scalable and extensible. It is often the stack of choice for cloud-hosted apps. 
The MEAN stack is also a great place to start for beginners, as the technologies are popular with active communities who can provide help and support. As a bonus, you'll only need to know one language for both the client and server – JavaScript.

[Use this one-click deployment](https://devcenter.heroku.com/articles/mean-apps-restful-api) to deploy a simple “Contact List” app. This deployment:
* Creates a RESTful API service in Express and Node.js 
* Connects a MongoDB database to the API server
* Creates a rich web app using Angular 

Alternatively, from that same link, you can walk step-by-step through a tutorial to create and deploy the app yourself.

### 2. Asynchronous Web Workers
Long-running server requests can kill the performance and scalability of your app. The standard way to handle these issues is to use [asynchronous web workers to complete the task](https://devcenter.heroku.com/articles/background-jobs-queueing). Moving the long-running tasks to background workers frees up resources and keeps your app responsive. 

![Example architecture using background services for tasks](https://hackernoon.com/photos/nTMgodFHH4evRjSdNFNz3dacaM23-03232v0)
*Example architecture using background services for tasks*

One popular way to implement asynchronous web workers is with a queue. A queue takes work requests from the client, stores them, and guarantees hand-off to a pool of workers. [This reference architecture](https://devcenter.heroku.com/articles/asynchronous-web-worker-model-using-rabbitmq-in-java) implements this very design using Java, [Spring MVC](https://spring.io/guides/gs/serving-web-content/), [RabbitMQ](https://www.rabbitmq.com/), and [AMPQ](http://www.amqp.org/). 

To get started, you can easily [clone this project](https://github.com/heroku/devcenter-java-web-worker/) for your own experimentation. The project creates:

* Web - A Spring MVC app that receives web requests and queues them in RabbitMQ
* Worker - A standalone Java app using Spring AMPQ to read and process the messages from RabbitMQ

The reference architecture also includes a walk-through of the key classes in the project.

For another quick deploy example of queues, [check out this article on creating a queue with RSMQ and Reddis](https://dev.to/heroku/scale-your-apps-with-an-easy-message-queue-on-redis-4glp).

### 3. Reactive Integration with Salesforce
Salesforce is [ubiquitous in the tech community](https://www.forbes.com/sites/louiscolumbus/2019/06/22/salesforce-now-has-over-19-of-the-crm-market/#2c8849e3333a). Its tools and platform are used for a wide variety of purposes well-beyond basic CRM. Tying into the Salesforce ecosphere to watch or react to events is a common need.

[This reference architecture](https://github.com/heroku-examples/salesforce-streams-nodejs) takes advantage of Salesforce Platform Events and Change Data Capture to create an app that responds to Salesforce activity.

The app has a web-based UI and two server-side processes:

* stream-consumer.js – The Salesforce Streaming API consumer
* server.js – Serves the web app and API feed of account changes to the web browser

Here is the basic architecture of the deployment:

![](https://hackernoon.com/photos/nTMgodFHH4evRjSdNFNz3dacaM23-07d0329d)
*Overview of reactive integration with Salesforce*

This deployment takes a little more than just a single click, since Salesforce setup can be pretty involved. However, this sample app should give you a quick and easy way to understand and test Salesforce integration.

### 4. Event-Driven Microservices

If you’re an enterprise architect, you’ve probably heard of, and worked with, a microservices architecture. And while you might have used REST as your service communications layer in the past, [more and more projects are moving to an event-driven architecture](https://dev.to/heroku/best-practices-for-event-driven-microservice-architecture-2lh7). Event-driven is popular when:

* You have a large number of microservices that need to communicate asynchronously.
* You want your microservices to be decoupled, fungible, and independently maintained.
* You have one or more services that produce events that need to be processed by many services.
* You want to use a microservices communication pattern that is more decoupled than the typical HTTPS approach.

[With this reference architecture](https://devcenter.heroku.com/articles/event-driven-microservices-with-apache-kafka) you can deploy a full, working implementation of an event-driven Apache Kafka architecture consisting of a client, producers, consumers, and dashboards. You’ll need to do a little prep work on your environment first, but once it’s set up, you can deploy this entire sample project using just a one-click Terrascript. 

For a more detailed look at this reference architecture, [check out this article on stream processing](https://dev.to/heroku/how-stream-processing-makes-your-event-driven-architecture-even-better-5ehg).

*Note: You'll need a [standard plan](https://www.heroku.com/pricing) to deploy this reference architecture.

### 5. Private Multi-Cloud Communication

If you’re running an AWS service such as [Redshift](https://aws.amazon.com/redshift/) or RDS in an [Amazon VPC](https://aws.amazon.com/vpc/), you may be looking for a way to connect your app to those services over a private connection. This sample project implements private, multi-cloud communication so your app can communicate with your AWS services privately, without traversing the public internet.

This may be useful if you’re using an Amazon Redshift cluster to analyze data. You can connect the VPC to your application and securely transfer data from your Postgres database to the Redshift cluster for analysis. 

[This Terraform script](https://devcenter.heroku.com/articles/peering-aws-rds-aws-redshift-with-heroku) is easy to deploy and creates a simple implementation of private multi-cloud communication. When you run the script it: 
* Creates an Amazon VPC together with an Amazon Redshift Cluster
* Peers the [Heroku Private Space](https://www.heroku.com/private-spaces) and the VPC, and sets up the appropriate security groups
* Deploys a Redshift client application to Heroku that connects to the Redshift database

![](https://hackernoon.com/photos/nTMgodFHH4evRjSdNFNz3dacaM23-9bef32o7)
*Private multi-cloud communication*

The setup has a few steps, and you’ll need to be familiar with managing VPCs, but you’ll be up and running with a secure connection quickly. 

*Note: You'll need an [enterprise plan](https://www.heroku.com/enterprise) to deploy this example (in order to have a Heroku Private Space)

### Conclusion

PaaS offers not only ease of deployment and DevOps relief, but also a quick, efficient way to test out new architectures and technologies.