<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: samurai-techlead</title>
    <description>The latest articles on DEV Community by samurai-techlead (@samurai-techlead).</description>
    <link>https://dev.to/samurai-techlead</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1356596%2F8bd8ad69-7190-47b3-b651-fa876002ef80.png</url>
      <title>DEV Community: samurai-techlead</title>
      <link>https://dev.to/samurai-techlead</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/samurai-techlead"/>
    <language>en</language>
    <item>
      <title>Building a Secure E-Commerce Chat Agent with Stored Procedures</title>
      <dc:creator>samurai-techlead</dc:creator>
      <pubDate>Tue, 06 Jan 2026 14:58:56 +0000</pubDate>
      <link>https://dev.to/samurai-techlead/building-a-secure-e-commerce-chat-agent-with-stored-procedures-38g3</link>
      <guid>https://dev.to/samurai-techlead/building-a-secure-e-commerce-chat-agent-with-stored-procedures-38g3</guid>
      <description>&lt;h2&gt;
  
  
  Background
&lt;/h2&gt;

&lt;p&gt;Recently, I tried to build a &lt;strong&gt;GPT-like chat agent for a specific e-commerce platform&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Not a generic chatbot.&lt;br&gt;
Not a demo.&lt;/p&gt;

&lt;p&gt;A real product-facing agent that could answer questions like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;"Where is my order?"&lt;/li&gt;
&lt;li&gt;"Can I get a refund?"&lt;/li&gt;
&lt;li&gt;"Show me my last purchase"&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To do this, the agent had to &lt;strong&gt;access real production data&lt;/strong&gt; — orders, shipments, payments.&lt;/p&gt;

&lt;p&gt;That’s when I hit an important problem.&lt;/p&gt;


&lt;h2&gt;
  
  
  The Problem I Faced
&lt;/h2&gt;

&lt;p&gt;As soon as an agent needs database access, a tempting idea appears:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;“Why not just let the LLM generate SQL from the user’s question?”&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;It sounds simple.&lt;br&gt;
It works in demos.&lt;/p&gt;

&lt;p&gt;But in a real e-commerce system, it quickly becomes dangerous.&lt;/p&gt;


&lt;h2&gt;
  
  
  Scenario
&lt;/h2&gt;

&lt;p&gt;You are building a &lt;strong&gt;chat application for a specific e-commerce platform&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The chat agent supports:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Order status inquiries&lt;/li&gt;
&lt;li&gt;Shipping &amp;amp; delivery tracking&lt;/li&gt;
&lt;li&gt;Refund eligibility checks&lt;/li&gt;
&lt;li&gt;Purchase history summaries&lt;/li&gt;
&lt;li&gt;Account-related questions&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is &lt;strong&gt;not a general-purpose GPT&lt;/strong&gt;. It is a &lt;strong&gt;platform-bound assistant&lt;/strong&gt; with access to sensitive user data.&lt;/p&gt;


&lt;h2&gt;
  
  
  The Core Problem
&lt;/h2&gt;

&lt;p&gt;Chat agents often need database access.&lt;/p&gt;

&lt;p&gt;A common but dangerous approach is:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Share database schema with the LLM&lt;/li&gt;
&lt;li&gt;Ask the LLM to generate SQL from user input&lt;/li&gt;
&lt;li&gt;Execute that SQL directly&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This approach fails in production.&lt;/p&gt;


&lt;h2&gt;
  
  
  Why LLM-Generated SQL Is a Bad Idea
&lt;/h2&gt;
&lt;h3&gt;
  
  
  Security Risks
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Prompt injection can manipulate queries&lt;/li&gt;
&lt;li&gt;Over-broad &lt;code&gt;SELECT *&lt;/code&gt; queries expose sensitive data&lt;/li&gt;
&lt;li&gt;Privilege escalation becomes possible&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  Hallucinated Queries
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Non-existent tables or columns&lt;/li&gt;
&lt;li&gt;Incorrect joins&lt;/li&gt;
&lt;li&gt;Wrong business logic&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  No Governance
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;No clear contract of allowed queries&lt;/li&gt;
&lt;li&gt;Hard to audit data access&lt;/li&gt;
&lt;li&gt;Schema changes break prompts&lt;/li&gt;
&lt;/ul&gt;


&lt;h2&gt;
  
  
  Core Principle
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;LLMs should decide &lt;em&gt;what intent to fulfill&lt;/em&gt;, not &lt;em&gt;how to query data&lt;/em&gt;.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This is the same principle used in traditional backend systems.&lt;/p&gt;


&lt;h2&gt;
  
  
  The Right Architecture: Stored Procedures as Agent Tools
&lt;/h2&gt;
&lt;h3&gt;
  
  
  High-Level Flow
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5kks2peo8uf27bmfoipy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5kks2peo8uf27bmfoipy.png" alt=" " width="800" height="89"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Key Design Rules
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Database logic lives in stored procedures&lt;/li&gt;
&lt;li&gt;LLM never sees table names or columns&lt;/li&gt;
&lt;li&gt;Agent only chooses which procedure to call&lt;/li&gt;
&lt;/ul&gt;


&lt;h2&gt;
  
  
  Step 1: Define Stored Procedures (Database Layer)
