Sela
Technical Architecture

Technology Stack

A modern, scalable architecture built on proven technologies and best practices, designed for performance, security, and maintainability. Flexible implementation options to match your infrastructure preferences.

Implementation Options

Option A: Next.js Full-Stack

Unified framework with server-side rendering and API routes

Recommended for Azure deployment with Turborepo monorepo

Next.js 14+

React framework with SSR, routing, and API routes

React 19

Modern UI with concurrent features and server components

TypeScript

Type-safe development across frontend and backend

Tailwind CSS 4

Utility-first styling with CSS-in-JS

Option B: Express + Vite (Current)

Separated concerns with dedicated frontend and backend

Faster development, better separation of concerns, type-safe APIs with tRPC

Express.js

Fast, unopinionated web framework for Node.js

Vite + React 19

Lightning-fast build tool with HMR

tRPC

End-to-end type-safe APIs without code generation

Tailwind CSS 4

Utility-first styling with modern features

Cloud-Native Architecture on Azure

The Sela Estimation Platform leverages Azure cloud infrastructure with a scalable, microservices-ready architecture. The system supports both Next.js full-stack and Express+Vite separated approaches, ensuring flexibility for your deployment preferences while maintaining enterprise-grade security and performance.

Core Technology Stack

Frontend

React 19

Modern UI framework with concurrent features

TypeScript

Type-safe development and better tooling

Tailwind CSS 4

Utility-first styling for rapid development

Recharts

Composable charting library for data visualization

Framer Motion

Production-ready animation library

Backend & API

Node.js 22

High-performance JavaScript runtime

Next.js API Routes / Express

RESTful APIs or tRPC for type-safe calls

SuperApp Authentication

Delegated auth with token validation

Drizzle ORM

Type-safe database queries and migrations

Database & Caching

PostgreSQL

Primary relational database for structured data

Redis

Caching, rate limiting, and job queue management

Vector Database

Document embeddings for semantic search (RAG)

Azure Blob Storage

Document storage (PDF, DOCX, Excel, images)

AI & ML Services

OpenAI GPT-4

Advanced LLM for estimation and natural language

Anthropic Claude

Document understanding and analysis

OCR Service

Text extraction from uploaded documents

RAG Architecture

Conversational agent with document context

External Integrations

Google Maps/Places

Location intelligence and geographic cost factors

Deep Web Search API

Market rates and competitor pricing data

SuperApp API

User authentication and session management

OCR Document Intelligence

Multi-format document processing

Infrastructure (Azure)

Azure VMs

Hosting Next.js/Express application

Azure Blob Storage

Document storage and generated reports

Azure Database for PostgreSQL

Managed database service

Azure Redis Cache

Managed Redis for caching and queues

System Architecture

1

Presentation Layer

User interface and client-side logic

React SPAResponsive DesignReal-time UpdatesProgressive Enhancement
2

API Gateway

Request routing, authentication, and rate limiting

Next.js API Routes / tRPCSuperApp AuthRedis Rate LimitingAPI Versioning
3

Business Logic

Core estimation algorithms and workflow orchestration

AI Estimation EngineDocument ProcessingProject ComparisonReport Generation
4

Data Layer

Persistent storage and data management

PostgreSQL DatabaseAzure Blob StorageRedis CacheVector Database
5

Integration Layer

External services and data sources

Google Maps APIOCR ServiceDeep Web SearchAI Services (OpenAI/Anthropic)

Application Source Structure

Turborepo Monorepo (Option A)

Organized package structure with shared libraries

apps/web - Next.js application (frontend + API routes)
apps/processing - Background job service for document processing
packages/ui - Shared React components and design system
packages/database - Database schemas, migrations, and client
packages/types - Shared TypeScript types and interfaces
packages/utils - Common utility functions and helpers

Single Repository (Option B - Current)

Simplified structure with clear separation

client/ - React frontend with Vite build
server/ - Express backend with tRPC routers
drizzle/ - Database schemas and migrations
shared/ - Shared types and constants
storage/ - S3/Blob storage helpers

Environment Strategy

Development

Local development with hot reload and debugging

Shared Azure resources, local Redis, test database

Staging

Pre-production testing environment

Isolated Azure VMs, dedicated PostgreSQL, Redis cache

Production

Live environment with full monitoring

Scaled Azure VMs, managed PostgreSQL, Redis cluster, CDN

Performance Metrics

<200ms

Response Time

Average API response time

99.9%

Uptime

Service availability guarantee

1000+

Concurrent Users

Simultaneous active users supported

500+

Document Processing

Documents processed per hour

Security & Access Control

SuperApp Authentication

Token-based auth with session management and user context propagation

Data Encryption

TLS for data in transit, encryption at rest for database and blob storage

Redis Rate Limiting

API endpoint protection and AI service cost management

Access Control

Role-based permissions for sensitive financial estimates

Scalability & Azure Infrastructure

The platform architecture is designed to scale horizontally on Azure, supporting growth from tens to thousands of users without performance degradation. Key scalability features include:

  • Azure VMs with auto-scaling adjust compute resources based on demand
  • Managed PostgreSQL with read replicas for high-availability
  • Redis caching minimizes database load and accelerates response times
  • Azure Blob Storage with CDN for global document delivery
  • Background job processing with Redis queues for document OCR and AI tasks