How to add user interface design in microservice architecture - vue.js

I'm building small vue.js microservice application and I have few doubts. Firstly I'm using mongoDB as my database, and I'm using express. After I want to use Docker and Kubernetes to deploy the application.
I want to use 5 microservices:
Basic publishing and product catalog
Commenting inside the post
Products can be added to cart
Paying the certain products after the cart
User authentification (login and register)
So the problem is how to add user interface design if the microservices which I want to use are backend based. How to exactly add the frontend if it can't be part of microservices. Or maybe should I use React and implement HTML/CSS things inside javascript code? Is it even possible because I want to use just MongoDB for every database needed in a microservice and write every microservice in Vue?

It's always upto you what you are good and requirement.
There is no specific best practice with microservices to follow certain languages together, people use the different languages in microservice like Ruby, Node, with React as front or one Python service managing the user auth.
It's depends on you what you are good with and familiar with.
You can create the Python app as a user interface or react or HTML which call backend services over API calls or grpc.
There is one example in the Istio repo : https://github.com/istio/istio/tree/master/samples/bookinfo
It's a book info app in Node, Ruby, Python using databases like MySQL, MongoDB etc.
https://cloud.google.com/service-mesh/docs/deploy-bookinfo
Update :
For Vue base, this blog and repo might be helpful vue-microfrontend
https://itnext.io/setup-a-micro-frontend-architecture-with-vue-and-single-spa-2c89528bf72f
Repo : https://github.com/vue-microfrontends

Related

Can I use NextJs API routes to handle both web and mobile app?

I want to create web app in Nextjs and in the future mobile app in React Native. But I am confused what api to use. Do you think that the Nextjs api can handle both web and mobile apps? Is this possible and is it good idea at all? Should I use PHP backend for that? Thank you very much.
With the assumption that you are talking about API Routes :
I would ask you that you think through the scale of your web and app. If this is a simple web/app that you do not expect to grow much - The NextJS API which is similar to standing up an nodejs express server is not a bad option.
Remember a few considerations when designing this API
You may have to distinguish the request origin (web/app)
CORS may have to be customized - Next exposes this
You could set an app specific route to ensure isolation or use headers to distinguish behavior if your application bifurcates in the future.
These concerns are shared even if you made a PHP, ExpresJS or any other API middleware.
Once you are past all this, i would ask you to consider
Using a GraphQL server like Apollo that works nicely with Next and is custom built for this purpose..
Evaluating API Gateways for security and scale.
You don't use any external tools at all.
Next JS has serverless model. So, you don't need to mess with BE.
You can create a number of API routes you want. in /pages/api folder. You can even split like /pages/api/desktop and
/pages/api/mobile folders.
You connect your database (MongDB, sql etc) via /middleware/your_file.js. Here is example for MongoDB
If you like, you can even add some security (ex: Auth0, next-auth
etc) to secure your API routes created in /pages/api folder. Example for Auth0
After, you can access you data througth API calls. Very good!

Sharing user login between Blazor WebServer and ASP.NET Core API

