Giter Club home page Giter Club logo

platformplatform's Introduction

PlatformPlatform Resource Groups

PlatformPlatform GitHub issues with enhancement label GitHub issues with roadmap label GitHub issues with bug label

Coverage Quality Gate Status Security Rating Reliability Rating Maintainability Rating

Code Smells Vulnerabilities Bugs Technical Debt

๐Ÿ‘‹ Welcome to PlatformPlatform

Craft top-tier B2B & B2C SaaS products with sleek design, fully accessible, clean architecture, automated and fast DevOps, top-notch security, and a premier developer experience. All in one place โ€“ at zero cost.

Easily start with one command. Answer a few questions and sit back while your product is launched on a custom domain with SSL, full CI/CD workflows, staging & production environments. All for less than $2 daily per cluster.

It's still early days, but you'll soon be ready to use PlatformPlatform. Follow our always up-to-date roadmap, with features like SSO, Usage Tracking, Audit Logs, Multi-Region, Health Checks, Localization, Feature Flags, and more.

Show your support for our project โ€“ star us on GitHub! Thank you for the love! โญ

Inside Our Monorepo: A Quick Overview

PlatformPlatform is a monorepo containing all application code, infrastructure, tools, libraries, documentation, etc. A monorepo is a powerful way to organize a codebase, used by Google, Facebook, Uber, Microsoft, etc.

.
โ”œโ”€โ”€ .github                # GitHub workflows for CI/CD, etc.
โ”œโ”€โ”€ application            # Contains the application source code
โ”‚   โ”œโ”€โ”€ AppHost            # .NET Aspire Project for starting API, WebApp, SQL Server, etc.
โ”‚   โ”œโ”€โ”€ account-management # A self-contained system with SaaS features (DDD, CQRS, Clean Architecture)
โ”‚   โ”‚   โ”œโ”€โ”€ Api            # Presentation layer exposing the API to WebApp or other clients
โ”‚   โ”‚   โ”œโ”€โ”€ Application    # Use Case layer containing CQRS Command and Query handlers 
โ”‚   โ”‚   โ”œโ”€โ”€ Domain         # Business logic containing DDD aggregates, entities, etc.
โ”‚   โ”‚   โ”œโ”€โ”€ Infrastructure # Integrations for accessing external resources (e.g., database)
โ”‚   โ”‚   โ”œโ”€โ”€ Tests          # Tests for the API, Application, Domain, and Infrastructure
โ”‚   โ”‚   โ””โ”€โ”€ WebApp         # React SPA frontend using TypeScript and React Aria Components
โ”‚   โ”œโ”€โ”€ shared-kernel      # Reusable components for all self-contained systems
โ”‚   โ”œโ”€โ”€ [saas-scs]         # [Your SCS] Create your SaaS product as a self-contained system
โ”‚   โ””โ”€โ”€ [sysops]           # [Planned] A self-contained system for operations and support
โ”œโ”€โ”€ cloud-infrastructure   # Contains Bash and Bicep scripts (IaC) for Azure resources
โ”‚   โ”œโ”€โ”€ cluster            # Scale units like production-west-eu, production-east-us, etc.
โ”‚   โ”œโ”€โ”€ environment        # Shared resources like App Insights for all Production clusters
โ”‚   โ”œโ”€โ”€ shared             # Azure Container Registry shared between all environments
โ”‚   โ””โ”€โ”€ modules            # Reusable Bicep modules like Container App, SQL Server, etc.
โ””โ”€โ”€ development-cli        # A .NET CLI tool for automating common developer tasks

** A Self-Contained System is a large microservice (or a small monolith) that contains the full stack, including frontend, background jobs, etc. These can be developed, tested, deployed, and scaled in isolation.

Getting Started

Setting up Developer Environment with one command

For development you just need .NET, Aspire, Docker, Node, and Yarn. See prerequisites for Mac and Windows.

Then fork or clone this repository, install the PlatformPlatform Developer CLI called pp by running this command:

