GRPC Node + NextJs + Prisma + Envoy Proxy
This is a simple CRUD for task management app built with below techs:
- GRPC-Node
- NextJs
- Prisma
- Envoy Proxy
Currently, I have used 4 Unary RPCs and 1 Server streaming RPC for streaming real-time data, and in the future will implement Client streaming RPCs and Bidirectional streaming RPCs🫡.
I have also used Prisma to store tasks in the database.
The tasks list route("/tasks") will be real-time using GRPC Server streaming RPC, upon adding a new task a trigger will be fired at connected clients.
As well I have added a Unary RPC route to destroy unused clients, maybe you can use a Cron job to trigger that route every 30min or based on your requirements.
GitHub repo: Real-Time Task Management App
Top comments (5)
Thanks for the post.
I used gRPC for a client-side application and ran into a few issues. It would be interesting to know if you have stumbled upon these as well and also how you resolve them.
XMLHTTPRequest
. This wasnt very ideal but it somehow worked.Ultimately my team ended up starting to put a websocket layer above grpc so the client didnt need to use it.
Let me know if you had these issues and how you solve them. would be interesting to see
Useful links:
I also came across buf.build/blog/connect-a-better-grpc
It should be available now but never got a chance to use it
1: Yes currently we don't have the glories of GRPC which is two-directional streams.
2: If you use docker-compose or Kubernetes you can make the envoy proxy use http2 for frontend and backend, will implement that in future maybe for this repo.
3: Yeah, 😅 I have used Cron jobs to trigger the GRPC endpoint every 30min to delete unused streams.
4: For debugging, you have to enable debug mode in envoy to show debug log for every request, there is no other way I have found so far🫤.
Will we have to wait patiently for GRPC-Web to fix these issues!
Hi Layton. Just FYI, github.com/jellydn/grpc-demo-monorepo I've implemented the monorepo which is kind of solve some issues which you mentioned above (e.g: proxy with Envoy).
Thanks ill have a look
Cool. Let me know if you have any feedback.