I am building a service-oriented system for personal use (plus few friends may have limited access as well) - the aim is to have a dashboard for controlling my apps running on various machines such as Raspberry Pis (and potentially to be expanded to a VPS or few in future).
The architecture itself is pretty simple. For authentication I want to use AWS Cognito. Services would communicate with WebAPI (and potentially with eachother) using gRPC within a VPN, and dashboard would be served by Blazor server-side (may move to Blazor WASM Hosted model if I find a need for it). Each of the processes may or may not be on the same machine as any other (depending on the purpose). Blazor server may or may not run within VPN (I might want to move it to a separate web hosting later).
I created a simple diagram to visualize it:
The problem comes with authentication. I want to have Blazor server-side and API as a separate processes (for now they're going to run on the same machine, but I may want to move it elsewhere eventually). Ideally authentication should be handled by API, so authentication is client-agnostic, and the API can use it to verify if the logged in user can perform an action - which by itself is simple.
However, I want Blazor server to use and validate that token as well in order to determine what to display to the user. I want to do with the least amount of calls possible - ideally avoiding querying API for every 'should I display it or not?' choice.
I could easily do it by sacrificing possibility to move API elsewhere, and just merge Blazor Server and API Gateway into one project. For my current purpose it would be enough, but it's not an ideal solution, so first I want to look into how could I achieve my original vision.
How could I achieve this (with minimal amount of Blazor server to API queries)?
I was googling for solution a lot, but so far only found either examples of using Blazor server and API as one project, or using client-side calls to API directly.
Thank you good folks in advance.

Is it possible to consume Odoo inventory via the Web Service API?

Is it possible for an external application to update inventory items tracked within Odoo and mark them as shipped to a specific customer?
If so, what's the best way to do that? Via the XML-RPC web service API? Is there a REST API?
The XML-RPC web API seems to imply that this is possible, but it doesn't list the database entities upon which the API is allowed to act. Can this API act on any DB entity?
Thanks in advance for your time.
From what I've seen, there isn't a standing RESTful API for Odoo. There is an API for communicating with Odoo which can be found here. As well as tutorials on how to implement these features here.
If you are in need of a RESTful API then I would provision your own server and have it act as a reverse proxy which communicates through the RESTful model. This way you could dynamically connect multiple clients to multiple DB instances from one point. If you're comfortable with nodejs here is an npm module which just makes HTTP posts to the database with Remote Procedure Calls which have been JSON-ified. This combined with express would offer you a quick solution for an Odoo RESTful API.
That module, however, doesn't seem extensively maintained but the logic is relatively easy to follow and you could fabricate your own quickly.
You can try with the XML-RPC API of the object stock.quant
You will have to provide the location_id and request the product_id and quantity.

Does Openshift Origin 1.1 REST API allow to create new applications based on templates?

We are developing a custom console to manage development environments. We have several application templates preloaded in openshift, and whenever a developer wants to create a new environment, we would need to tell openshift (via REST API) to create a new application based on one of those templates (oc new-app template).
I can't find anything in the REST API specification. Is there any alternative way to do this?
Thanks
There is no single API that today creates all of that in one go. The reason is that the create flow is intended to span multiple disjoint API servers (today, Kube and OpenShift resources can be created at once, and in the future, individual Kube extensions). We wanted to preserve the possibility that a client was authenticated to each individual API group. However, it makes it harder to write easy clients like this, so it is something we plan on adding.
Today the flow from the CLI and WebUI is:
Fetch the template
Invoke the POST /processedtemplates endpoint
For each "object" returned invoke the right create call.

Zend - Creating an PHP API for a mobile application

I'm currently planning the creation of a mobile application for ios and android.
The application will permit to the end-user to manage and see the progress of its projects. (Web creation company).
The application will have:
Project management (multiple)
View progress
View tasks
View hours
View files
View messages
Login/Logout form + Profile/Edit Profile section
Send/Reply Messages
Add comment on tasks and files
The question is: What is the best way to create an API (Restful or something else) using the Zend Framework?
This API must and will be integrated to a custom-made Projects Management System and a MySQL DB.
I just working on PHP API (no matter if API is for mobile platforms or another webs) and after realizing between SOAP and REST I chose a RESTful API and I can recommend it...
Zend Framework has components for both of mentioned approaches, but REST is easier and more understandable in comp. with SOAP...
The one thing what you have to think about is logging, you can use HTTP Auth or OAuth (HTTP autentification is easier), but better approach according to me is generate unique API KEY for your users (each user should have own KEY) and this KEY ensure you can recognize user and a security risk is minimal because user do not have to send login and password inside HTTP request (security risk) and in case of KEY is catched on WIFI or infrastructure, hacker do not get user logins to web application, only for API where propably will not be all features what main web app offer.
And if you set some time expiration for you KEYs or IP restriction for KEY, than you can make it more safe:)
Some tip for the end: Implement API as new separated ZF module.
One of the best stuffs I have noticed so far is http://getfrapi.com/
It makes use of everything from Zend to Pear. May be you should checkout the video http://www.youtube.com/watch?v=vJVQi7ZFSaQ