1

I have built a few stacks in my time as a self-taught full-stack developer, but I think there may be a hole in my knowledge that you can hopefully fill in for me. I have built a few stacks that all have a core architecture like this:

  • Backend in Go, interfacing with a Postgres database or doing some core logic
  • RESTful API server (also written in Go) serving over HTTPS that triggers database methods/backend logic
  • Frontend in JavaScript using ReactJS or some other framework. The front end makes calls to the API server (using fetch()) whenever data is needed/logic should be executed (on the backend).

I find that this is a pretty good, common architecture that can work in many different use cases. However, I am wondering if there is any other type of core architecture that differs from this. I have heard of GraphQL and I see how that is different than this traditional REST-like architecture, but I am wondering if there is some other type of architecture used to build web apps that does not revolve around a REST/SOAP/GraphQL API. I've heard of WebSockets, and I think that they fit into what I am asking about here, so how are they different from just calling JavaScript's fetch() to make calls to my REST API (or using a third-party library like axios.)?

5

The architecture of your application is whatever you decide it is. The alphabet soup you've mentioned in your question is just the ones that are more well-known. Each approach has its own features and advantages.

How websockets is different is that it's more "real-time." It's not uncommon to have a REST architecture that is supplemented by websockets to provide things like real-time dashboards, or the "this post has been edited, click here to reload" banner you sometimes see on Stack Exchange sites.

When you create a websocket, you open a two-way communication channel. This clearly differs from the other architectures you've mentioned, as those architectures are based on querying the endpoint to obtain some data. It's the difference between making a telephone call each time, and leaving the line open while you talk.

2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.