'Using Google docs in a multi-tenant SaaS application
I am building a multitenant SaaS application for multipule companies to use. One of the features of the application is that it will create a document based from database data.
I could use a library to create a document in MS-word format and this would be downloaded to the users PC or stored in a database.
However, I love Google Docs and ideally the output would be a google doc.
My struggle is know how I would do this? Can I subscribe to google docs with my SaaS company and the my software creates the google doc in it's own account and this doc is then shared with the client? (i.e. all the docs are in my SaaS companies google drive.) Or can I get my SaaS app to hook in with the clients Google account and the document is created in their google account/drive? But then they would need a Google account and what happens if they dont have one?
I am looking for the best way to do this
Solution 1:[1]
UPDATE For access to docs and creating new doc: You can use the google drive api via the GCP sdk. Adding single sign on will give users access to their own drive and docs! Next you have two options for gcp single sign on. One will give users access to there own docs and drive. The other will let users get access to your app and it’s server. This second server side autho is used the most and is a little harder to set up. I would text both for your needs.
You can register your own authorization process with google for your app. Use the sdk., I use flask for this and set up single sign on. When a user of your app sign in they will see only there data. Docs: https://cloud.google.com/docs/authentication/end-user
For integration of your data across many saas apps see below.
So looks like after some research, there is a simple answer. Its called Cloud Data Fusion.
Cloud Data Fusion
Integrate
- "Ingest and integrate data from on-prem, SaaS, or cloud sources using pipelines."
So I have done this with the google doc REST api: https://developers.google.com/docs/api
In the docs you see your use case explained. The trick is there are a few ways to use the api. I would recommend playing with the QuickStart examples for the coding language of your Choice and sharing the code from a test example when you get stuck as a new question. I would love to help you get un-stuck in your next stage of development.
You will need to understand how to authenticate with a service account or let users authenticate with their own user accounts.
I would recommend learning to build your own REST apis for your data over your db data. This is because the right way to do what your doing should be using a cloud native, 12 factor apps approach. This is not easy!
You will find the google drive api is a better starting point for a demo. Also you will find it easyer to work with the google sheets api than google docs.
Lastly, JavaScript and google app scripts are really key to explore googles apis.Thus it may be easyer to start with reactjs as a FE and creating your own rest apis over you db of choose:)
Your big challenge will be choosing your approach for your dataflow, and picking up new skills that work with google cloud tech.
You should look in to a google cloud developers certification and use resource like udacity and Coursara. Both have course that walk you through all need training with example projects for you project.
I recommend you brake up your project into small parts. Build mini project with there own GitHub that are working dataflows with api integrations CRUDing your db in and out of each saas product using their api.
Then use a yaml file or dockerfile…depending on your final solitons technical requirements.
You will find you can run the final solution as one deployable “package” using yaml or dockerfile from a GitHub repo to the cloud or server of choose! This approach is called devOps ci/cd.
It takes years to master and you have a lot of chooses and testing before you can get it right.
Do study SRE it is googles way of doing devops…and really it’s better than amazons way of doing devops…as it focuses on Reliability as a feature of what you build and deploy. It also has a concept to monitor your learning curve for devops…I will stop here as I am still learning SRE myself:)
Gl
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 |