&lt;/h2&gt;
&lt;h3&gt;
  
  
  Get the Latest Order
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="k"&gt;PROCEDURE&lt;/span&gt; &lt;span class="n"&gt;get_latest_order&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="k"&gt;IN&lt;/span&gt; &lt;span class="n"&gt;p_user_id&lt;/span&gt; &lt;span class="nb"&gt;BIGINT&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;BEGIN&lt;/span&gt;
  &lt;span class="k"&gt;SELECT&lt;/span&gt;
    &lt;span class="n"&gt;order_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;order_status&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;total_amount&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;created_at&lt;/span&gt;
  &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;orders&lt;/span&gt;
  &lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;user_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;p_user_id&lt;/span&gt;
  &lt;span class="k"&gt;ORDER&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="n"&gt;created_at&lt;/span&gt; &lt;span class="k"&gt;DESC&lt;/span&gt;
  &lt;span class="k"&gt;LIMIT&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;END&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;✔ Enforces user-level data isolation&lt;br&gt;
✔ No schema exposure to the agent&lt;/p&gt;


&lt;h3&gt;
  
  
  Get Shipping Status for an Order
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="k"&gt;PROCEDURE&lt;/span&gt; &lt;span class="n"&gt;get_order_shipping_status&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="k"&gt;IN&lt;/span&gt; &lt;span class="n"&gt;p_order_id&lt;/span&gt; &lt;span class="nb"&gt;BIGINT&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="k"&gt;IN&lt;/span&gt; &lt;span class="n"&gt;p_user_id&lt;/span&gt; &lt;span class="nb"&gt;BIGINT&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;BEGIN&lt;/span&gt;
  &lt;span class="k"&gt;SELECT&lt;/span&gt;
    &lt;span class="n"&gt;shipping_provider&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;tracking_number&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;shipping_status&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;estimated_delivery&lt;/span&gt;
  &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;shipments&lt;/span&gt;
  &lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;order_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;p_order_id&lt;/span&gt;
    &lt;span class="k"&gt;AND&lt;/span&gt; &lt;span class="n"&gt;user_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;p_user_id&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;END&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;✔ Ownership validation at DB level&lt;br&gt;
✔ Prevents cross-user access&lt;/p&gt;


&lt;h2&gt;
  
  
  Step 2: Expose Procedures as Agent Tools
&lt;/h2&gt;

&lt;p&gt;The LLM never sees SQL.&lt;/p&gt;

&lt;p&gt;It sees &lt;strong&gt;tools&lt;/strong&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"get_latest_order"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"description"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Get the most recent order for the authenticated user"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"parameters"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{}&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"get_order_shipping_status"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"description"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Get shipping details for a specific order"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"parameters"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"order_id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"number"&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;User identity is injected by the system — not the LLM.&lt;/p&gt;




&lt;h2&gt;
  
  
  Step 3: Agent Reasoning Flow
&lt;/h2&gt;

&lt;h3&gt;
  
  
  User Message
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"Where is my last order?"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Agent Behavior
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Identify intent: order inquiry&lt;/li&gt;
&lt;li&gt;No order ID provided&lt;/li&gt;
&lt;li&gt;Call &lt;code&gt;get_latest_order&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Use returned &lt;code&gt;order_id&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Call &lt;code&gt;get_order_shipping_status&lt;/code&gt;
&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  Step 4: User Response
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Your latest order was placed on March 2.

Status: Shipped
Carrier: Yamato
Tracking Number: 1234-5678
Estimated Delivery: March 6
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Advanced Example: Refund Eligibility
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Stored Procedure
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="k"&gt;PROCEDURE&lt;/span&gt; &lt;span class="n"&gt;check_refund_eligibility&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="k"&gt;IN&lt;/span&gt; &lt;span class="n"&gt;p_order_id&lt;/span&gt; &lt;span class="nb"&gt;BIGINT&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="k"&gt;IN&lt;/span&gt; &lt;span class="n"&gt;p_user_id&lt;/span&gt; &lt;span class="nb"&gt;BIGINT&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;BEGIN&lt;/span&gt;
  &lt;span class="k"&gt;SELECT&lt;/span&gt;
    &lt;span class="k"&gt;CASE&lt;/span&gt;
      &lt;span class="k"&gt;WHEN&lt;/span&gt; &lt;span class="n"&gt;order_status&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'DELIVERED'&lt;/span&gt;
       &lt;span class="k"&gt;AND&lt;/span&gt; &lt;span class="n"&gt;DATEDIFF&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;NOW&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt; &lt;span class="n"&gt;delivered_at&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="mi"&gt;7&lt;/span&gt;
      &lt;span class="k"&gt;THEN&lt;/span&gt; &lt;span class="s1"&gt;'ELIGIBLE'&lt;/span&gt;
      &lt;span class="k"&gt;ELSE&lt;/span&gt; &lt;span class="s1"&gt;'NOT_ELIGIBLE'&lt;/span&gt;
    &lt;span class="k"&gt;END&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;refund_status&lt;/span&gt;
  &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;orders&lt;/span&gt;
  &lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;order_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;p_order_id&lt;/span&gt;
    &lt;span class="k"&gt;AND&lt;/span&gt; &lt;span class="n"&gt;user_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;p_user_id&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;END&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Business rules stay &lt;strong&gt;out of prompts&lt;/strong&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why This Design Works
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Security by Default
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;No arbitrary SQL execution&lt;/li&gt;
&lt;li&gt;Strict access boundaries&lt;/li&gt;
&lt;li&gt;Minimal blast radius&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  No Hallucinations
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;LLM cannot invent tables or joins&lt;/li&gt;
&lt;li&gt;Only allowed operations are callable&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Strong Observability
&lt;/h3&gt;

