基于 ConnectRPC 的现代全栈计算器实现,包含 Go 后端服务和 Next.js 前端
- 后端: Go + ConnectRPC
- 前端: Next.js + TypeScript
- 通信协议: Connect Protocol (基于 HTTP/2)
- 基础四则运算(加减乘除)
- 实时错误处理(除零错误)
- 类型安全的 RPC 通信
- 响应式 UI 设计
- Go 1.23+
- Node.js 20+
- buf CLI (
brew install buf)
git clone https://github.com/WUZHUHE38/calculator-fullstack.git
cd fullstack-calculator后端依赖:
cd calculator-backend && go mod tidy
前端依赖:
cd calculator-frontend && npm install
buf generate proto
npx buf generate proto
cd backend && go run main.go
服务默认运行在 http://localhost:8080
cd frontend && npm run start
访问 http://localhost:3000
- 编译后端:
cd calculator-backend && go build -o calculator
2.生产构建前端:
cd calculator-frontend && npm run build
MIT License