TSQL.APP Technical Stack: Under the Hood 🔧

Core Architecture Overview

1. Server-Side Components

  • Microsoft SQL Server: The heart of the system

    • Stores all application logic
    • Manages data and business rules
    • Handles UI generation through stored procedures
    • Manages state and session data
    • Controls workflow and navigation
  • .NET Core Server: The bridge

    • Handles HTTP requests/responses
    • Manages authentication and authorization
    • Provides API endpoints
    • Facilitates real-time communication
    • Manages file operations

2. Client-Side Components

  • ReactJS Frontend: The presentation layer
    • Renders UI components dynamically
    • Manages client-side state
    • Handles user interactions
    • Provides responsive design
    • Implements modern UI/UX patterns

How It All Works Together

The Magic of Modal Generation

  1. Your T-SQL Code writes to a temporary table through UI stored procedures
  2. SQL Server processes this data and generates UI instructions
  3. .NET Core translates these instructions into JSON format
  4. React renders the appropriate components in the browser

Example Flow:

-- Your T-SQL code
EXEC sp_api_modal_text @text='Hello World';

-- Behind the scenes, this creates an entry in a temp table like:
-- #modalview (id, data)
-- data = {"elem": "Text", "text": "Hello World"}

-- The .NET layer converts this to React components
-- React renders: <ModalText>Hello World</ModalText>

Built-in System Components

  1. UI Element Library

    • 400+ stored procedures for UI generation
    • Each procedure maps to React components
    • Automatic state management
    • Built-in validation and error handling
  2. State Management System

    • Automatic synchronization between client and server
    • Session management
    • Temporary table-based state storage
    • Variable persistence across requests
  3. Security Layer

    • Role-based access control
    • SQL Server security integration
    • Token-based authentication
    • API security

Why This Architecture Works

  1. Unified Development

    • All business logic in one place (SQL Server)
    • No context switching between languages
    • Single source of truth for data and logic
  2. Performance

    • Minimal network traffic
    • Efficient data operations
    • Optimized UI rendering
    • Smart caching
  3. Scalability

    • SQL Server's proven scalability
    • Stateless application design
    • Microservices-ready architecture
    • Cloud-friendly deployment
  4. Enterprise Features

    • Built-in reporting
    • File handling
    • Task scheduling
    • API integration
    • Debugging tools

Real-World Example

-- This T-SQL code creates a complete customer form
DECLARE @CustomerName NVARCHAR(100);
DECLARE @SubmitButton NVARCHAR(100);

-- Create UI elements
EXEC sp_api_modal_text 
    @text='Enter Customer Details', 
    @class='h2';

EXEC sp_api_modal_input 
    @name='@CustomerName',
    @value=@CustomerName OUTPUT,
    @placeholder='Customer Name';

EXEC sp_api_modal_button 
    @name='@SubmitButton',
    @value='Save Customer',
    @valueout=@SubmitButton OUTPUT;

-- Handle form submission
IF @SubmitButton IS NOT NULL
BEGIN
    -- Business logic
    INSERT INTO Customers (Name)
    VALUES (@CustomerName);
    
    -- User feedback
    EXEC sp_api_toast 
        @text='Customer saved successfully!',
        @class='success';
END

This code automatically:

  1. Generates a responsive form
  2. Handles user input
  3. Processes data
  4. Provides feedback
  5. Manages state
  6. Ensures security

Key Benefits of This Architecture

  1. Simplicity

    • Single language development (T-SQL)
    • Automatic UI generation
    • Built-in state management
  2. Productivity

    • Rapid application development
    • Reduced coding complexity
    • Automatic CRUD operations
  3. Maintainability

    • Centralized business logic
    • Clear separation of concerns
    • Easy debugging and testing
  4. Security

    • SQL Server security model
    • Built-in input validation
    • Role-based access control

This architecture allows T-SQL developers to create complete enterprise solutions without needing to learn multiple languages or frameworks. The system handles all the complexity of modern web development while allowing developers to work exclusively in T-SQL.

The result is a powerful, scalable, and maintainable application architecture that leverages the best of SQL Server while providing modern web application capabilities.