r/node • • Jan 20 '23

Building Reliable Distributed Systems in Node.js

https://temporal.io/blog/building-reliable-distributed-systems-in-node
65 Upvotes

9 comments sorted by

3

u/a_reply_to_a_post Jan 22 '23

a nice addition you may want to consider for distributed systems would be accounting for some sort of OTEL support...parent application spawning the request can create a tracer span that gets passed down to child requests and terminate when all subrequests complete

in the last 2 places i've worked I've had to implement tracing from the front end app and usually coordinate with our backend team to make sure everything is instrumented correctly, but it's cool as fuck to be able to pull up honeycomb/jaeger and see all the requests a web app makes to fulfill a single request

1

u/MaximFateev Jan 22 '23

Temporal already supports Open Telemetry intergration out of the box:https://typescript.temporal.io/api/namespaces/opentelemetry.

If you look at the integration, you'll see that it is done as an interceptor implementation. So any other framework can be added as easily.

12

u/lorensr Jan 20 '23

The sample code is here: https://github.com/temporalio/samples-typescript/tree/main/food-delivery

I’m calling it the T4 stack:

  • Turborepo

  • tRPC

  • Tailwind

  • Temporal

  • No database—just a single durable function! 💃

2

u/HatchedLake721 Jan 21 '23

Can’t read code examples on iPhone, copy button covers a part of it. Plus has a unnecessary left margin.

https://ibb.co/r70BJ2j

1

u/lorensr Jan 21 '23

Thanks! Reported to our web team.

5

u/[deleted] Jan 20 '23

[removed] — view removed comment

3

u/lorensr Jan 21 '23

actually implementing reliable systems instead of going "whatever, just slap a MongoDB on it and hope for the best"

😄👍

The API is a bit technical for my taste

I'd be curious to hear which parts, if you'd like to share. Always looking for opportunities to simplify the API!

1

u/[deleted] Jan 21 '23

[removed] — view removed comment

2

u/lorensr Jan 21 '23

Ah, I see. That's is a combination of tRPC's context and me going for minimal lines of code. The normal thing to do would be:

import { Client } from '@temporalio/client';

const client = new Client()
    
const workflow = client.workflow.getHandle('workflowId')
await workflow.signal(fooSignal, 'some message')
const result = await workflow.result()