&lt;p&gt;Each call can be logged:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;user_id=123
tool=check_refund_eligibility
order_id=88921
timestamp=...
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Stored Procedures vs LLM-Generated SQL
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Aspect&lt;/th&gt;
&lt;th&gt;LLM SQL&lt;/th&gt;
&lt;th&gt;Stored Procedures&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Security&lt;/td&gt;
&lt;td&gt;❌ Risky&lt;/td&gt;
&lt;td&gt;✅ Safe&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Hallucinations&lt;/td&gt;
&lt;td&gt;❌ Common&lt;/td&gt;
&lt;td&gt;✅ Impossible&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Auditing&lt;/td&gt;
&lt;td&gt;❌ Hard&lt;/td&gt;
&lt;td&gt;✅ Easy&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Schema changes&lt;/td&gt;
&lt;td&gt;❌ Break prompts&lt;/td&gt;
&lt;td&gt;✅ Isolated&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Enterprise-ready&lt;/td&gt;
&lt;td&gt;❌ No&lt;/td&gt;
&lt;td&gt;✅ Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  Final Thoughts
&lt;/h2&gt;

&lt;p&gt;Chat agents feel new — but backend fundamentals still apply.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Treat your database like a private API.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Stored procedures provide:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Safety&lt;/li&gt;
&lt;li&gt;Stability&lt;/li&gt;
&lt;li&gt;Observability&lt;/li&gt;
&lt;li&gt;Enterprise-grade control&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is how you build &lt;strong&gt;real, production-ready e-commerce chat agents&lt;/strong&gt; — not demos.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>agents</category>
      <category>sql</category>
      <category>llm</category>
    </item>
    <item>
      <title>How To build the secret chat app using MLS and ChatE2EE</title>
      <dc:creator>samurai-techlead</dc:creator>
      <pubDate>Tue, 06 Jan 2026 14:33:02 +0000</pubDate>
      <link>https://dev.to/samurai-techlead/how-to-build-the-secret-chat-app-using-mls-and-chate2ee-4j9c</link>
      <guid>https://dev.to/samurai-techlead/how-to-build-the-secret-chat-app-using-mls-and-chate2ee-4j9c</guid>
      <description>&lt;h1&gt;
  
  
  How To Build a Secret Chat App Using MLS and ChatE2EE
&lt;/h1&gt;

&lt;p&gt;&lt;em&gt;Designing a modern, end-to-end encrypted chat system for the web&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Building a &lt;strong&gt;secure chat application&lt;/strong&gt; in 2026 is no longer just about&lt;br&gt;
"encrypting messages."&lt;br&gt;
Users expect:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  Strong end-to-end encryption (E2EE)&lt;/li&gt;
&lt;li&gt;  Secure group messaging&lt;/li&gt;
&lt;li&gt;  Dynamic member management&lt;/li&gt;
&lt;li&gt;  Web-native performance&lt;/li&gt;
&lt;li&gt;  Cryptographic correctness without UX pain&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Traditional E2EE approaches don't scale well to groups.&lt;br&gt;
This is why &lt;strong&gt;Messaging Layer Security (MLS)&lt;/strong&gt; exists.&lt;/p&gt;

&lt;p&gt;This article explains how a &lt;strong&gt;secret chat app using MLS + ChatE2EE&lt;/strong&gt; was&lt;br&gt;
designed and implemented in practice.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why MLS Is Necessary
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Problems With Traditional Group Encryption
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;  Pairwise encryption between every member&lt;/li&gt;
&lt;li&gt;  O(n²) key management complexity&lt;/li&gt;
&lt;li&gt;  Expensive re-keying&lt;/li&gt;
&lt;li&gt;  High implementation risk&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  What MLS Solves
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;  Tree-based group key management&lt;/li&gt;
&lt;li&gt;  Efficient member add/remove/update&lt;/li&gt;
&lt;li&gt;  Forward secrecy &amp;amp; post-compromise security&lt;/li&gt;
&lt;li&gt;  Formally verified cryptographic design&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;MLS is to group chat what TLS is to the web.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Overall Architecture
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyoa9w2yu9zpmtq07k4q3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyoa9w2yu9zpmtq07k4q3.png" alt=" " width="800" height="211"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Technology Stack
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Frontend
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;  TypeScript&lt;/li&gt;
&lt;li&gt;  React&lt;/li&gt;
&lt;li&gt;  Context-based state management&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Cryptography
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;  OpenMLS&lt;/li&gt;
&lt;li&gt;  Messaging Layer Security (RFC 9420)&lt;/li&gt;
&lt;li&gt;  Rust → WebAssembly&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Storage
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;  IndexedDB (web_sys)&lt;/li&gt;
&lt;li&gt;  Hybrid memory + persistent cache&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Core Chat Foundation
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Chat Messaging Layer
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;  Message model&lt;/li&gt;
&lt;li&gt;  Conversation abstraction&lt;/li&gt;
&lt;li&gt;  Transport-agnostic pipeline&lt;/li&gt;
&lt;li&gt;  Deterministic ordering&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;MLS handles encryption only --- not UX or transport.&lt;/p&gt;

