How are we using Launchpad to build Launchpad Docs

Back in October when we first introduced Launchpad Developer Preview, we put together a very simple documentation page for users. After seeing how people were interacting with the product we realized we needed a more robust structure.

We pushed tons of improvements but still one of the challenges for every documentation is how easy people can find the content they are looking for. That's why we decided to use Launchpad's powerful search capabilities. On this tutorial, you'll understand step by step how we solved this problem.

 

 

1. Creating a datastore in the cloud

First thing you need to do is go to liferay.io and access your account. Once you get to the dashboard, click on "Create App" (which is called "Docs" on this case) and "Create Service" (which is called "Search" on this case). Now, that we defined a namespace (/docs/search), it's time to actually create this microservice using the API Builder.

We can start with a name and description that will help other team members to maintain this API in the future. Then, we can toggle the "Data" switcher which will turn this simple endpoint into a powerful NoSQL datastore.

If you don't have an account yet, just request an invite at liferay.io

 

 

2. Indexing the content

Even though our product is not open source, we wanted a very simple way for people to contribute to the documentation. That's why we decided to write everything in markdown and manage it on a public GitHub repository.

Now you might be wondering, how do we index this type of content? Well, that's the easy part.

The cool thing about Launchpad is that everything is a microservice, so we just make a HTTP POST request to that API endpoint we created earlier.

In our case, we also wrote a 5-line NodeJS script that go through these markdown files and structure them on a JSON object before sending it to Launchpad. But you can literally structure your data in whatever format you like.

 

 

3. Fetching the content

Once we have our content stored in the cloud, we need a way to fetch it too.

Fortunately, we can use the API Builder again, but this time we'll create a HTTP GET method to the same endpoint.

You can even check if your API is really working by using the API Explorer

 

 

4. Showing it in your app

We configured our datastore, we indexed our content, and we created an API to get this content. All this in like 5 minutes. Now it comes the fun part: coding!

Another cool thing about Launchpad is the API Client it provides. In our case, we want to create a search autocomplete with JavaScript so we'll just use the JavaScript API Client.

And remember, Launchpad is all about REST APIs. There are many many ways we could fetch this data, feel free to use any programming language you prefer.

If you have any questions, please leave a comment. I hope this article can help you understand the power of Launchpad. Next time you need a search engine, remember that Launchpad can help you :)

Blogs
liferay.io is still running over http, please add https support for that.
Thanks