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

Comparison with tRPC #2203

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1413,6 +1413,47 @@ endpointsFactory.build({
});
```

# Comparison with other projects

## tRPC

[tRPC](https://trpc.io/) has a lot of goal and design similarities with Express Zod API: you can describe your
type-safe API using zod and access it from a frontend client. The main difference between the two frameworks is that
Express Zod API keeps compatiblity with REST and provides out-of-the box OpenAPI schema generation.

```yaml
design:
Protocol:
tRPC: custom
express-zod-api: REST
comment: Express Zod API is great not only for greenfield projects but also for existing ones
Serialization:
tRPC: https://www.npmjs.com/package/superjson
express-zod-api: JSON
comment: JSON parser can be customized in config
Repo:
tRPC: mainly for mono-repo
comment: https://github.com/trpc/trpc/discussions/1860
express-zod-api: mono-repo and multi-repo
OpenAPI:
tRPC: Third-party
comment: https://github.com/jlalmes/trpc-openapi
express-zod-api: Out-of-the box
entities:
- tRPC: router
express-zod-api: routing
- tRPC: publicProcedure
express-zod-api: EndpointsFactory
- tRPC: .use()
express-zod-api: .addMiddleware()
comment: or .use() for native express middlewares
- tRPC: Context
express-zod-api: options
comment: Middleware can be used to provide options
- tRPC: onError
express-zod-api: ResultHandler
```

# Your input to my output

If you have a question or idea, or you found a bug, or vulnerability, or security issue, or want to make a PR:
Expand Down