Skip to content

Commit ad4422b

Browse files
committed
(feat) updated to v1.0
1 parent 2aed7b9 commit ad4422b

53 files changed

Lines changed: 3165 additions & 718 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.dockerignore‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22
.git/
33
.gitignore
44

5+
# Dependencies and build artifacts
6+
frontend/node_modules/
7+
frontend/.nuxt/
8+
frontend/.output/
9+
frontend/dist/
10+
backend/target/
11+
512
# IDE and editor files
613
.vscode/
714
.idea/
@@ -34,3 +41,5 @@ docker-compose*.yml
3441
# CI/CD
3542
.github/
3643
.gitlab-ci.yml
44+
45+
*.pem

‎.gitignore‎

Lines changed: 31 additions & 164 deletions
Original file line numberDiff line numberDiff line change
@@ -1,179 +1,46 @@
1-
# Based on https://raw.githubusercontent.com/github/gitignore/main/Node.gitignore
2-
31
# Logs
4-
52
logs
6-
_.log
7-
npm-debug.log_
3+
*.log
4+
npm-debug.log*
85
yarn-debug.log*
96
yarn-error.log*
10-
lerna-debug.log*
11-
.pnpm-debug.log*
12-
13-
# Caches
14-
15-
.cache
16-
17-
# Diagnostic reports (https://nodejs.org/api/report.html)
18-
19-
report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json
20-
21-
# Runtime data
22-
23-
pids
24-
_.pid
25-
_.seed
26-
*.pid.lock
27-
28-
# Directory for instrumented libs generated by jscoverage/JSCover
29-
30-
lib-cov
31-
32-
# Coverage directory used by tools like istanbul
33-
34-
coverage
35-
*.lcov
36-
37-
# nyc test coverage
38-
39-
.nyc_output
40-
41-
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
42-
43-
.grunt
44-
45-
# Bower dependency directory (https://bower.io/)
46-
47-
bower_components
48-
49-
# node-waf configuration
50-
51-
.lock-wscript
52-
53-
# Compiled binary addons (https://nodejs.org/api/addons.html)
54-
55-
build/Release
56-
57-
# Dependency directories
587

8+
# Dependencies
599
node_modules/
60-
jspm_packages/
61-
62-
# Snowpack dependency directory (https://snowpack.dev/)
63-
64-
web_modules/
65-
66-
# TypeScript cache
67-
68-
*.tsbuildinfo
69-
70-
# Optional npm cache directory
71-
72-
.npm
73-
74-
# Optional eslint cache
75-
76-
.eslintcache
77-
78-
# Optional stylelint cache
79-
80-
.stylelintcache
81-
82-
# Microbundle cache
83-
84-
.rpt2_cache/
85-
.rts2_cache_cjs/
86-
.rts2_cache_es/
87-
.rts2_cache_umd/
88-
89-
# Optional REPL history
90-
91-
.node_repl_history
92-
93-
# Output of 'npm pack'
94-
95-
*.tgz
96-
97-
# Yarn Integrity file
98-
99-
.yarn-integrity
100-
101-
# dotenv environment variable files
102-
103-
.env
104-
.env.development.local
105-
.env.test.local
106-
.env.production.local
107-
.env.local
108-
109-
# parcel-bundler cache (https://parceljs.org/)
110-
111-
.parcel-cache
112-
113-
# Next.js build output
114-
115-
.next
116-
out
117-
118-
# Nuxt.js build / generate output
11910

11+
# Nuxt build outputs
12012
.nuxt
13+
.output
14+
.data
15+
.nitro
12116
dist
12217

123-
# Gatsby files
124-
125-
# Comment in the public line in if your project uses Gatsby and not Next.js
126-
127-
# https://nextjs.org/blog/next-9-1#public-directory-support
128-
129-
# public
130-
131-
# vuepress build output
132-
133-
.vuepress/dist
134-
135-
# vuepress v2.x temp and cache directory
136-
137-
.temp
138-
139-
# Docusaurus cache and generated files
140-
141-
.docusaurus
142-
143-
# Serverless directories
144-
145-
.serverless/
146-
147-
# FuseBox cache
148-
149-
.fusebox/
150-
151-
# DynamoDB Local files
152-
153-
.dynamodb/
154-
155-
# TernJS port file
156-
157-
.tern-port
158-
159-
# Stores VSCode versions used for testing VSCode extensions
160-
161-
.vscode-test
162-
163-
# yarn v2
18+
# Caches
19+
.cache
16420

165-
.yarn/cache
166-
.yarn/unplugged
167-
.yarn/build-state.yml
168-
.yarn/install-state.gz
169-
.pnp.*
21+
# Rust build artifacts
22+
**/target
17023

171-
# IntelliJ based IDEs
172-
.idea
24+
# SQLite database files
25+
*.db
26+
*.db-shm
27+
*.db-wal
28+
*.sqlite
29+
*.sqlite3
17330

174-
# Finder (MacOS) folder config
31+
# Environment and secrets
32+
.env
33+
.env.*
34+
!.env.example
35+
*.pem
36+
37+
# IDE
38+
.vscode/
39+
.idea/
40+
.fleet
17541
.DS_Store
42+
*.swp
43+
*.swo
17644

177-
node_modules
178-
179-
**/target
45+
# TypeScript
46+
*.tsbuildinfo

‎README.md‎

Lines changed: 59 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,83 @@
1-
# fullstackarap
1+
# Bufstack
22

