Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEAT] TS-Rest Data Provider #6194

Closed
mjbergman92 opened this issue Jul 26, 2024 · 5 comments
Closed

[FEAT] TS-Rest Data Provider #6194

mjbergman92 opened this issue Jul 26, 2024 · 5 comments
Labels
enhancement New feature or request wontfix This will not be worked on

Comments

@mjbergman92
Copy link

mjbergman92 commented Jul 26, 2024

Is your feature request related to a problem? Please describe.

Type-safety between API and refinedev application must be meticulously managed.

Complex and opinionated options do exist (e.g. GraphQL), and any solution will have some amount of overhead, but the overhead just seems like too much for small teams. I believe refinedev has and will continue to focus on the DX while quickly building functional and user-friendly applications. The DX when it comes to managing a contract for queries and mutations between the refinedev application and the API has been one of the most challenging parts of building my current application. I spend an estimated 20% of my time just in reconciling inconsistencies between what the API offers and what the refinedev application should offer to end users.

Describe alternatives you've considered

GraphQL - While there are differing opinions amount how it compares with other options, there are tools to generate types for the quereies and mutations. The draw backs here lies in the complexity of developing a GraphQL API, which varies from developer to developer.

tRPC - Closest to what I am hoping to get. It is another viable option

I know REST, and it provides what I need, and I don't intend on moving away from it until the DX for another option becomes simpler with the same capabilities.

Additional context

No response

Describe the thing to improve

Disclaimer: I have not used ts-rest yet. While ts-rest claims to be production ready, it has only been around for about 2 years from my research.

ts-rest offers type safety without the need for code generation.

I am looking at developing my own data provider for ts-rest.

Here is my biggest reason. The "contract" is defined where the data is coming from, i.e. the API.
The contract is written in typescript, which allows for the use of zod schemas to define the contract.

As long as a standard structure for a ts-rest API can be defined such that the endpoints can be accessed by resource and the specific query or mutation (e.g. list, one, create, etc.), the DX looks promising.

What are the thoughts from other refinedev community members on this subject? I am not aware if this has or has not been brought up yet.

Key Benefits

  • Form validation schema consistent between frontend and backend
@mjbergman92 mjbergman92 added the enhancement New feature or request label Jul 26, 2024
@BatuhanW
Copy link
Member

Hey @mjbergman92 thanks for the detailed issue. We are currently focusing on August release. We'll check it and get back to you.

@mjbergman92
Copy link
Author

mjbergman92 commented Jul 31, 2024

In the meantime, I will probably be developing something myself.

This could be a really fantastic way to streamline the stack.Id even go as far as saying a half-baked but fully customizable express backend to go along with the type-safe front end fetch or query client provider would be nice for me at least.

Copy link

stale bot commented Sep 29, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix This will not be worked on label Sep 29, 2024
@stale stale bot closed this as completed Oct 6, 2024
@moltar
Copy link

moltar commented Oct 7, 2024

@mjbergman92 Have you made any progress? I am interested in this too.

@mjbergman92
Copy link
Author

@moltar I made a slight attempt, but I decided to move away from refine because I didn't need refine after using ts rest for my current use case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

3 participants