Building a Microservices-powered Application around Kontent.ai
Everyone wants to get in on the microservices game. From CMS’s to chat bots, it seems as if the “deconstruct-everything-and-rebuild-it-with-smaller-systems” mantra is taking the development world by storm, with no looking back. Because there are so many definitions for this architecture, I thought I’d give you a deep-dive into my personal site to see how I’ve leveraged Kontent.ai, Alexa, and a whole mess of Azure services to build my application using microservices.
Bryan SoltisUpdated on May 9, 2023Published on Aug 30, 2017
Want to see something fun? Go do a search for “what are microservices." Pretty amazing, huh? There’s no shortage of explanations and examples. That’s not really all that surprising when you look at the architecture as a whole. It’s all about building a larger application from several smaller components. There are so many combinations, integrations, and methodologies that naturally, you’re going to get a lot of different examples.
I’m not going to pretend to be the end all, be all of “microservices experts”. What I can share with you is my personal implementation of this architecture within my own site. It’s been an interesting journey, and one that has involved a lot of different services and systems.
If you’ve followed my blog, you may know some of this already. I’ve also highlighted several aspects of the architecture in a number of Voltron-centric presentations I’ve done lately. People seem interested in the topic and site, so I decided to make a blog to explain things a little more.
So, let me tell you how it all began….
In the beginning
About a year ago, I started on my microservices expedition. I didn’t have a personal site (domain yes, site no), so it was a simple choice to start from scratch. That meant that right from the start, I was going to focus on minimalism and simplicity. As a .NET developer, this meant .NET Core. By starting with the .NET Core MVC platform, I knew I would only be including the functionality I would need, without any of the overhead in the full .NET framework.
With a foundation decided, I was ready to start architecting my solution. By leveraging the Kontent.ai stack, I would be able to manage my content in a single location and serve it to multiple channels. Seeing how that ability is one of the major perks of a microservices architecture, I was already off to a good start.
Deciding what the app would do
Next up, I had to start thinking of what functionality I wanted to add. This is definitely a question everyone will have a different answer to, but for me, it came down to the following:
- Display content
- Host in Azure App Services
- Simplify development/deployment
- Leverage Azure Search for searching content
- Leverage Azure Functions to provide integrations
- Set myself up for new integrations / cool stuff
In the end, the list wasn’t all that daunting. Every site serves content in some way or the other. Because I would be using Kontent.ai on the backend for the content, this meant I could leverage the Delivery API in any platform I wanted. This opened a ton of doors when it came to integration and flexibility by being able to leverage the same content across all the channels.
Choosing the services
At the heart of every great microservice-powered app are the services themselves. Selected for their best-of-breed capabilities and flexibility, a good microservice will provide you with only the functionality you need, when you need it. Because I’m such a fan of Azure, I knew I wanted to leverage as much of the platform as possible for my site. Here’s how my functionality mapping played out.
As you can see, I have a lot of different components that make up the functionality. From foundation-centric pieces like Azure for hosting and Git for source control, to integration-level services like Azure Functions and Azure Search, there’s an elegant dance of technology going on. From far above this looks pretty complex, but in the end, I’m using specific services for each piece of the puzzle. This allows me to isolate functionality quickly and choose the best solution for each part.
Adding the wow
Once I had my components in place, I could really start doing some awesome stuff. Because I had microservices all along the development process, I had a ton of opportunities to take advantage of their unique integrations.
For my deployments, I leveraged Bitbucket because of their free repository plan. Because Azure App Services has built-in integration, this means that whenever I commit any changes to my repository, it kicks off a deployment of the latest code to my site. This simplified my life in that I didn’t have to worry about deploying my code anymore. I could rely on my microservices to work together to handle the copying and building of the application. Because I have separate branches for development and production, I could test all my changes in a preview environment before deploying to my live site.
Possibly the coolest of all the integrations is Azure Search. I wanted to use this cloud-based service to provide fast, intuitive search for my site. Using Kontent.ai’s webhook support, I created an Azure Function to update my Azure Search index any time content changes. Then, I leveraged the Azure Search SDK within my site to get great search results for my events and blogs.
Note: You can find more about integrating Azure Cognitive Search with Kontent.ai in a detailed blog post.
Azure Functions proved to be a great service to leverage for some Alexa integration I wanted to add. I created an Alexa skill to tell me my upcoming events and presentations. Using an Http Trigger Azure Function, I added code to access Kontent.ai to retrieve my upcoming speaking engagements, then pass it back to Alexa. With this integration in place, I could talk to Alexa and find out where I’m supposed to be for my next event. You can find out more about integrating with Alexa here.
Another cool integration I added was an Azure Bot Service. I created a QnA bot that could answer FAQs about me. I populated the bot’s knowledgebase with my FAQ page, a process that only required pointing the bot to the URL and it imported the questions and answers automatically. You can talk to my not-so-smart bot here.
The big picture
Ok, so I’ve spent a while covering a lot of different aspects of my site and how microservices play into the functionality. I know there’s a lot of pieces and you may be wondering how it all fits together. As part of the presentations I’ve mentioned, I created a diagram of how everything is connected. As you can see, all roads lead back to Kontent.ai. This makes it the brains behind the operation and a great place to store all my content.
The coolest thing about developing with microservices is that it’s always changing. Because each piece of functionality is isolated to a specific service, features can be updated independently and the entire application becomes much more fluid. This also means that if I find a better service for a specific feature, I can swap that out relatively easily without rewriting the entire site. There are several areas I’m considering for future development.
- Enhanced bot support
- Mobile-app integration
- Automated testing
- Deeper personalization
I hope this blog has given you some insight into how you can leverage microservices within your applications. Maybe you only use them for a specific capability, or you architect them throughout your project. Either way, you should be seriously considering how these services can expand your development and abilities in every project you create. Good luck!
You can view my complete personal site here. Also make sure to join our Discord server where you can discuss your project with our community.