&lt;h3&gt;
  
  
  WASM + OpenMLS Integration
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;  Rust bindings for JavaScript&lt;/li&gt;
&lt;li&gt;  Minimal JS ↔ Rust surface&lt;/li&gt;
&lt;li&gt;  Deterministic APIs&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  MLS Client Architecture
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fld18u3eyhl1hzr4dbwox.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fld18u3eyhl1hzr4dbwox.png" alt=" " width="745" height="519"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Group Lifecycle
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;  Group creation&lt;/li&gt;
&lt;li&gt;  Welcome processing&lt;/li&gt;
&lt;li&gt;  Member addition&lt;/li&gt;
&lt;li&gt;  Secure state persistence&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  WASM Module Development
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Why WASM
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;  Browser-safe cryptography&lt;/li&gt;
&lt;li&gt;  Near-native performance&lt;/li&gt;
&lt;li&gt;  Rust memory safety&lt;/li&gt;
&lt;li&gt;  Reuse of OpenMLS&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Runtime Responsibilities
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;  Encryption / decryption&lt;/li&gt;
&lt;li&gt;  Group state transitions&lt;/li&gt;
&lt;li&gt;  KeyPackage generation&lt;/li&gt;
&lt;li&gt;  State serialization&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Secure Key Storage
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Hybrid Storage Strategy
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fz66b9waxhjtodbc8zalj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fz66b9waxhjtodbc8zalj.png" alt=" " width="800" height="497"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Benefits: - Fast access - Crash recovery - Stable MLS epochs&lt;/p&gt;




&lt;h2&gt;
  
  
  Frontend Integration
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Chat Context
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;  MLS initialization&lt;/li&gt;
&lt;li&gt;  State restoration&lt;/li&gt;
&lt;li&gt;  Message routing&lt;/li&gt;
&lt;li&gt;  UI consistency&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Message Flow
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fl8wti6fnfg9deyj4jj03.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fl8wti6fnfg9deyj4jj03.png" alt=" " width="724" height="487"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Security Guarantees
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;  End-to-end encryption&lt;/li&gt;
&lt;li&gt;  Forward secrecy&lt;/li&gt;
&lt;li&gt;  Post-compromise security&lt;/li&gt;
&lt;li&gt;  Secure group membership&lt;/li&gt;
&lt;li&gt;  Zero server plaintext&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Lessons Learned
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;  MLS is complex but scalable&lt;/li&gt;
&lt;li&gt;  Persistence bugs are catastrophic&lt;/li&gt;
&lt;li&gt;  Welcome handling must be perfect&lt;/li&gt;
&lt;li&gt;  Debugging encrypted state is hard&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Building a &lt;strong&gt;secret chat app using MLS and ChatE2EE&lt;/strong&gt; requires effort,&lt;br&gt;
but the result is a future-proof, standards-based, highly secure&lt;br&gt;
communication system.&lt;/p&gt;

&lt;p&gt;MLS is not experimental.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;MLS is production-ready.&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>mls</category>
      <category>e2ee</category>
      <category>webassembly</category>
      <category>security</category>
    </item>
    <item>
      <title>My Thoughts on Frontend Architecture &amp; Framework Choices for 2026</title>
      <dc:creator>samurai-techlead</dc:creator>
      <pubDate>Tue, 06 Jan 2026 13:57:24 +0000</pubDate>
      <link>https://dev.to/samurai-techlead/my-thoughts-on-frontend-architecture-framework-choices-for-2026-3k0f</link>
      <guid>https://dev.to/samurai-techlead/my-thoughts-on-frontend-architecture-framework-choices-for-2026-3k0f</guid>
      <description>&lt;h1&gt;
  
  
  My Thoughts on Frontend Architecture &amp;amp; Framework Choices for 2026
&lt;/h1&gt;

&lt;p&gt;Frontend development changes fast.&lt;br&gt;&lt;br&gt;
Every year there’s a “new best framework” or a “new architecture pattern” that promises to fix everything.&lt;/p&gt;

&lt;p&gt;So instead of saying “this is the only correct way”, I want to share my current thoughts and best practices for frontend architecture and framework choices going into 2026, based on what I actually see teams using successfully.&lt;/p&gt;

&lt;p&gt;This is not theory — it’s what works.&lt;/p&gt;


&lt;h2&gt;
  
  
  Why Frontend Architecture Matters More Than Frameworks
&lt;/h2&gt;

&lt;p&gt;Before talking about frameworks, I want to say this clearly:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;A bad architecture with a good framework is still a bad app.&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
&lt;strong&gt;A good architecture can survive framework changes.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Most frontend pain doesn’t come from React vs Vue vs Svelte —&lt;br&gt;&lt;br&gt;
it comes from:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;messy state management
&lt;/li&gt;
&lt;li&gt;unclear responsibilities
&lt;/li&gt;
&lt;li&gt;unscalable folder structures
&lt;/li&gt;
&lt;li&gt;tightly coupled UI and business logic
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So let’s start with architecture.&lt;/p&gt;


&lt;h2&gt;
  
  
  Frontend Architecture Best Practices (2026 Edition)
&lt;/h2&gt;
&lt;h3&gt;
  
  
  1. Component-Driven Architecture Is the Default
&lt;/h3&gt;

&lt;p&gt;In 2026, everything is component-driven.&lt;/p&gt;

