<?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: Tanweer Chiktay</title>
    <description>The latest articles on DEV Community by Tanweer Chiktay (@tanweer_c).</description>
    <link>https://dev.to/tanweer_c</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.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4008434%2F9ab44c7f-6f7c-4083-9d97-bf3bf3c8b236.png</url>
      <title>DEV Community: Tanweer Chiktay</title>
      <link>https://dev.to/tanweer_c</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/tanweer_c"/>
    <language>en</language>
    <item>
      <title>Building a Legal AI Platform on Aurora DSQL and Vercel</title>
      <dc:creator>Tanweer Chiktay</dc:creator>
      <pubDate>Mon, 29 Jun 2026 15:35:18 +0000</pubDate>
      <link>https://dev.to/tanweer_c/building-a-legal-ai-platform-on-aurora-dsql-and-vercel-99i</link>
      <guid>https://dev.to/tanweer_c/building-a-legal-ai-platform-on-aurora-dsql-and-vercel-99i</guid>
      <description>&lt;p&gt;I built this project as an entry for the H0: Hack the Zero Stack with Vercel v0 and AWS Databases Hackathon. #H0Hackathon&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Inspiration&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Justice moves slowly. I learned that firsthand as my family navigated a legal dispute. What struck me wasn't just the stress — it was that things were quite disorganised. Documents were paper-based or buried somewhere in emails. Updates came through WhatsApp messages. Simple documents took a really long time to draft and send. The system was fragmented and difficult to navigate.&lt;/p&gt;

&lt;p&gt;Companies like Harvey tackle document drafting well, but legal research tools and LLM wrappers can hallucinate case law, citing judgments that don't exist. I knew that if I was going to build something for this space, it had to be grounded in real, verifiable law. That led me to Laws Africa, which provides structured access to actual South African legislation and court judgments.&lt;/p&gt;

&lt;p&gt;I also noticed a problem that lawyers experience daily: the mechanical work. Logging into court portals to file a case. Hunting through OneDrive, Google Drive, and Dropbox for the right version of a document. Sifting through hundreds of emails to find something relevant to a matter. Onboarding a new client when the intake form is a PDF someone emails you. These are not AI problems. They are automation problems — and lawyers or their secretaries are doing them manually every single day.&lt;/p&gt;

&lt;p&gt;That became Agently.&lt;/p&gt;




&lt;h2&gt;
  
  
  What Agently Does
&lt;/h2&gt;

&lt;p&gt;Agently is a legal workspace that handles the full lifecycle of a matter, from the moment a client submits an intake form to the day the case closes.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Matter Management.&lt;/strong&gt; Every client engagement lives in a structured matter. Documents, emails, notes, contacts, workflows, and AI conversations are all scoped to it. A lawyer can open a matter and immediately see everything relevant.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;AI Agent with Real Legal Research.&lt;/strong&gt; The AI connects to Laws Africa's knowledge bases — South African legislation, court judgments, and municipal law — so research is grounded in actual legal sources, not guessed. Ask it to find case law on a topic and it returns real judgments with citations.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Document Work.&lt;/strong&gt; Upload PDFs, Word documents, and other files. The AI reads and analyses them, extracts key facts, and can generate new documents from scratch using a full rich text editor. A dedicated tabular review mode lets lawyers run structured clause-by-clause analysis across contracts. There is a separate document editor inside each matter so drafting and reviewing happen in the same place.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Browser Agent.&lt;/strong&gt; Agently can operate a real browser on behalf of the lawyer. It navigates court e-filing portals, fills every field using structured case data from the matter, uploads the required documents, and completes the submission — including logging in automatically using securely stored credentials. The lawyer watches the browser live and can intervene at any point.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Workflow Automation and Recording.&lt;/strong&gt; Lawyers can define multi-step workflows for document review, contract approval chains, and research tasks. They can also record their own browser sessions: navigating a portal, saving those actions as a reusable workflow. When they run it again, it replays deterministically. They can attach AI instructions so the agent adapts to different inputs or makes decisions at specific points during execution.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Client Intake.&lt;/strong&gt; When a prospective client fills out a form or emails the firm, they appear on the intake dashboard. Approving them triggers an AI agent that adds the client to the Rolodex, opens a new matter, responds to emails requesting further information and documents, drafts a letter of engagement on receipt, fills in case details from provided documents, and prepares a legal opinion summary to brief the lawyer.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Integrations.&lt;/strong&gt; Gmail, Google Drive, Google Docs, Google Calendar, Microsoft Outlook, Microsoft Teams, OneDrive, Dropbox, Xero, WordPress, and IMAP email. Agently connects to what the firm already uses rather than forcing them to migrate.&lt;/p&gt;




&lt;h2&gt;
  
  
  How I Built It
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Frontend.&lt;/strong&gt; React 19 with Vite and TailwindCSS v4. Tiptap powers the rich text editor for document drafting inside matters. React Router v7 handles navigation. The AI SDK's useChat hook streams Claude's responses directly to the client via SSE, with tool-call rendering so the lawyer can see what the agent is doing step by step.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Backend.&lt;/strong&gt; Express 5 deployed as a Vercel Serverless Function on Node 24 with Fluid Compute and a 300 second timeout. Twenty-four route modules cover the full surface area: chat, matters, files, workflows, browser automation, contracts, intake, voice transcription, PDF operations, email, calendar, and more.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Database — Amazon Aurora DSQL.&lt;/strong&gt; Aurora DSQL is the primary database. I chose it because it is PostgreSQL-compatible and fully serverless — no infrastructure to manage, no capacity to provision.&lt;/p&gt;