cd developer-cli
dotnet run install # IMPORTANT: Restart the terminal and run "pp --help" to confirm installation

This will also set up your localhost with a SSL certificate for debugging, and a few environment variables.

When running the CLI, it will automatically detect changes and recompile, ensuring that it is always up to date. This makes it a powerful way to build and share tools for your team.

Run the following command to spin up the .NET Minimal API, the React frontend, and an SQL Server in Docker:

pp run # The Aspire Dashboard and WebApp will automatically open in your browser when ready

To debug, just open the PlatformPlatform.sln solution in Rider or Visual Studio and run the AppHost project.

Setting up CI/CD with passwordless deployments from GitHub to Azure in minutes

Run this command to automate Azure Subscription configuration and set up GitHub Workflows for deploying Azure Infrastructure (using Bicep) and compiling application code to Docker images deployed to Azure Container Apps:

pp configure-continuous-deployments # Tip: Add --verbose-logging to show the used CLI commands

You need to be the owner of the GitHub repository and the Azure Subscription, plus have permissions to create Service Principals and Active Directory Groups. You also need to have the GitHub CLI and the Azure CLI installed.

The command will first prompt you to login to Azure and GitHub, and collect information. You will be presented with a complete list of changes before they are applied. It will look something like this:

Configure Continuous Deployments

Except for adding a DNS record, everything is fully automated. After successful setup, the command will provide simple instructions on how to configure branch policies, Sonar Cloud static code analysis, and more.

The infrastructure is configured with auto-scaling and hosting costs in focus. It will cost less than 2 USD per day for a cluster, and it will allow scaling to millions of users ๐ŸŽ‰

Installing Prerequisites

Windows

Open a PowerShell terminal as Administrator and run the following commands:

  • wsl --install (Windows Subsystem for Linux, required for Docker)
  • Install Chocolatey
  • choco install dotnet-sdk git docker-desktop nodejs azure-cli gh
  • npm install --global yarn
  • dotnet workload update and dotnet workload install aspire

Mac

Open a terminal and run the following commands:

  • Install Homebrew.
  • brew install --cask dotnet-sdk
  • brew install git docker node yarn azure-cli gh
  • dotnet workload update and dotnet workload install aspire

Application Architecture

.NET 8 Backend With Clean Architecture, DDD, CQRS, Minimal API, and Aspire

The backend is built using the most popular, mature, and commonly used technologies in the .NET ecosystem:

Read more about the backend architecture
  • Clean Architecture: The codebase is organized into layers that promote separation of concerns and maintainability.
  • Domain-Driven Design (DDD): DDD principles are applied to ensure a clear and expressive domain model.
  • Command Query Responsibility Segregation (CQRS): This clearly separates read (query) and write (command) operations, adhering to the single responsibility principle (each action is in a separate command).
  • Screaming architecture: The architecture is designed with namespaces (folders) per feature, making the concepts easily visible and expressive, rather than organizing the code by types like models and repositories.
  • MediatR pipelines: MediatR pipeline behaviors are used to ensure consistent handling of cross-cutting concerns like validation, unit of work, and handling of domain events.
  • Strongly Typed IDs: The codebase uses strongly typed IDs, which are a combination of the entity type and the entity ID. This is even at the outer API layer, and Swagger translates this to the underlying contract. This ensures type safety and consistency across the codebase.
  • JetBrains Code style and Cleanup: JetBrains Rider/ReSharper is used for code style and automatic cleanup (configured in .editorconfig), ensuring consistent code formatting. No need to discuss tabs vs. spaces anymore; Invalid formatting breaks the build.
  • Monolith prepared for self-contained systems: The codebase is organized into a monolith, but the architecture is prepared for splitting in to self-contained systems. A self-contained system is a large microservice (or a small monolith) that contains the full stack including frontend, background jobs, etc. These can be developed, tested, deployed, and scaled in isolation, making it a good compromise between a large monolith and many small microservices. Unlike the popular backend-for-frontend (BFF) style with one shared frontend, this allows teams to work fully independently.
  • Shared Kernel: The codebase uses a shared kernel for all the boilerplate code required to build a clean codebase. The shared kernel ensures consistency between self-contained systems, e.g., enforcing tenant isolation, auditing, tracking, implementation of tactical DDD patterns like aggregate, entities, repository base, ID generation, etc.

