/full-stack-grpc-python-nextjs

Full Stack With Python & Next.js & gRPC

Primary LanguageTypeScriptMIT LicenseMIT

Full Stack With Python & Next.js & gRPC

Using gRPC-web as the communication method between front-end and back-end, this project provides two solutions:

1. gRPC-Web Solution

Important

grpc-web is a client side library. XHLHttpRequest is not supported by Next.js server side rendering.

    ┌──────────────┐     ┌────────────────┐     ┌───────────────┐
    │   Browser    ├────►│   gRPC Proxy   ├────►│  gRPC Server  │
    └──────────────┘     └────────────────┘     └───────────────┘

2. Server Side Solution

If you want to use Server Side Rendering, you need to make gRPC requests directly from the Next.js server to the RPC server.

    ┌──────────────┐     ┌────────────────┐     ┌───────────────┐
    │   Browser    ├────►│ Next.js Server ├────►│  gRPC Server  │
    └──────────────┘     └────────────────┘     └───────────────┘

The two approaches above can be used in combination, depending on the actual situation.

Dependencies

Command line tools:

Development

install requirement

make install

generate protobuf

make buf

if you want to know more about details for buf build , see Makefile

Support

If you like this project, please consider supporting me for coffee ☕️

Buy Me A Coffee get youtself link