简体   繁体   中英

how should I architecture an API and front app in Google App Engine?

I'm developing my first node.js app deploying to GAE.

It'll be organized as an API service and a front-end web app developed with Next.js

I'm looking at this architecture, and, although I have the app separated in two repositories I could have one merged repo to create two different microservices:

https://medium.com/this-dot-labs/node-js-microservices-on-google-app-engine-b1193497fb4b

For me, it seems overwork creating a new repo to merge them and deploy (doesn't it break one of the basic ideas of microservices to make isolated deploys?)

I have to discourage this because we need SEO in some of the parts, and We should use Next.js (or similar):

https://cloud.google.com/storage/docs/hosting-static-website

Another idea I've been working on is... create different GAE projects for front and API to deploy independently. For me, it seems like the best option, but I would like to know your opinion as GAE experts.

Which one should I use?

Thanks!

GAE doesn't care how is the code to be deployed into the services mapped to one or more VCS repositories (or no repositories at all). That's entirely up to you.

With a single repository you may encounter difficulties deploying from CI/CD pipelines - for example unnecessary deployments to one service when only the other one is changed.

Many examples out there focus on applications rather than services, but those are nothing more than the default services of those applications. Personally I like keeping the code for different services in separate directories, see the image captured in Can a default service/module in a Google App Engine app be a sibling of a non-default one in terms of folder structure? (it's no longer present on the updated documentation page). This also allows for easy mapping to multiple, separate VCS repositories

As for multiple projects vs multiple services, this might be of help: Advantages of implementing CI/CD environments at GAE project/app level vs service/module level?

The static website link you mentioned isn't part of GAE, it's part of GCS - a different GCP product. It's fine to use by itself - for a static website, but it might be difficult/impossible to:

  • communicate between a service running on it and one running on GAE - if you need that
  • make the 2 services appear as one (for example serve under the same custom domain name)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM