sahilrajput.com

Isomorphic Code (Universal Code) ~ Sahil

Syncing common folder/files in frontend and backend is a doable solution like that:

Setup directory structure like this:

In frontend and backend types.ts file you can add a comment to the top of the file: // This file is autogenerated, DO NOT EDIT THIS FILE INSTEAD EDIT THE SOURCE OF THIS FILE

The common/types.ts can be considered as a source of truth, which is synced whenever the frontend dev server or backend dev server is run via a simple js copy script which copies isomorphic folders each time the development server is updated.