DEV Community

Kanishka
Kanishka

Posted on • Edited on

Short note: Isomorphic overkill for shared json serialization?

It feels like typescript and nextjs are rising in popularity because of isomorphic programming. In reality, there are very few moments where I want to use the same library functions on the client and server. Ultimately, I just want to share a set of definitions for structs and have the front end and backend have generated serialization logic for those structs.

This can be achieved by either defining the structs in a special language like avro or graphql, or by defining them in the backend language and generating front end code. Defining them in the backend language seems simpler because then you only need code generation for the front end. So, maybe the path forward is to ensure each orm in golang, python, typescript, and rust can generate front end struct declarations in elm/typescript, and that elm/typescript can generate json serialization from the structure definitions.

Top comments (1)

Collapse
 
codewander profile image
Kanishka

I am coming around to isomorphic programming as a way to reduce context switches. You can learn one standard library and syntax deeply.