Insurance Platforms · Rust AI Backend

Shamsher Singh

Senior developer at Intact · Java and Guidewire · Rust AI backend

Shamsher is a senior developer at Intact, working on Java and Guidewire insurance systems. He built Crust AI, an AI coding assistant for Rust, with an Axum backend, a React and TanStack client, and Postgres behind sqlx.

The interesting work sits around the model call: relaying OpenAI's stream token by token, keeping chat state consistent when a reply fails or is stopped, making entity ids impossible to mix up, and transcribing voice input through a hosted or a fully local backend.

Senior
Software Developer at Intact Insurance, Toronto
4+ yrs
Java and Guidewire in production insurance systems
v8 -> v10
Guidewire platform upgrades through production
J2EE
Enterprise Java and Hibernate background
[ Streaming ]

Relaying a stream, not waiting for a completion

POST /chats/{chat_id}/reply/stream returns Server-Sent Events built with axum::response::sse and async-stream. Upstream, OpenAI's own SSE response is read through bytes_stream() and eventsource-stream, so each token is forwarded as a typed delta, error or done event.

Malformed chunks, role-only chunks and empty deltas are skipped by a small extract_delta parser with its own unit tests. When the client stops generating, the dropped connection ends the stream future on the server, and whatever text already arrived is persisted as the assistant message instead of being discarded.

[ Chat state ]

Retries that never duplicate a message

Sending a message and generating the reply are two steps. If the user message was already persisted when the reply failed, retry re-requests only the reply, so the conversation never shows the same prompt twice.

The model sees a bounded window of recent messages rather than the whole history, which keeps cost and latency predictable on long chats. Chats sort by an updated_at bumped on every message, and deleting a chat cascades its messages while detaching its documents instead of destroying them.

[ Types ]

Ids that cannot be swapped by mistake

Every primary key is a Unid<Pk>: a UUID tagged with a phantom marker type. Passing a chat id where a user id is expected becomes a compile error instead of a silent wrong-row query.

Unid implements sqlx's Type, Encode and Decode for Postgres plus serde, so the wrapper costs nothing at the storage or API layer. Permissions go through an access-control trait checked against the authenticated user extracted from a JWT.

[ Voice ]

Speech to text with a hosted and a local backend

The browser sends raw 16 kHz f32 PCM. The server validates the byte length, then transcribes through Groq when an API key is set, or through whisper-rs locally when the local-whisper cargo feature is enabled.

Local inference runs in spawn_blocking so the CPU-heavy model never stalls the async runtime, and the real-time factor is logged per request. Because transcription and LLM calls cost money, both endpoints carry their own quotas, keyed per IP for anonymous callers and per user once authenticated.

The journey

One clear path through the build

Drag to explore · Select a milestone to read the full story

Mentor perspective

Shamsher builds like someone who has supported production insurance systems: he thinks about the failure path first. A retry that cannot duplicate a message, a stopped stream that keeps its partial text, ids the compiler refuses to mix up. Those are the details that separate a demo from a backend you can run.

Max Wells

Want results like Shamsher's?

Max WellsAvailable for calls

Max Wells

Founder · Rustify

Book your Rust career diagnostic

30 minutes, 1:1 with Max. An honest read on where you are and whether Bootcamp or Mentorship fits, before you apply.

Only a few diagnostic slots left this week.

Applications are reviewed carefully.

← Back to case studies

More client journeys

See another path into Rust

Ready to Land a $80k+ Rust Job in the US or Europe?