Architecture & System Design

Singular — Multi-Tenant CRM, ERP & AI Platform

A polyglot Nx monorepo combining a Java 25 / Spring Boot 4 modular monolith, zero-trust edge gateway, transactional outbox IAM, Python LangGraph + pgvector AI service, and a React 19 SSR portal.

System Architecture

Web (:3000)Gateway (:4004)Identity (:8080) • ERP (:8081) • AI (:5001)Postgres + pgvector • Kafka

Web Portal

:3000

SSR app, typed routes, data grids & Orval API client

Edge Gateway

:4004

Stateless RSA JWT check, CORS & /internal/** perimeter block

Identity IAM

:8080

OTP / Google OAuth, RSA token minting, refresh rotation & Outbox

ERP Monolith

:8081

Package-by-Feature CRM, tenant context & dynamic JPA views

AI Engine

:5001

LangGraph deal/lead agents, pgvector RAG & Kafka activity indexer

Core Platform

Starter

Shared RFC 9457 ProblemDetails, security & request-ID logging

Engineering Highlights

Stateless RSA Auth & Perimeter Filtering

  • Identity signs JWTs with an RSA private key; Gateway verifies them statelessly via Nimbus JWT Decoder.
  • Public /internal/** and /api/*/internal/** routes are explicitly denied at the Gateway edge.
  • Shared spring-core-platform standardizes all auth and domain errors as RFC 9457 ProblemDetails with requestId.
gateway/SecurityConfig.java
.requestMatchers("/auth/**", "/api/v1/identity/users/register").permitAll()
.requestMatchers("/api/*/internal/**", "/internal/**").denyAll()
.anyRequest().authenticated()

Tech Stack

Frontend

React 19TanStack Start (Nitro SSR)TanStack RouterTanStack Query v5TanStack Table v9TanStack FormZustandOrval (OpenAPI Codegen)Zod v4Tailwind CSS v4Shadcn UI

Backend & Edge

Java 25 (Virtual Threads)Spring Boot 4.1Spring Cloud GatewaySpring Security OAuth2Spring Data JPAFlywaySpringDoc OpenAPI

AI & Data

Python 3.12+FastAPILangGraphLangChainPostgreSQLpgvectorApache Kafka (KRaft)aiokafka

Monorepo & Tooling

Nx 24pnpm WorkspacesGradleuvBiomeDocker Compose