Although some features like authentication and multi-tenancy are not yet implemented, the current implementation serves as a solid foundation for building business logic without unnecessary boilerplate.

React Frontend With TypeScript, React Aria Components, and Node

The frontend is built with these technologies:

Cloud Architecture

Azure Cloud Infrastructure With Enterprise-Grade Security and Zero Secrets

PlatformPlatform's cloud infrastructure is built using the latest Azure Platform as a Service (PaaS) technologies:

Read more about this enterprise-grade architecture
  • Platform as a Service (PaaS) technologies: Azure is the leading Cloud Service Provider (CSP) when it comes to PaaS technologies. PlatformPlatform uses PaaS technologies which are fully managed by Microsoft, as opposed to Infrastructure as a Service (IaaS) technologies where the customer is responsible for the underlying infrastructure. This means that Microsoft is responsible for the availability of the infrastructure, and you are only responsible for the application and data. This makes it possible for even a small team to run a highly scalable, stable, and secure solution.
  • Enterprise-grade security with zero secrets:
    • Managed Identities: No secrets are used when Container Apps connect to e.g. Databases, Blob Storage, and Service Bus. The infrastructure uses Managed Identities for all communication with Azure resources, eliminating the need for secrets.
    • Federated credentials: Deployment from GitHub to Azure is done using federated credentials, establishing a trust between the GitHub repository and Azure subscription based on the repository's URL, without the need for secrets.
    • No secrets expires: Since no secrets are used, there is no need to rotate secrets, and no risk of secrets expiring.
    • 100% Security Score: The current infrastructure configuration follows best practices, and the current setup code achieves a 100% Security Score in Microsoft Defender for Cloud. This minimizes the attack surface and protects against even sophisticated attacks.
  • Automatic certificate management: The infrastructure is configured to automatically request and renew SSL certificates from Let's Encrypt, eliminating the need for manual certificate management.
  • Multiple environments: The setup includes different environments like Development, Staging, and Production, deployed into clearly named resource groups within a single Azure Subscription.
  • Multi-region: Spinning up a cluster in a new region is a matter of adding one extra deployment job to the GitHub workflow. This allows customers to select a region where their data is close to the user and local data protection laws like GDPR, CCPA, etc. are followed.
  • Azure Container Apps: The application is hosted using Azure Container Apps, which is a new service from Azure that provides a fully managed Kubernetes environment for running containerized applications. You don't need to be a Kubernetes expert to run your application in a scalable and secure environment.
  • Scaling from zero to millions of users: The Azure Container App Environment is configured to scale from zero to millions of users, and the infrastructure is configured to scale automatically based on load. This means the starting costs are very low, and the solution can scale to millions of users without any manual intervention. This enables having Development and Staging environments running with very low costs.
  • Azure SQL: The database is hosted using Azure SQL Database, which is a fully managed SQL Server instance. SQL Server is known for its high performance, stability, scalability, and security. The server will easily handle millions of users with single-digit millisecond response times.

GitHub SDLC for Passwordless Deploying Application and Infrastructure in Minutes

PlatformPlatform is built on a solid foundation for a modern software development lifecycle (SDLC):

Screenshots

This is how it looks when GitHub workflows has deployed Azure Infrastructure:

GitHub Environments

These are the resource groups created when deploying one staging cluster, and two production clusters:

PlatformPlatform Resource Groups

This is the security score after deploying PlatformPlatform resources to Azure. Achieving a 100% security score in Azure Defender for Cloud without exemptions is not trivial.

Azure Security Recommendations

platformplatform's People

Contributors

martinrl avatar mstypsan avatar platformplatformadmin avatar raix avatar tjementum avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.