Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

214
Views
share type definition of frontend and backend

I start to use typescript in my frontend and backend (node.js), and I notice I've duplicated type definitions like the API response. What's the best way I can share it when we have 2 teams working on the product?

about 4 years ago · Juan Pablo Isaza
3 answers
Answer question

0

One option would be to put all of the shared types into its own .ts file or a private repository shared among the teams, so that both can import it.

The repository route is probably the more maintainable solution, since it'll allow for multiple files (very useful in large projects) and is easier with its own source control.

about 4 years ago · Juan Pablo Isaza Report

0

Use a library like BFF Pattern https://blog.bitsrc.io/sharing-types-between-backend-and-frontend-with-the-bff-pattern-553872842463

about 4 years ago · Juan Pablo Isaza Report

0

Note: I’m one of the authors of Remult

If you’re looking for a way to efficiently share TypeScript code between FE and BE and have a type-safe way to query your API from the FE (without code generators) I suggest you try something like Remult

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!