1
0
mirror of https://github.com/raseels-repos/golang-saas-starter-kit.git synced 2025-08-08 22:36:41 +02:00
Go to file

SaaS Starter Kit

Copyright 2019, Geeks Accelerator twins@geeksaccelerator.com

Description

The SaaS Starter Kit is a set of libraries for building scalable software-as-a-service applications while preventing both misuse and fraud. The goal of this project is project is to provide a proven starting point for new projects that reduces the repetitive tasks in getting a new project launched to production that can easily be scaled and ready to onboard enterprise clients. It uses minimal dependencies, implements idiomatic code and follows Golang best practices.

Ultimately the hope is that this project is 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. Coding is a discovery process and with that, it leaves you in control of the developed.

Starting any new project there are five areas of expertise for an engineer. Based on our experience, a few core decisions were made that help you focus initially on writing the business logic. Micro level - Relies on Postgres to aid with the data semantics that define the data being captured and their relationships. Macro level - Uses POD architecture and design that provides the project foundation. Business logic - Defines an example Golang package that helps illustrate where value generating activities should reside and how the code will be delivered to clients. Deployment and Operations - Integrates with GitLab for CI/CD and AWS for serverless deployments with AWS Fargate.
Observability - Implements Datadog to power exposing metrics, logs and request tracing that ensure stable and responsive service for clients.

SaaS product offerings typically provide two main components: an API and a web application. Both facilitate delivering a valuable software based product to clients ideally from a single code base on a recurring basis delivered over the internet.

The example project is a complete starter-kit for building SasS with GoLang. It provides three example services:

  • Web API - REST API with JWT authentication that renders results as JSON. This allows clients to develop deep integrations with the project. 
    
  • Web App - Responsive web application with client signup and user authentication for direct client interaction. 
    
  • Schema - Tool for initializing of Postgres database and handles schema migration. 
    

It contains the following features:

  • Minimal web application using standard html/template package.
    
  • Auto-documented REST API.
    
  • Middleware integration.
    
  • Database support using Postgres.
    
  • CRUD based pattern.
    
  • Role-based access control (RBAC).
    
  • Account signup and user management.  
    
  • Distributed logging and tracing.
    
  • Testing patterns.
    
  • Use of Docker, Docker Compose, and Makefiles.
    
  • Vendoring dependencies with Modules, requires Go 1.12 or higher.
    
  • Continuous deployment pipeline. 
    
  • Serverless deployments.
  • CLI with boilerplate templates to reduce repetitive copy/pasting..

Local Installation

Docker is required to run this project on your local machine. This project uses multiple third-party services that will be hosted locally via docker.

  • Redis - key / value storage for sessions and other data. Used only as ephemeral storage.
    
  • Postgres - Transactional database to handle persistence of all data.
    
  • Datadog - Provides metrics, logging, and tracing.
    

An AWS account is required for deployment for the following dependencies:

  • Secret manager - Provides store for private key used for JWT.
    
  • S3 - Host static files on S3 with additional CDN support with CloudFront.
    
  • ECS Fargate - Serverless deployments of application. 
    
  • RDS - Cloud hosted version of Postgres. 
    
  • Route 53 - Management of DNS entries. 
    

Getting the project

You can use the traditional go get command to download this project into your configured GOPATH.

$ go get -u gitlab.com/geeks-accelerator/oss/saas-starter-kit

Go Modules

This project is using Go Module support for vendoring dependencies. We are using the tidy command to maintain the dependencies and make sure the project can create reproducible builds. This project assumes the source code will be inside your GOPATH within the traditional location.

cd $GOPATH/src/geeks-accelerator/oss/saas-starter-kit/example-project
GO111MODULE=on go mod tidy

It's recommended to use at least go 1.12 and enable go modules.

echo "export  GO111MODULE=on" >> ~/.bash_profile

Installing Docker

Docker is a critical component to managing and running this project.

https://docs.docker.com/install/

Running The Project

Refer to the Example Project Readme for additional details.

Join us on Gopher Slack

If you are having problems installing, troubles getting the project running or would like to contribute, join the channel #saas-starter-kit on Gopher Slack

Description
The SaaS Startup Kit is a set of libraries in Go and boilerplate Golang code for building scalable software-as-a-service (SaaS) applications.
Readme Apache-2.0 13 MiB
Languages
Go 80.2%
CSS 16.1%
SCSS 1.5%
Python 1.1%
JavaScript 0.5%
Other 0.6%