&lt;p&gt;You don’t think in pages anymore — you think in:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;buttons
&lt;/li&gt;
&lt;li&gt;forms
&lt;/li&gt;
&lt;li&gt;cards
&lt;/li&gt;
&lt;li&gt;layouts
&lt;/li&gt;
&lt;li&gt;flows
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Each component should:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;do one thing
&lt;/li&gt;
&lt;li&gt;have clear inputs (props)
&lt;/li&gt;
&lt;li&gt;avoid hidden side effects
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If your components feel reusable and boring — you’re doing it right.&lt;/p&gt;


&lt;h3&gt;
  
  
  2. Feature-Based Folder Structure (Not Type-Based)
&lt;/h3&gt;

&lt;p&gt;This is one of the biggest improvements teams make.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Old style&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;components/
hooks/
services/
utils/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Feature-based&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;src/
 ├─ auth/
 │   ├─ login.page.tsx
 │   ├─ login.api.ts
 │   ├─ login.store.ts
 │   └─ login.styles.ts
 ├─ dashboard/
 └─ settings/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Why this works:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;related code lives together
&lt;/li&gt;
&lt;li&gt;easier to delete or refactor features
&lt;/li&gt;
&lt;li&gt;new developers understand the app faster
&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  3. Separate UI State, App State, and Server State
&lt;/h3&gt;

&lt;p&gt;This is a huge one.&lt;/p&gt;

&lt;p&gt;In modern frontend apps, not all state is the same.&lt;/p&gt;

&lt;p&gt;A clean mental model:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;UI state → local component state (modals, tabs)
&lt;/li&gt;
&lt;li&gt;App state → global client state (auth, theme)
&lt;/li&gt;
&lt;li&gt;Server state → data from APIs (cached, synced)
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In practice:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;UI state → component hooks
&lt;/li&gt;
&lt;li&gt;App state → Zustand / Redux / Pinia
&lt;/li&gt;
&lt;li&gt;Server state → React Query / SWR / TanStack Query
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When teams mix these together, things get painful fast.&lt;/p&gt;




&lt;h3&gt;
  
  
  4. Monorepo When the Product Gets Bigger
&lt;/h3&gt;

&lt;p&gt;If you have:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;multiple apps
&lt;/li&gt;
&lt;li&gt;shared UI components
&lt;/li&gt;
&lt;li&gt;shared business logic
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A monorepo becomes a big win.&lt;/p&gt;

&lt;p&gt;Common tools:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Turborepo
&lt;/li&gt;
&lt;li&gt;Nx
&lt;/li&gt;
&lt;li&gt;pnpm workspaces
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This helps with:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;code sharing
&lt;/li&gt;
&lt;li&gt;consistent tooling
&lt;/li&gt;
&lt;li&gt;version management
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For small apps, don’t overdo it.&lt;br&gt;&lt;br&gt;
For growing products, it’s worth it.&lt;/p&gt;




&lt;h3&gt;
  
  
  5. Design Systems Are No Longer Optional
&lt;/h3&gt;

&lt;p&gt;In 2026, serious products almost always have:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;design tokens
&lt;/li&gt;
&lt;li&gt;shared UI components
&lt;/li&gt;
&lt;li&gt;consistent spacing, colors, typography
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This doesn’t mean a huge system on day one —&lt;br&gt;&lt;br&gt;
but at least:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;reusable components
&lt;/li&gt;
&lt;li&gt;CSS variables
&lt;/li&gt;
&lt;li&gt;predictable styling rules
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Your frontend moves faster when design decisions are centralized.&lt;/p&gt;




&lt;h3&gt;
  
  
  6. Micro-Frontends (Use Carefully)
&lt;/h3&gt;

&lt;p&gt;Micro-frontends are not a default choice.&lt;/p&gt;

&lt;p&gt;They make sense when:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;many teams work independently
&lt;/li&gt;
&lt;li&gt;deployment independence is critical
&lt;/li&gt;
&lt;li&gt;the product is very large
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;They add complexity, so:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;don’t start with them
&lt;/li&gt;
&lt;li&gt;earn them when you actually need them
&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Recommended Frontend Frameworks in 2026
&lt;/h2&gt;

&lt;p&gt;Now let’s talk frameworks — not “which is best”, but which is best for what.&lt;/p&gt;




&lt;h3&gt;
  
  
  React + Next.js (Still the Safe Choice)
&lt;/h3&gt;

&lt;p&gt;React is still everywhere, and Next.js has become the default React platform.&lt;/p&gt;

&lt;p&gt;Why people still choose it:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;massive ecosystem
&lt;/li&gt;
&lt;li&gt;strong TypeScript support
&lt;/li&gt;
&lt;li&gt;SSR, SSG, edge, API routes
&lt;/li&gt;
&lt;li&gt;easy hiring
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you’re building:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;large products
&lt;/li&gt;
&lt;li&gt;SEO-critical apps
&lt;/li&gt;
&lt;li&gt;startups that may scale fast
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This stack is still a very solid choice.&lt;/p&gt;




&lt;h3&gt;
  
  
  Svelte + SvelteKit (Simple &amp;amp; Fast)
&lt;/h3&gt;

&lt;p&gt;Svelte feels refreshing.&lt;/p&gt;

&lt;p&gt;Why people like it:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;less boilerplate
&lt;/li&gt;
&lt;li&gt;very readable code
&lt;/li&gt;
&lt;li&gt;small bundles
&lt;/li&gt;
&lt;li&gt;fast performance
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It’s great for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;startups
&lt;/li&gt;
&lt;li&gt;MVPs
&lt;/li&gt;
&lt;li&gt;teams that value simplicity
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The ecosystem is smaller than React, but it’s growing steadily.&lt;/p&gt;




