ardatan / feTS

🗹 TypeScript HTTP Framework focusing on e2e type-safety, easy setup, performance & great developer experience
https://the-guild.dev/openapi/fets
MIT License
616 stars 27 forks source link

Instead of enforcing Typebox, let the user choose #1015

Open thelinuxlich opened 7 months ago

thelinuxlich commented 7 months ago

Maybe build upon typeschema so feTS become validation-agnostic ?

imjulianeral commented 6 months ago

Idk if this package must be included in fets at all, it increases the bundle size by a lot!

https://bundlephobia.com/package/fets@0.7.1

it feels weird that TRPC with the packages server and client combined gets only ~10kb minified and fets it's over 60kb.

Also typebox is only 10kb, so Idk what's hapening here:

https://bundlephobia.com/package/@sinclair/typebox@0.32.12

ardatan commented 2 months ago

feTS relies on JSON Schema not typebox actually. Technically you can use any library that supports JSON Schemas for validation. By default, the schemas created by typebox are detected but that doesn't mean you cannot use any other libraries that are compatible with JSON Schemas. This is one thing.

About the bundle size; Bundle size results might not be accurate since it doesn't get the optional dependencies that are tree-shaken in most cases such as ponyfills etc. However, entire feTS library is tree-shakable so if you don't use typebox, you won't have it in your bundle so it means -10kb :) Same for ponyfills... If they are not used, they won't be added to the bundle.