Wealthview Architecture Blueprint

This blueprint defines the structural constraints and technology choices for the Wealthview platform. It is designed to ensure that RAG agents generate code that adheres to the project's strict modularity and security standards.

1. Technology Stack

LayerTechnology
FrontendReact 19, TypeScript, Vite, React Router, Recharts, Axios
BackendJava 21, Spring Boot 3.5, Spring Security (JWT), JPA/Hibernate
DatabasePostgreSQL 16 (UUID Primary Keys, Flyway migrations)
TestingJUnit 5, Mockito, Testcontainers (Postgres), Vitest

2. Backend Module Structure (Maven)

Wealthview follows a strict multi-module Maven architecture to enforce separation of concerns.

ModuleResponsibilityDependency Rules
wealthview-apiREST Controllers, Security Config, Exception HandlersDepends on wealthview-core
wealthview-coreServices, Business Logic, Domain DTOsDepends on wealthview-persistence
wealthview-persistenceJPA Entities, Repositories, Flyway MigrationsLeaf module (no internal deps)
wealthview-importCSV/OFX Parsers, Finnhub/Zillow ClientsDepends on wealthview-core
wealthview-projectionDeterministic & Monte Carlo EnginesDepends on wealthview-core
wealthview-appSpring Boot Main, Configs, PackagingDepends on all modules

Strict Modularity Rule

wealthview-api must never depend directly on wealthview-persistence. Controllers only interact with Services; Repositories are private to the persistence/core boundary.

3. Data Integrity and Security

Tenant Isolation

Every table (except global prices/tax data) contains a tenant_id: UUID foreign key. A Spring Security Filter injects the tenant_id from the JWT into the SecurityContext, which is then used by Hibernate's @Filter or Repository methods to enforce row-level isolation.

Entity ID Strategy

All primary keys are UUID (gen_random_uuid()). This prevents ID scanning and simplifies merging data from offline imports.

Holdings Recomputation

Holdings are never stored as primary truth. They are auto-computed by aggregating TransactionEntity rows.

4. RAG Implementation Hook

When building for Wealthview, the agent should follow this hierarchy:

  1. Define the JPA Entity in wealthview-persistence.
  2. Define the Service and DTO in wealthview-core.
  3. Define the REST Endpoint in wealthview-api.

Prompt Example:

"Following the WealthviewArchitectureBlueprint, add a new feature to track 'Private Equity' investments. Create the PrivateEquityEntity with UUID keys and tenant isolation, a service to calculate IRR, and a controller to expose the data."

See Also