&lt;h3&gt;
  
  
  Solid.js (Performance-First)
&lt;/h3&gt;

&lt;p&gt;Solid is for people who really care about performance.&lt;/p&gt;

&lt;p&gt;Key ideas:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;fine-grained reactivity
&lt;/li&gt;
&lt;li&gt;no virtual DOM
&lt;/li&gt;
&lt;li&gt;extremely fast updates
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This shines in:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;dashboards
&lt;/li&gt;
&lt;li&gt;real-time UIs
&lt;/li&gt;
&lt;li&gt;performance-sensitive apps
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It’s not mainstream yet, but it’s respected.&lt;/p&gt;




&lt;h3&gt;
  
  
  Qwik (Next-Gen Thinking)
&lt;/h3&gt;

&lt;p&gt;Qwik introduces a different idea: resumability instead of hydration.&lt;/p&gt;

&lt;p&gt;Why it’s interesting:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;instant interactivity
&lt;/li&gt;
&lt;li&gt;amazing performance for large pages
&lt;/li&gt;
&lt;li&gt;great SEO story
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It requires a mindset shift, but it’s one of the most innovative frameworks right now.&lt;/p&gt;




&lt;h3&gt;
  
  
  Vue 3 + Nuxt (Balanced &amp;amp; Friendly)
&lt;/h3&gt;

&lt;p&gt;Vue continues to be:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;approachable
&lt;/li&gt;
&lt;li&gt;well-documented
&lt;/li&gt;
&lt;li&gt;enjoyable to write
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Nuxt adds:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;SSR
&lt;/li&gt;
&lt;li&gt;routing
&lt;/li&gt;
&lt;li&gt;full-stack capabilities
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Great choice for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;teams that value clarity
&lt;/li&gt;
&lt;li&gt;long-term maintainability
&lt;/li&gt;
&lt;li&gt;balanced performance
&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  Angular (Enterprise Stability)
&lt;/h3&gt;

&lt;p&gt;Angular is still strong in enterprise environments.&lt;/p&gt;

&lt;p&gt;Why teams choose it:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;opinionated structure
&lt;/li&gt;
&lt;li&gt;built-in patterns
&lt;/li&gt;
&lt;li&gt;TypeScript by default
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It’s heavier, but very stable for large organizations.&lt;/p&gt;




&lt;h2&gt;
  
  
  My Quick Recommendations by Use Case
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Large product / startup → React + Next.js
&lt;/li&gt;
&lt;li&gt;Simple, fast, modern apps → SvelteKit
&lt;/li&gt;
&lt;li&gt;Performance-critical UI → Solid
&lt;/li&gt;
&lt;li&gt;SEO &amp;amp; instant load → Qwik
&lt;/li&gt;
&lt;li&gt;Clean &amp;amp; readable codebases → Vue + Nuxt
&lt;/li&gt;
&lt;li&gt;Enterprise teams → Angular
&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Final Thoughts
&lt;/h2&gt;

&lt;p&gt;In 2026, frontend development is less about:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;“Which framework is best?”&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;And more about:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;“How clean is your architecture?”&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Frameworks will change.&lt;br&gt;&lt;br&gt;
Good architecture scales.&lt;/p&gt;

&lt;p&gt;If you focus on:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;clear responsibilities
&lt;/li&gt;
&lt;li&gt;predictable state
&lt;/li&gt;
&lt;li&gt;feature-based structure
&lt;/li&gt;
&lt;li&gt;simple components
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You’ll be in a good place — no matter which framework you choose.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>frontend</category>
      <category>architecture</category>
    </item>
    <item>
      <title>Custodial Wallet Based Web3 Game Development</title>
      <dc:creator>samurai-techlead</dc:creator>
      <pubDate>Tue, 24 Jun 2025 14:36:46 +0000</pubDate>
      <link>https://dev.to/samurai-techlead/custodial-wallet-based-web3-game-development-1l82</link>
      <guid>https://dev.to/samurai-techlead/custodial-wallet-based-web3-game-development-1l82</guid>
      <description>&lt;h2&gt;
  
  
  1. &lt;strong&gt;Introduction&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Web3 gaming is rapidly transforming the way we think about digital ownership, player interaction, and in-game economies. But as a game developer, you’re likely facing a challenge: how do you make these new technologies accessible to your players while still providing the immersive experience they expect?&lt;/p&gt;

&lt;p&gt;If you're new to the world of blockchain gaming, the term "wallet" probably comes up frequently. But when it comes to integrating wallets into your game, there's a key decision you'll need to make—custodial or non-custodial? And, for many developers, custodial wallets are quickly becoming the go-to option.&lt;/p&gt;

&lt;p&gt;In this article, we'll dive deep into why custodial wallets are an excellent choice for Web3 game development. You’ll learn what they are, how they fit into your game’s system architecture, and the significant advantages they offer for both developers and players. Whether you’re aiming to reduce friction for new players or looking for a scalable solution that fits your game's growth, this guide will provide everything you need to make an informed decision.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;2. What Are Custodial Wallets?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;In the world of Web3 gaming, a wallet is essential for managing in-game assets, such as tokens, NFTs, or any other form of digital ownership. But when we talk about wallets, there are two main types that developers need to consider: custodial and non-custodial.&lt;/p&gt;

