Hacker News new | past | comments | ask | show | jobs | submit | kamilafsar's comments login

That’s not a downside. That’s part of building and being a team. We’re human, not machines. If you hire the right people, they’ll know when to have a laugh and when to work their ass off.


That very much depends on the person. It might be an upside for you but a downside for me.


I love humans, just not all of them and I prefer separating my private life from my work life


I personally hate the TS bindings. That's one of the reasons that drove me to create Phero: https://phero.dev


I think the majority of people here understands the commercial considerations Apple makes.

But you asked what would you expect. At least don’t block me to update. Tell me it’s not officially supported. But let me install whatever OS I want, at my own risk.

The problem is not even the OS. It’s the whole ecosystem of apps that require a certain OS version.

I’m stuck on 10.13 with my iMac from 2012. The hardware serves me well, it does exactly what I need it to do. I’m just stuck on an old OS.

I’m gonna try OpenCore legacy patcher for sure.


Shameless plug: I’m one of the authors of Phero [1]. It’s goal is similar to tRPC: fullstack typesafety between your server and client(s).

One difference is syntax: Phero leverages the TS compiler api to generate parsers for your backend functions. It will parse input and output of your api functions, automatically, based on the types you define for your functions. It will generate a declaration file of your api and generate an RPC style client SDK for your frontend. Another difference is that it aims to be more batteries includes.

[1] https://github.com/phero-hq/phero

Comparison: https://phero.dev/docs/comparisons/tRPC


> Stop assuming data is of the type you’re expecting. You know it is, period.

> Know when you break compatability with the frontend, before even running it: TypeScript has your back.

Do you? Your front-end and back-end, regardless if they use the same source for their interface contract, aren't deployed as a unit. At least not always, and not in the single page application use cases you're targeting.

How do you handle versioning and protocol compatibility? Across all these frameworks, it feels like a footgun your users will discover on their own.


Good point!

We use Phero extensively in mobile apps projects, so we know the pain of maintaining API versions and backward compatibility hell.

Phero generates a declaration file with all functions you expose, and bundles dependent domain models (interfaces, type aliases, enums, etc) with it. Currently there's only one version. Our plan is to let users pin versions of this declaration file (we call it the manifest file).

Then we build cli commands to compare them and actually tell if they are compatible. This way you know if it's safe to deploy a new version of your API without breaking existing clients. These are all future plans of course, but in the scope of the project.


It seems like you could use Microsoft’s API Extractor to validate schema changes between HEAD’s phero-schema.d.ts and $(git merge-base HEAD main). I haven’t run Phero yet but it would be cool to leverage existing investment here.


> Across all these frameworks, it feels like a footgun your users will discover on their own

Exactly. tRPC and other projects alike don’t provide you an actual API that you can later consume, but an RPC “glue”


We have an RPC spec in tRPC :)

One big difference in philosophy here is that tRPC is not designed to be used for cases where you have third party consumers. It's built for situations where you control both ends. (That said, you can use trpc-openapi for the endpoints that are public)

