Sayef Khan

Software Engineer

Specialising in multithreaded systemsModular code

About

Hello,

I’m Sayef, an engineer who builds software that stays fast & modular as the team grows. I enjoy the behind-the-scenes details that keep everything running smoothly: queue semantics, module boundaries, the migration plan nobody wrote down.

Three years across backend platforms, product frontends and the seams between them. I leave behind code that the next person can change without asking me first.

Past projects

04 projects

  1. Code

    beacon/api.py

    # beacon/api.py: grounded answers, streamed with sources
    @app.post("/ask")
    async def ask(q: Question, user: User = Depends(auth)):
        hits = await search(q.text, team=user.team, k=6)
        if not hits:
            return {"answer": None, "reason": "no matching docs"}
    
        prompt = build_prompt(q.text, hits)
    
        async def stream():
            async with client.messages.stream(
                model=MODEL,
                max_tokens=800,
                system=SYSTEM_PROMPT,
                messages=[{"role": "user", "content": prompt}],
            ) as s:
                async for text in s.text_stream:
                    yield text
            yield cite(hits)
    
        return StreamingResponse(stream(), media_type="text/plain")
    
    
    async def search(text: str, team: str, k: int) -> list[Doc]:
        vec = await embed(text)
        return await db.fetch(
            "SELECT * FROM docs WHERE team = $1 "
            "ORDER BY embedding <=> $2 LIMIT $3",
            team, vec, k,
        )
    
    Product
    beacon grounded

    How do I order a new laptop for a starter?

    Raise a hardware request in the IT portal at least 10 working days before the start date1. Managers approve it, then Procurement ships to the office or home address on file2.

    • 1 IT Handbook · p.12
    • 2 Procurement policy · §3.2

    Ask anything about how we work…

    012023

    Beacon

    AI knowledge assistant

    An internal assistant that answers staff questions from 40,000 company documents and shows the exact page each answer came from.

    Internal “how do I” support tickets fell by 38% in its first quarter.

    • Python
    • FastAPI
    • pgvector
    • Claude API
  2. Code

    payouts/router.ts

    // modules/payouts/router.ts
    export const payoutsRouter = router({
      list: protectedProcedure
        .input(z.object({ status: PayoutStatus }))
        .query(({ ctx, input }) =>
          ctx.db.payout.findMany({
            where: { status: input.status },
            orderBy: { createdAt: "desc" },
            take: 50,
          }),
        ),
    
      approve: withRiskCheck(protectedProcedure)
        .input(z.object({ id: z.string() }))
        .mutation(async ({ ctx, input }) => {
          await ctx.audit("payout.approve", input.id);
          return ctx.payouts.approve(input.id);
        }),
    });
    
    // apps/console/modules.ts
    export const modules = [risk, payouts, support];
    
    Product
    PayoutsApprove
    • Northwind Ltdpo_8f21£12,480.00pending
    • Acme Freightpo_8f1c£3,915.20review
    • Kite & Copo_8f0a£842.00paid
    • Blue Harbourpo_8ef7£27,100.00paid
    • Lumen Studiopo_8ee3£1,260.75paid

    [email protected] · deployed 14 min ago

    022024

    Ledgerline

    Modular payments console

    An operator console split into independently deployable modules, so the risk, payouts and support teams ship on their own schedule.

    Release cadence moved from fortnightly to 11 deploys a week.

    • Next.js
    • TypeScript
    • tRPC
  3. Code

    relay/worker.go

    // worker.go: steal from peers when idle
    func (w *Worker) Run(ctx context.Context) {
      for ctx.Err() == nil {
        job, ok := w.local.Pop()
        if !ok {
          job, ok = w.steal(ctx)
        }
        if !ok {
          w.park(ctx, 50*time.Millisecond)
          continue
        }
        w.exec(ctx, job)
      }
    }
    
    func (w *Worker) steal(ctx context.Context) (Job, bool) {
      res, _, err := w.rdb.XAutoClaim(ctx,
        &redis.XAutoClaimArgs{
          Stream: "relay:jobs", Group: "workers",
          Consumer: w.id, MinIdle: 2 * time.Second,
          Start: "0-0", Count: 1,
        }).Result()
      if err != nil || len(res) == 0 {
        return Job{}, false
      }
      return decode(res[0]), true
    }
    
    Product
    relay prod
    p95 queue latency240 msfrom 1.8 s
    throughput12.4k/s

    work-stealing workers

    • w1
    • w2
    • w3
    • w4
    • w5
    • w6
    • w7
    • w8

    032025

    Relay

    Concurrent job runtime

    A work-stealing scheduler for a logistics platform, replacing a single-queue worker pool that stalled under burst traffic.

    p95 queue latency went from 1.8 s to 240 ms at the same hardware cost.

    • Go
    • Postgres
    • Redis Streams
  4. Code

    sync/merge.rs

    // sync/merge.rs: conflict-free on reconnect
    impl Note {
        pub fn merge(&mut self, remote: &Note) {
            for (id, op) in &remote.ops {
                self.ops.entry(*id).or_insert(op.clone());
            }
            self.clock.join(&remote.clock);
            self.body = self.ops.render();
        }
    
        pub fn persist(&self, db: &Connection) -> Result<()> {
            let tx = db.unchecked_transaction()?;
            for op in self.ops.since(self.synced_at) {
                tx.execute(
                    "INSERT OR IGNORE INTO ops VALUES (?1, ?2)",
                    params![op.id, op.to_bytes()],
                )?;
            }
            tx.commit()
        }
    }
    
    Product
    Field notes synced
    • Transect B, plot 4Lichen cover up ~20% since…
    • Water sample logpH 6.8, turbidity low, 2 vials
    • Bird count, ridge3× ptarmigan, 1× raven
    • Camp inventoryFuel for 4 more days

    Back online after 3 days · 41 edits merged, 0 conflicts

    042026

    Fieldnote

    Offline-first sync engine

    CRDT-based note sync for field researchers working without signal for days at a time, with conflict-free merges on reconnect.

    Zero data-loss reports across 14 months in production.

    • Rust
    • SQLite
    • React Native

Services

Drag or scroll sideways

What I bring to a team

  • 01.tsx

    Full-stack development

    End-to-end features, from the screen a user taps to the server and database behind it.

    Frontend

    • React
    • Next.js
    • TypeScript
    • HTML & CSS
    • Tailwind

    Backend

    • Node.js
    • Express
    • REST APIs
    • GraphQL
    • Auth
  • 02.c

    Languages

    Comfortable moving between languages and picking the right one for the job.

    • Python
    • JavaScript
    • TypeScript
    • Java
    • C
    • C++
    • C#
    • Go
    • SQL
    • Bash
  • 03.bash

    Tools & workflow

    The everyday kit teams expect you to know on day one.

    • Git & GitHub
    • VS Code
    • Docker
    • Linux
    • Postman
    • npm
    • Jira
    • Figma
  • 04.go

    Cloud & DevOps

    Shipping code safely and keeping it running once it is live.

    • Azure
    • AWS
    • CI/CD
    • GitHub Actions
    • Kubernetes
    • Terraform
    • Monitoring
  • 05.sql

    Databases & data

    Designing how data is stored so it stays correct and fast to query.

    • PostgreSQL
    • MySQL
    • MongoDB
    • Redis
    • Prisma
    • Data modelling
  • 06.python

    AI & machine learning

    Building features on top of modern AI models, not just using them.

    • LLM APIs
    • RAG
    • Prompt design
    • PyTorch
    • pandas
    • Vector search
  • 07.java

    Testing & quality

    Code that is reviewed, tested and safe for the next person to change.

    • Unit tests
    • Jest
    • PyTest
    • JUnit
    • Playwright
    • Code review
    • TDD
  • 08.cpp

    Systems & problem solving

    The fundamentals interviews test and real systems depend on.

    • Data structures
    • Algorithms
    • System design
    • Multithreading
    • Networking
    • OOP

Contact

Got a project in mind? Let’s talk it through.

[email protected]

Open to full-time roles and select contracts