&lt;p&gt;A custodial wallet is a type of digital wallet where a third-party service (such as a game developer or wallet provider) manages the private keys and security on behalf of the user. Essentially, the third party has control over the funds and assets stored in the wallet, but the user interacts with the wallet in a way that’s seamless and often much simpler than with non-custodial wallets.&lt;/p&gt;

&lt;p&gt;On the other hand, non-custodial wallets are wallets where the user has full control over their private keys and assets. This is a more decentralised approach, allowing players to manage their own funds without relying on a third-party service. While this offers greater control, it also requires players to have a higher level of knowledge and technical ability, which can be a significant barrier for those unfamiliar with blockchain or cryptocurrency.&lt;/p&gt;

&lt;p&gt;In a custodial wallet setup, players don't need to worry about managing private keys or understanding blockchain intricacies. The game itself acts as a custodian, making sure that assets are safe and easily accessible whenever the player needs them. This simplicity is one of the reasons custodial wallets are becoming so attractive in the Web3 gaming space.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;3. Why Choose a Custodial Wallet for Web3 Gaming?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;You may be wondering why custodial wallets are often the preferred choice for Web3 games, especially when compared to non-custodial options. The answer lies in the unique demands and challenges of the gaming world, where simplicity, speed, and user experience are paramount. Let’s take a look at some of the top reasons why custodial wallets are becoming the go-to solution for game developers and players alike.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Enhanced User Experience&lt;/strong&gt;&lt;br&gt;
One of the biggest hurdles for new players entering the world of Web3 gaming is the complexity of blockchain. Non-custodial wallets often require players to create and manage their own wallets, handle private keys, and understand the basics of cryptocurrency transactions. For most casual gamers, this can feel overwhelming and off-putting.&lt;/p&gt;

&lt;p&gt;With custodial wallets, the game developer takes care of all of this on the backend. Players simply create an account, and the game automatically manages their digital assets in the background. This simplified approach makes Web3 games much more accessible to players who might otherwise shy away from anything that requires blockchain knowledge. The end result? A smoother and more enjoyable gaming experience for players at all levels of expertise.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Lower Entry Barriers for New Players&lt;/strong&gt;&lt;br&gt;
The steep learning curve of Web3 can prevent casual gamers from diving in. Most players are accustomed to logging in and playing without worrying about the technical side of things. With custodial wallets, players don’t have to bother with creating wallets, remembering seed phrases, or worrying about private key security. Instead, they can jump right into the game and start playing, removing a significant barrier to entry.&lt;/p&gt;

&lt;p&gt;This is particularly important for games looking to appeal to the wider gaming community rather than just blockchain enthusiasts. By lowering the entry barriers, custodial wallets open up the game to a larger, more diverse audience.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Simplified Management of Digital Assets&lt;/strong&gt;&lt;br&gt;
Web3 games often involve complex in-game economies, where players can trade, sell, or earn tokens and NFTs. Managing these assets through a custodial wallet simplifies the process. The game itself holds and manages the player's assets, and users can easily access and interact with their tokens without having to go through the trouble of managing them on a blockchain platform.&lt;/p&gt;

&lt;p&gt;For developers, this simplifies the integration of digital assets and reduces the risk of player confusion or mistakes. With the wallet and asset management all taken care of, players can focus on what really matters: enjoying the game.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;4. System Architecture for Custodial Wallet Integration&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Integrating a custodial wallet into your Web3 game isn't just about offering players a smooth experience—it also requires a solid backend system to ensure that all assets are managed securely and efficiently. Here’s an overview of how a typical custodial wallet system might be architected, and what you’ll need to consider as a game developer.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Overview of Wallet Service Provider Integration&lt;/strong&gt;&lt;br&gt;
At the core of your custodial wallet integration will be the wallet service provider—a third-party company or platform that manages the wallets on behalf of your players. Providers like Fortmatic, Torus, and WalletConnect are commonly used in Web3 applications. These services act as the intermediary between your game and the blockchain, providing secure storage and management of digital assets without requiring players to handle the complexity of private keys.&lt;/p&gt;

&lt;p&gt;To integrate a custodial wallet system, you’ll need to connect your game’s backend with the wallet provider’s API. This allows your game to create and manage user wallets, handle asset transfers, and ensure the security of in-game assets. The wallet service provider will usually take care of encryption and private key storage, but you’ll want to ensure that you understand their system’s security measures to maintain trust.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Secure User Account Management&lt;/strong&gt;&lt;br&gt;
Security is critical when handling digital assets. For a custodial wallet, the wallet provider takes on the responsibility of managing private keys, but your game still needs to ensure that users’ accounts are securely managed and protected. You’ll need to implement strong authentication mechanisms—such as two-factor authentication (2FA) or single sign-on (SSO)—to prevent unauthorised access to user accounts.&lt;/p&gt;

&lt;p&gt;Additionally, you’ll need a way to handle user account recovery, in case players forget their credentials or experience issues with their accounts. This may involve a combination of email-based recovery options and secure personal identification questions.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;API and Backend Considerations&lt;/strong&gt;&lt;br&gt;
The API provided by your wallet service provider will be crucial for linking the wallet system with your game’s backend. The API will handle the creation of new wallets, user login, token management, and more. You’ll want to make sure your game is optimised for fast and efficient API calls, as the user experience can be impacted by slow transaction times or delays in wallet management.&lt;/p&gt;