On versioning: it's 2023 & in most cases, you can solve versioning in other ways than maintaining old API versions indefinitely. For RN there's OTA, for web you just need to reload the page or "downgrade" your SPA-links to a classic link to get a new bundle (did an example here https://twitter.com/alexdotjs/status/1627739926782480409)

Also, we'll release tooling to help keeping track of changes in cases where you can't update the clients as easily.

GraphQL is amazing but it isn't a silver bullet either, it has its own complexity that you have to accept as well.


> On versioning: it's 2023 & in most cases, you can solve versioning in other ways than maintaining old API versions indefinitely. For RN there's OTA, for web you just need reload the page or "downgrade" your SPA-links to a classic link to get a new bundle (did an example here https://twitter.com/alexdotjs/status/1627739926782480409)

I would suggest you think more deeply about this problem.

In all the examples you listed there is a population on the new version and the old version, even in the happy case. Distributed systems are not instant, and changes take time to propagate. Publishing a new version of your website / RN bundle to a CDN does not mean all edge locations are serving it. Long lived single page applications (Gmail for example) are not typically refreshed often. For small applications, this may not be an issue -- when your scale is millions of users, the population that now receives a 500 due to a bad request is significant, even if it's seconds or minutes where clients access both versions, but the backend only supports the latest version.

> Also, we'll release tooling to help keeping track of changes in cases where you can't update the clients as easily.

The ease of updating the clients doesn't solve this issue, and avoiding leaking it into your framework because it's messy or introduces constraints won't make it go away.


Thanks for the input! We have thought about it a lot.

The biggest challenge with trpc right now is that the API is transient so it's not obvious when you might be braking clients in flight and that you often can't guarantee perfect sync of deployments as you're rightly pointing out.

Once we have some more tooling around it, you'll be able to get the benefits of a traditional API where you consciously choose when to break the spec, but with the productivity benefits of not having to manually define it. I think that will scale pretty well.


> One big difference in philosophy here is that tRPC is not designed to be used for cases where you have third party consumers. It's built for situations where you control both ends. (That said, you can use trpc-openapi for the endpoints that are public)

I'm a happy tRPC user, and this is my use case. Our web application has no client other than our web frontend. I can't see a situation when it would (and I would bet this is true for most web applications), so I am very happy with how tRPC has worked out.

I did recently create a more limited data API, and for that I used express-zod-api [0] which I like very much.


As far as I understand Phero needs a build-step, where as tRPC does not

This means you won't be getting the same real-time experience/feedback you get with tRPC, because you will still be waiting for Phero's compiler to complete the build

I was expecting something like that to emerge and initially wanted to go into that direction with Garph (see my comment below) but we ultimately decided that a code-gen does not give you the same amazing feeling so we ended building a pure TypeScript library

Good luck with Phero in any case!


Yes, Phero has a build step. Phero does come with a CLI and will watch code changes, build your TS alongside with an client SDK.

In our experience the latency between changing something in your API, and seeing compile errors arise in the client is just a few seconds. And this only matters when your API contract changes, which is of course not always. Not a biggy in our eyes. In order to run, you'd need to compile TS anyways. :)

In our opinion this is well worth the "magic" Phero adds: it will work with plain TS. No "t.string" like apis to build your apis/models. Matter of taste I guess :)


Not to take away from your explanation, but this is actually the key point that a lot of developers have been fighting in the last couple of years.

We've "had" end-to-end typesafety with codegen tools openapi/swagger and graphql etc.

However, the big issue with a lot of those tools is that you end up having to manage this compile step.

The real magic of trpc is exactly this point about it being without a compiler, where the types are derived from the very same typescript files - this is what gives it this immediacy and feeling of it being instant and not having to deal with a compile step.

I've always wondered whether we'd get the same benefits and niceties with a really streamlined compiling approach - perhaps something like phero. But it's just a little harder of a sell compared to the built-in typesafety you get from trpc


There is a difference with approaches like openapi/swagger/graphql though.

With Phero you define your models with plain TS. Our code-gen will "just" copy the exact same models to your client SDK. The DX is night and day.

We believe domain models are the most important part of your codebase. We don't like to define them in an intermediate language like graphql/swagger/graphql/you-name-it.

Because we support plain TS as "input" if you will, you can use all features and greatness TS comes with. Like generics, conditional types, mapped types, even template literal types!


fair enough, i can imagine that feeling pretty nice.


I like this approach of using the Typescript compiler API to produce the runtime type validator from the TS type, instead of the other way around! I started working on a toolkit to compile Typescript types to arbitrary downstream languages like Protobuf and Python/MyPy, but the last 20% of polish eludes me. My work is here: https://www.npmjs.com/package/@jitl/ts-simple-type


The relevant TS feature is called template literal types:

https://www.typescriptlang.org/docs/handbook/2/template-lite...


Yeah agree 100%.

Unless you’re implementing a standard, software engineering is 50% communication with peers/clients/users, if not more..


Please keep in mind, he didn't send you there personally. The algorithm did. I've experienced this several times my self, very frustrating and sometimes even dangerous. I think it's unavoidable if you take into account that they operate on planet-scale. Not saying that they can't do better, but probably it's not "someone's" fault.


I wonder what the correlation between consistency of written/spoken language is for the breakdown per language here: https://github.com/openai/whisper/blob/main/language-breakdo...

For instance, I know Turkish is very consistent: it was refactored in 1928 with the birth of Turkey. Turkish is quite high in the rankings. I don't think because there's loads of data available, but because of its consistency. Contrary, English has loads of data, which should compensate for it inconsistency.


But then in “userland”..

So you could use it on a chromebook as well.

I like the idea, and as PG often says the best ideas often sound crazy at first.

Glad someone other than me is trying I guess :-)


Shameless plug to my project Phero [0]. It’s a bit like gRPC but specifically for full stack TypeScript projects.

It has a minimal API, literally one function, with which you can expose your server’s functions. It will generate a Typesafe SDK for your frontend(s), packed with all models you’re using. It will also generate a server which will automatically validate input & output to your server.

One thing I’ve seen no other similar solution do is the way we do error handling: throw an error on the server and catch it on the client as if it was a local error.

As I said, it’s only meant for teams who have full stack TypeScript. For teams with polyglot stacks an intermediate like protobuf or GraphQL might make more sense. We generate a TS declaration file instead.

[0] https://github.com/phero-hq/phero


tRPC is another similar library.

https://trpc.io/docs/v10/quickstart


There’re some key differences though, one being you can use plain typescript types to define your models, instead of a validation lib like zod :)


Zod gives you a lot more of control on the schema.


That’s an interesting point, can you give an example of that?


You can use any custom validation there is for any field.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: