DEV Community

Dviejo
Dviejo

Posted on

3 1

Building SDKs for your SAAS

Building SDKs for your SAAS

I recently build a service, docxmerge, which does a merge from a Microsoft Word and JSON document and converts it to PDF.

The API is very simple, but in order to make easy for developers to integrate it in their applications, I chose to create a library for at least four languages, NodeJS, Dotnet, Java, and Python.

Yeah, it looks like we got a bit of work. This task can be either too easy or too embarrassing. But I had a benefit, which was to use Swagger for the API definition, so basically, I could generate all the boilerplate code and just do a class in every language and publish it to the corresponding registry.

With Swagger, all is based on the JSON generated in the backend in this case the next one:

https://api.docxmerge.com/api/swagger/v1/swagger.json

Having that JSON, the swagger codegen is able to generate the code to interact with your api in a typed way and with no effort at all. I generate that code with docker which is much cleaner:

docker run --rm --network=host -v ${PWD}/src/swagger:/local swaggerapi/swagger-codegen-cli:v2.3.1 generate -i ${SWAGGER_URL} -l typescript-node -o /local --additional-properties supportsES6=true

As a said, Swagger was the biggest advantage, as it was effort free and I didn't have to worry about paths, query strings, multipart requests, etc. And lucky me, I was able to generate it from C# annotations using this Swashbucle library , so didn't have to write that mega JSON ;)

I will do one post per language explaining how I built each library from the swagger-codegen to the publish.

This is the repository where I'm working:
https://github.com/Docxmerge/docxmerge-sdk

It's still in progress, and I'm still missing the Java one to be deployed because of the verification, but it works.

Hostinger image

Get n8n VPS hosting 3x cheaper than a cloud solution

Get fast, easy, secure n8n VPS hosting from $4.99/mo at Hostinger. Automate any workflow using a pre-installed n8n application and no-code customization.

Start now

Top comments (0)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more