Architecture of Web App and API

This project should not be considered a web framework. It is a starter toolkit that provides a set of working examples to handle some of the common challenges for developing SaaS using Golang. Coding is a discovery process and with that, it leaves you in control of your project’s architecture and development.

Software-as-a-Service (SaaS) product offerings generally provide a web-based service using a subscription model. They typically provide at least two main components: a REST API and a web application. Since this project is a complete starter kit for building SasS with GoLang, it provides two example services:

  • Web App - Responsive web application to provide service to clients. Includes user signup and user authentication for direct client interaction via their web browsers.
  • Web API - REST API with JWT authentication that renders results as JSON. This allows clients and other third-party companies to develop deep integrations with the project.

The example project for bootstrapping you SaaS also provides these tools:

The SaaS Startup Kit groups code in three distinct directories:

  • Cmd - all application stuff (routes and http transport)
  • Internal - all business logic (compiler protections)
  • Platform - all foundation stuff (kit)

All business logic should be contained as a package inside the internal directory. This enables both the web app and web API to use the same API (Golang packages) with the only main difference between them is their response, HTML or JSON.

The web app service and the web api services are located in the Cmd directory. The web API and web app have similar functionality. While the web app is meant for humans to experience and requires a friendly UI, the web API is meant for customers or third-party partners of your SaaS to programmatically integrate. To help show the similarities and differences between the pages in the web app and similar endpoints in the web API, we have created this diagram below. Since it is very detailed, you can click on the image to see the larger version.

Standard Operating Procedures