Postman collection to Html documentation with GitLab ci/cd and life is beautiful

In every software organization, there has one most boring and the most frustrating part is to make proper documentation of API so that other developers who are directly working for UI design or development can easily access it. But no tools are perfect for proper documentation.

It's a bitter truth that people like me who are working for backend development most likely are lazy. We are always searching for shortcuts 😝. sleep and eating is our main priority for anything.

So in this story, I will tell you a story 😐

about a lazy man who found a solution for a boring part in web development.

hire me :3

1st of all I need to show my gratitude to thedevsaddam who made a library call docgen which make my life super easy 😍 I always wanted to make something like this.

What Docgen do?

If you are scroll this far that means you are interested to know about it.

As I said there is no easy solution for making proper documentation for the rest of API (at least I don't find any 😢)
where docgen is so simple and easy to build documentation anything you want like you can make documentation in markdown language.

yes yes swagger and postman collection is an option, but honestly watching tenet movies will be more worth learning this 😐 I don't understand why developers made things always a complicated way.

and the mighty postman documentation which is great but expensive for privatize the documentation. If you share someone the documentation you must have a pro subscription plan in postman.

that's why I always wanted to build something where you can input your JSON postman collection will generate nice-looking HTML documentation for you as you see in many pro websites that provide public rest API.

which is possible in docgen 😃

Ok got your point but why we need GitLab? 😕

Ok, bro, that's my new invention so are you interested to hear my invention?

Here comes my idea 😅

auto-build postman documentation

Yes, you guessed right 😄

You can use the benefit of the GitLab page for this documentation deployment.

what you have to do

  1. Make an empty repository in GitLab
  2. clone it to your local machine.
  3. add a .gitlab-ci.yml file in this folder
  4. add the code below in .gitlab-ci.yml file
add this in .gitlab-ci.yml file

5. export your postman API collection to this folder name should be collection.json but if you want your own collection name then rename it from 6 number line of .gitlab-ci.yml file.

6. That's it, commit repository now.

7. Go to the browser now and browse your GitLab repository and navigate to the ci/cd page. You will see the progress of GitLab ci/cd, it was auto start at the moment you commit. that's the magic of ci/cd 😄

when it finished you will see

GitLab ci/cd status

And you are done.

Now the final part. You maybe ask how may I find my documentation?

You can find your documentation by browsing this URL

http(s)://username.example.io/projectname

If your project inside the group then you can find it from

http(s)://groupname.example.io/projectname

Here is more about GitLab pages URL structure

gitlab page url structure

You can learn more about gitlab pages from here.

So why GitLab?

For great authentication system

I like GitLab because they provide pretty cool tools for DevOps and automation.

Also, GitLab provides authentication security even on pages.

Yes! you heard right 😃

you can deploy pages privately in GitLab where only you can browse the page if you are logged in.

also, you can access other group members to your private project. No third party will not access your page

Which is a very important share for document sharing. 😃

So Isn't it amazing? 😄

what you need to do just export the collection to that folder and commit it will build automatically and you cant share your team safely.

But wait a minute….

I just got in my mind an idea
what about I don't have to export it 😕

I can use postman development API and import my collection and build it in a certain time! 😕

then I don't have to bother about export it.
My life will be more comfortable by doing this, isn't it ?
I can save more extra time for watching anime or movies 😄

Do you think it's possible? comment below if you want to learn those tricks 😙

Happy coding 😊

Love to work with new technologies, explore new challenges and watch Movies & Anime