&lt;p&gt;Your backend system will also need to interact with the blockchain to facilitate transactions such as token transfers or NFT trades. You’ll need to choose a blockchain that fits the needs of your game (Ethereum, Polygon, Solana, etc.), and ensure your server is well-optimised for interacting with that network.&lt;/p&gt;

&lt;p&gt;In addition, you’ll need to handle events like failed transactions or low balances gracefully, ensuring that your game can notify users of issues without disrupting their gameplay.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fv96ut5p6c4kexcqpnehw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fv96ut5p6c4kexcqpnehw.png" alt=" " width="800" height="580"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;5. Advantages of Custodial Wallets in Web3 Games&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;As Web3 gaming continues to evolve, custodial wallets have become an increasingly popular choice for developers seeking to create accessible, scalable, and secure gaming experiences. While there are multiple reasons for choosing custodial wallets, let’s take a closer look at some of the key advantages they offer for both developers and players.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Simplified Onboarding Process&lt;/strong&gt;&lt;br&gt;
One of the most significant barriers to entry in Web3 games is the complexity of blockchain interactions. Players are often required to understand wallets, private keys, and the intricacies of blockchain transactions. This can overwhelm newcomers, especially those who aren't familiar with the world of crypto.&lt;/p&gt;

&lt;p&gt;With custodial wallets, the onboarding process becomes incredibly straightforward. Players don’t need to create wallets or manage private keys. Instead, they simply sign up for an account, and the game manages all the technical aspects behind the scenes. This drastically reduces friction and makes it easier to attract a broader audience, including non-crypto-native players who may be hesitant to dive into the blockchain world.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Reduced Friction for Non-Crypto-Native Users&lt;/strong&gt;&lt;br&gt;
For non-crypto-native users, the process of setting up a wallet, securing private keys, and learning how to interact with blockchain-based assets can be daunting. Custodial wallets eliminate this complexity by removing the need for players to handle their private keys or understand blockchain mechanics. This leads to an overall better user experience, especially for those who are simply interested in playing games without needing to understand the technology powering them.&lt;/p&gt;

&lt;p&gt;With custodial wallets, players can focus on gameplay, and the game developer manages all the complex blockchain interactions on their behalf. This makes Web3 games much more accessible to a mass audience, increasing adoption and retention rates.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Greater Control Over Player Funds&lt;/strong&gt;&lt;br&gt;
One of the often-discussed concerns with decentralisation is the challenge of ensuring that users feel their assets are secure and easily accessible. In a custodial wallet system, the game developer or wallet provider takes full responsibility for safeguarding the assets, including user tokens and NFTs. This means that if something goes wrong (e.g., a lost password or account issue), the game can provide support and facilitate recovery.&lt;/p&gt;

&lt;p&gt;Additionally, custodial wallets allow the game to offer features like refunds or account recovery, which are typically harder to implement with non-custodial wallets. This gives players peace of mind knowing that their funds are protected and that they can regain access to their assets if they encounter any issues.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Scalability and User Growth Potential&lt;/strong&gt;&lt;br&gt;
As your game grows, you’ll need a system that can handle a large number of users and assets efficiently. Custodial wallets scale much better than non-custodial alternatives, as the responsibility for asset management lies with the game or wallet provider, not with individual players.&lt;/p&gt;

&lt;p&gt;This allows developers to implement features like bulk user management, handle large transaction volumes more easily, and provide support for millions of players without burdening them with wallet-related complications. In turn, this enhances the game's ability to scale while maintaining a smooth user experience for a growing player base.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Reduced Risk of Player Errors&lt;/strong&gt;&lt;br&gt;
One common issue with non-custodial wallets is that players are often responsible for managing their private keys and wallet credentials. If they lose their private key or forget their seed phrase, they can lose access to their in-game assets forever.&lt;/p&gt;

&lt;p&gt;With custodial wallets, this risk is mitigated because the game provider manages the security and recovery of the wallet. Players don’t have to worry about the potential for irreversible mistakes, and developers can offer more robust support to recover lost access.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;6. Conclusion&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Integrating a custodial wallet into your Web3 game can significantly enhance the player experience while reducing the barriers to entry for those unfamiliar with blockchain technology. By removing the complexity of managing private keys and simplifying wallet interactions, custodial wallets make it easier for players to dive into your game and engage with its ecosystem.&lt;/p&gt;

&lt;p&gt;We’ve covered the key benefits of custodial wallets, such as smoother onboarding, improved security, and scalability for growth, and provided a step-by-step guide to help you implement them in your game. Whether you’re aiming to make your game accessible to a larger audience or streamline the management of in-game assets, custodial wallets offer a powerful solution.&lt;/p&gt;

&lt;p&gt;As Web3 gaming continues to evolve, adopting a custodial wallet system could be your secret weapon in offering a frictionless experience that keeps players coming back for more. With the right wallet provider and a solid implementation strategy, you can ensure that your game remains user-friendly, scalable, and ready for the future of blockchain-powered gaming.&lt;/p&gt;

&lt;p&gt;Now that you have the knowledge to integrate custodial wallets into your Web3 game, it’s time to take the next step and enhance your player experience. Happy developing!&lt;/p&gt;

</description>
      <category>web3</category>
      <category>programming</category>
      <category>gamedev</category>
      <category>architecture</category>
    </item>
  </channel>
</rss>
