Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Building a modern SaaS in 2020

Building a modern SaaS in 2020

Building a modern Software as a Service platform brings a lot of interesting engineering challenges. During this talk, I’m going to share my team’s journey of building a SaaS from scratch in 2020. First, we are going to start with the technologies and the architecture we picked. Then, we’ll go over the interesting challenge of implementing multitenancy. And we'll see how we benchmarked three different options and picked one. And last but not least, we’ll explore how every startup can use open source technologies to build observability infrastructure. And how to run their SaaS in production.

Nikolay Stoitsev

November 07, 2020
Tweet

More Decks by Nikolay Stoitsev

Other Decks in Programming

Transcript

  1. Hexagonal Architecture Web Adapter Messaging Adapter Input Port Input Port

    Biz Logic Output Port Output Port Persistence Adapter Messaging
  2. Mono Repo Easily introduce and refactor global features Ease code

    sharing and reuse Simple dependency management Flexible team boundaries and code ownership Collaboration across teams Atomic commits across services
  3. Build System Bazel • Fast and incremental builds • One

    tool to build multiple languages • Extensible • Google, Pinterest, Uber, Stripe Buck • Fast and incremental builds • One tool to build multiple languages • Helps you better understand your dependencies • Facebook, Airbnb
  4. Multi-Project Builds in Gradle • One root project • One

    subproject for each service • One subproject for shared libs • https://docs.gradle.org/current/userguide/multi_project_builds.html
  5. Why Nexus? Can store and distribute Maven/Java, npm, Helm, Docker

    Widely adopted Single source of truth for every component Easy to work with
  6. Great for engineers • Each service is accessed via a

    single domain • Logs are easy to read • A lot of materials on how to learn it
  7. Configuring a service in Kubernetes • Deployment • Service •

    Config Map • Service Account • RBAC • Pod disruption budget • ....
  8. Helm • Abstraction over k8s that simplifies working with it

    • The building block in helm is called a helm chart • Help you define, install, and upgrade applications in k8s
  9. How to work with Helm • Search for “{technology} helm

    chart” • Download helm chart • Update values.yaml • $ helm install {release-name} {chart-name} --set {var}={val}
  10. Backend logging EFK - Elasticsearch, Fluentd, Kibana Pod Pod Pod

    Fluentd Fluentd Fluentd Elasticsearch Kibana
  11. Materialized path (1) Org (2) East (3) West (4) Sales

    (5) Front Desk (6) Sales (7) Front Desk ID Path Name 1 1/ Org 2 1/2/ East 3 1/3/ West 4 1/2/4 Sales East 5 1/2/5 Front Desk East 6 1/3/6 Sales West 7 1/3/7 Front Desk West
  12. Closure table (1) Org (2) East (3) West (4) Sales

    (5) Front Desk (6) Sales (7) Front Desk ID Name 1 Org 2 East 3 West 4 Sales East 5 Front Desk East 6 Sales West 7 Front Desk West Ancestor Descendant 1 2 1 3 1 4 1 5 1 6 1 7 2 4 2 5 3 6 3 7 4 Null
  13. Keeping hierarchy and data separated (1) Org (2) East (3)

    West (4) Sales (5) Front Desk (6) Sales (7) Front Desk • Each records get a tag - 1, 2, 3, etc. • Each tag points to a node in the tree • Tag hierarchy is loaded separately • Queries are decorated with OR statements to match by tag
  14. Language Architecture Repo Structure Builds Running in Production Java and

    Spring Boot Microservices Monorepo Gradle and Docker Kubernetes
  15. Language Architecture Repo Structure Builds Running in Production Observability Java

    and Spring Boot Microservices Monorepo Gradle and Docker Kubernetes EFK stack
  16. Language Architecture Repo Structure Builds Running in Production Observability Multitenancy

    Java and Spring Boot Microservices Monorepo Gradle and Docker Kubernetes EFK stack Separate hierarchy and data