Architecture Overview
platformkit is a modular monolith framework for building SaaS applications using a LEGO-block approach. Every component is composable, reusable, and industry-agnostic.
Core Layers
┌─────────────────────────────────────────────┐
│ Platform Layer (complete-saas) │
│ Your application: config + module selection │
├─────────────────────────────────────────────┤
│ Module Layer (platform-modules) │
│ 30+ business modules: auth, billing, etc. │
├─────────────────────────────────────────────┤
│ Framework Layer (backend/kit) │
│ CRUD, entities, API, security, observability│
├─────────────────────────────────────────────┤
│ Infrastructure Layer │
│ PostgreSQL, Redis, NATS, Docker │
└─────────────────────────────────────────────┘
Key Design Principles
1. Interface-First Design
Every capability is defined as an interface before implementation. Cross-module communication happens through ports — never by importing another module directly.
// ports/user.go — cross-module contract
type UserService interface {
GetUser(ctx context.Context, id string) (*UserInfo, error)
}
2. Generic CRUD Services
Eliminate boilerplate with automatic API generation. Define an entity, get REST + MCP + admin UI for free:
type Product struct {
base.BaseEntity[Product] `gorm:"embedded"`
Name string `gorm:"type:varchar(255)" json:"name"`
Price int `gorm:"not null" json:"price"`
}
3. Module Composition
Modules are selected at startup via a builder pattern:
modules := platformmodules.NewModuleSet().
WithCoreVertical().
WithShopManagement().
WithContentManagement()
4. Event-Driven Architecture
Modules communicate asynchronously through NATS events:
eventBus.Publish(ctx, event.NewEvent(
"order.created", orderID, "shop_management",
map[string]any{"total": 99.99},
))
Directory Structure
| Directory | Purpose |
|---|---|
backend/kit/ | Framework: module system, CRUD, API, security |
platform/platform-modules/ | 30+ reusable business modules |
platform/platform-modules/ports/ | Cross-module interfaces |
complete-saas-monolith/ | Flagship monolith application |
complete-saas-microservices/ | Flagship microservices application |
frontend/kit/ | UI framework (Templ/HTMX) |
shared/kit/ | Cross-layer types and utilities |
tests/ | E2E flow framework |
What Makes It Different?
- True modularity: add or remove any module without breaking others
- Zero boilerplate: one entity definition → full API + admin UI
- AI-native: MCP integration makes every entity discoverable by LLMs
- Self-hosting first: single
docker compose updeployment