3-
The objective of this project is to show how to create a fullstack app with Rust, Nuxt, gRPC, and TypeScript.
3+
Full-stack application template: **Rust gRPC backend + Nuxt 4 frontend**, connected via Protocol Buffers for end-to-end type safety.
44

5-
The pain of keeping types in sync between frontend and backend is a problem that I personally wanted to solve. I'm not a fan of "isomorphic" javascript frameworks (Next, Nuxt), mainly because I don't want to write servers in Javascript.
6-
7-
This allows me to write the backend in Rust and the frontend in Nuxt without sacrificing type safety and ergonomics.
5+
Write your backend in Rust, your frontend in Vue/Nuxt, and get automatically generated TypeScript types from your `.proto` files.
86

97
## Architecture
108

11-
- **Backend**: Rust with gRPC server using [Tonic](https://github.com/hyperium/tonic) and [Prost](https://github.com/tokio-rs/prost)
12-
- **Frontend**: Nuxt.js/Vue.js with TypeScript using [ConnectRPC](https://connectrpc.com/)
13-
- **Communication**: gRPC with Protocol Buffers
14-
15-
### Backend Stack
16-
- **Tonic**: A gRPC implementation for Rust built on async/await
17-
- **Prost**: Protocol buffer implementation for Rust with serialization support
18-
- **Tonic-Web**: Enables gRPC-Web for browser compatibility
19-
20-
### Frontend Stack
21-
- **ConnectRPC**: Type-safe gRPC-Web client for TypeScript
22-
- **Buf**: Protocol buffer toolchain for code generation
23-
- **Generated TypeScript types**: Automatically generated from `.proto` files
9+
- **Backend**: Rust with [Tonic](https://github.com/hyperium/tonic) gRPC + [SQLx](https://github.com/launchbadge/sqlx)/SQLite
10+
- **Frontend**: [Nuxt 4](https://nuxt.com) + Vue 3 + [Tailwind CSS v4](https://tailwindcss.com)
11+
- **Communication**: gRPC-Web via [ConnectRPC](https://connectrpc.com)
12+
- **Auth**: [Clerk](https://clerk.com) (ready to enable)
13+
- **Deployment**: Docker with [cargo-chef](https://github.com/LukeMathWalker/cargo-chef) caching
2414

2515
## Prerequisites
2616

27-
Install the following dependencies:
28-
29-
- [Protocol Compiler (protoc)](https://grpc.io/docs/protoc-installation/)
30-
- [Buf CLI](https://buf.build/docs/installation)
3117
- [Rust](https://rustup.rs/)
3218
- [Bun](https://bun.sh)
19+
- [Protocol Compiler (protoc)](https://grpc.io/docs/protoc-installation/)
20+
- [Buf CLI](https://buf.build/docs/installation)
3321

34-
## Installation
22+
## Quick Start
3523

3624
```bash
37-
bun install
25+
# Install frontend dependencies
26+
cd frontend && bun install && cd ..
27+
28+
# Generate TypeScript types from protos
29+
cd frontend && bun run generate && cd ..
30+
31+
# Start both backend and frontend
32+
bun run dev
3833
```
3934

40-
## Running the Application
35+
The backend runs on `http://localhost:50051` (gRPC) and the frontend on `http://localhost:3000`.
4136

42-
Start all services in development mode:
37+
## Project Structure
4338

44-
```bash
45-
bun run dev
4639
```
40+
bufstack/
41+
├── backend/
42+
│ ├── api/ # gRPC server (Tonic, port 50051)
43+
│ ├── data/ # Database layer (SQLx + SQLite)
44+
│ ├── services/ # Business logic
45+
│ ├── io/ # IO utilities
46+
│ └── workers/ # Background workers
47+
├── frontend/
48+
│ ├── app/
49+
│ │ ├── composables/useGrpc.ts # gRPC client composable
50+
│ │ ├── gen/ # Generated protobuf TypeScript
51+
│ │ └── pages/ # Vue pages
52+
│ └── server/api/rpc/ # gRPC proxy route
53+
├── protos/ # Protocol Buffer definitions
54+
└── scripts/ # Build & deploy scripts
55+
```
56+
57+
## Adding a New Service
58+
59+
1. Define your service in `protos/your_service.proto`
60+
2. Add the proto to `backend/api/build.rs`
61+
3. Create `backend/api/src/services/your_service.rs`
62+
4. Register in `backend/api/src/grpc.rs`
63+
5. Regenerate types: `cd frontend && bun run generate`
64+
65+
## Enabling Auth
66+
67+
Clerk auth middleware is included but disabled by default. To enable:
68+
69+
1. Set `NUXT_CLERK_SECRET_KEY` and `NUXT_PUBLIC_CLERK_PUBLISHABLE_KEY` environment variables
70+
2. Uncomment the auth interceptor lines in `backend/api/src/grpc.rs`
4771

48-
Or run services individually:
72+
## Docker
4973

5074
```bash
51-
# Backend API server
52-
bun run dev:backend
75+
# Development
76+
docker compose up
5377

54-
# gRPC server
55-
bun run dev:grpc
78+
# Production build & push
79+
./scripts/build-and-push.sh
5680

57-
# Frontend development server
58-
bun run dev:frontend
81+
# Deploy
82+
./scripts/deploy.sh
5983
```

0 commit comments

Comments
 (0)