&lt;p&gt;The integration required real engineering. DSQL uses short-lived tokens with a 15 minute TTL rather than static credentials. I built a custom pool manager that refreshes tokens 2 minutes before expiry, deduplicates concurrent refresh requests so multiple in-flight queries do not each try to rotate the token simultaneously, and drains old pool connections gracefully without dropping live requests.&lt;/p&gt;

&lt;p&gt;DSQL has no support for SET LOCAL or session-level Postgres configuration, so traditional row-level security policies are not available. I replaced RLS with explicit firm_id scoping on every query. The firm_id comes only from Clerk's cryptographically signed JWT org ID — never from the request body. A lawyer from one firm cannot access another firm's data even if they manipulate the request.&lt;/p&gt;

&lt;p&gt;DSQL requires each DDL statement in its own transaction. Standard migration libraries send multiple statements in one transaction and fail. I wrote a custom runner that splits each SQL file on semicolons and executes each statement independently. Fifteen migrations handle the full schema including matters, documents, OAuth tokens, workflow runs, client intakes, firm settings, and usage counters.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;AI Inference.&lt;/strong&gt; AWS Bedrock with Claude as the primary model, streamed to the client via Server-Sent Events using the AI SDK's streamText. A full tool-calling pipeline handles actions like file retrieval, legal research, web search, and browser control. Token usage is tracked per user per day in Aurora DSQL, with tier-based quotas enforced before any Bedrock invocation.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Browser Automation.&lt;/strong&gt; The browser agent uses Steel.dev to spin up a remote Chrome session in a cloud VM. Getting file uploads to work inside that remote browser required understanding something non-obvious: Chrome's CDP Input.setFileInputFiles requires the file to exist on the same machine as Chrome — which is Steel's VM, not the Node server.&lt;/p&gt;

&lt;p&gt;The pipeline: S3 GetObject fetches the file as a Buffer on the Node server. That buffer goes to the Steel Files API, which places it on the VM's filesystem and returns a path. That VM path is embedded in the agent prompt. The browser-use agent calls upload_file with that path and Chrome finds the file locally. The agent never has S3 credentials. The server handles all secure file transfer before the agent starts.&lt;/p&gt;

&lt;p&gt;The Python browser-use library with Playwright binaries exceeds Lambda's 250 MB deployment limit and court filings take 10 to 15 minutes, beyond Lambda's timeout. The solution was a containerised Python service on AWS ECS. The Vercel function creates the Steel session, pre-uploads documents, fires an async request to ECS with the task and CDP URL, then the frontend polls for events.&lt;/p&gt;

&lt;p&gt;When the system detects a court-related task, it looks up the firm's portal URL from Aurora DSQL, fetches login credentials from AWS Secrets Manager, resolves the relevant matter using a multi-factor scoring algorithm, fetches associated documents from S3, uploads them to the Steel VM, then builds a structured step-by-step agent prompt with every field value pre-filled.&lt;/p&gt;

&lt;p&gt;I also built a Playwright action recorder. A tracker script injected into the live browser via CDP captures clicks and form fills as console events and converts them to Playwright actions in real time. The recorded script streams back to the UI in real time. It can be replayed directly with no AI, handed to the AI with modification instructions, or improved automatically to replace fragile CSS selectors with robust ARIA-based selectors.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Storage and Auth.&lt;/strong&gt; Documents live in Amazon S3 keyed by firmId/matterId/docId, with presigned PUT and GET URLs generated server-side with a 5 minute expiry. AWS Secrets Manager stores court portal credentials per firm. Clerk handles authentication — org IDs extracted from signed JWTs become the firm_id on every database query.&lt;/p&gt;




&lt;h2&gt;
  
  
  Challenges
&lt;/h2&gt;

&lt;p&gt;Getting browser-use onto ECS was complex. Lambda failed immediately due to package size and timeout limits. Containerising the Python service on ECS and coordinating it with the TypeScript Node server over HTTP took significant iteration, especially getting Playwright Core for recording and browser-use for execution to share the same Steel CDP session cleanly.&lt;/p&gt;

&lt;p&gt;The file upload pipeline required security consideration. Giving the agent S3 access was not acceptable. The Steel Files API solution emerged from understanding exactly how CDP file input works at the protocol level.&lt;/p&gt;

&lt;p&gt;Aurora DSQL's DDL transaction requirements were not obvious from the documentation. The first migration run failed with cryptic errors until I traced it to multi-statement transactions. Writing a custom migration runner was the fix.&lt;/p&gt;




&lt;h2&gt;
  
  
  What I Learned
&lt;/h2&gt;

&lt;p&gt;Building for law forces a precision most apps never require. Every claim the AI makes, every document it generates, every form it fills — there is real professional consequence if it is wrong. That shaped every design decision: the lawyer-in-the-loop browser interface so the lawyer can always intervene, the Laws Africa integration for real citations instead of hallucinated ones, the explicit audit logging on every browser action.&lt;/p&gt;

&lt;p&gt;Aurora DSQL pushed me to think about data architecture more deliberately than any database has before. The constraints are real but they lead you to better, more auditable patterns.&lt;/p&gt;




&lt;h2&gt;
  
  
  What's Next
&lt;/h2&gt;

&lt;p&gt;Real-time collaborative document editing. Native billing and time-tracking. Expanded court jurisdiction support. A client portal for document sharing and e-signatures. Deeper workflow automation so entire matter types — conveyancing, deceased estates, civil disputes — can run with minimal manual touchpoints.&lt;/p&gt;

&lt;p&gt;Try Agently: &lt;a href="https://agently-ten.vercel.app" rel="noopener noreferrer"&gt;https://agently-ten.vercel.app&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;&lt;em&gt;This post was written as part of my submission to the H0: Hack the Zero Stack with Vercel v0 and AWS Databases Hackathon. #H0Hackathon&lt;/em&gt;&lt;/p&gt;

</description>
      <category>aws</category>
      <category>vercel</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
