Skip to content

Commit f752c09

Browse files
Copilotleogenius360
andcommitted
Add quick start guide and implementation summary
Co-authored-by: leogenius360 <87181162+leogenius360@users.noreply.github.com>
1 parent 6074cc9 commit f752c09

File tree

2 files changed

+600
-0
lines changed

2 files changed

+600
-0
lines changed

QUICK_START.md

Lines changed: 352 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,352 @@
1+
# Quick Start Guide
2+
3+
Get started with the GeniusTechSpace protobuf schemas in 5 minutes!
4+
5+
## 1. Installation
6+
7+
### Install Buf CLI
8+
9+
**macOS**:
10+
```bash
11+
brew install bufbuild/buf/buf
12+
```
13+
14+
**Linux**:
15+
```bash
16+
curl -sSL https://github.com/bufbuild/buf/releases/download/v1.47.2/buf-Linux-x86_64 -o /usr/local/bin/buf
17+
chmod +x /usr/local/bin/buf
18+
```
19+
20+
**Windows** (Chocolatey):
21+
```bash
22+
choco install buf
23+
```
24+
25+
### Clone Repository
26+
27+
```bash
28+
git clone https://github.com/geniustechspace/protobuf.git
29+
cd protobuf
30+
```
31+
32+
## 2. Validate Schemas
33+
34+
```bash
35+
# Lint all schemas
36+
buf lint
37+
38+
# Check formatting
39+
buf format --diff
40+
41+
# Apply formatting
42+
buf format -w
43+
```
44+
45+
## 3. Generate Code
46+
47+
### Generate All Languages
48+
49+
```bash
50+
buf generate
51+
```
52+
53+
This generates code in `gen/` directory:
54+
```
55+
gen/
56+
├── go/ # Go packages
57+
├── python/ # Python modules
58+
├── java/ # Java classes
59+
├── typescript/ # TypeScript/JavaScript
60+
├── csharp/ # C# classes
61+
└── docs/ # Documentation
62+
```
63+
64+
### Generate Specific Domain
65+
66+
```bash
67+
# Generate only users domain
68+
buf generate --path proto/users/v1/
69+
70+
# Generate only auth domain
71+
buf generate --path proto/auth/v1/
72+
```
73+
74+
## 4. Use Generated Code
75+
76+
### Go Example
77+
78+
```go
79+
package main
80+
81+
import (
82+
"context"
83+
"log"
84+
85+
"google.golang.org/grpc"
86+
usersv1 "github.com/geniustechspace/protobuf/gen/go/users/v1"
87+
)
88+
89+
func main() {
90+
conn, _ := grpc.Dial("localhost:9090", grpc.WithInsecure())
91+
defer conn.Close()
92+
93+
client := usersv1.NewUserServiceClient(conn)
94+
95+
resp, err := client.CreateUser(context.Background(), &usersv1.CreateUserRequest{
96+
TenantId: "tenant_123",
97+
Email: "user@example.com",
98+
Username: "johndoe",
99+
FirstName: "John",
100+
LastName: "Doe",
101+
})
102+
103+
if err != nil {
104+
log.Fatal(err)
105+
}
106+
107+
log.Printf("Created user: %s", resp.User.Metadata.Id)
108+
}
109+
```
110+
111+
### Python Example
112+
113+
```python
114+
import grpc
115+
from gen.python.users.v1 import users_pb2, users_pb2_grpc
116+
117+
channel = grpc.insecure_channel('localhost:9090')
118+
client = users_pb2_grpc.UserServiceStub(channel)
119+
120+
response = client.CreateUser(users_pb2.CreateUserRequest(
121+
tenant_id='tenant_123',
122+
email='user@example.com',
123+
username='johndoe',
124+
first_name='John',
125+
last_name='Doe'
126+
))
127+
128+
print(f"Created user: {response.user.metadata.id}")
129+
```
130+
131+
### TypeScript Example
132+
133+
```typescript
134+
import { createPromiseClient } from "@connectrpc/connect";
135+
import { createGrpcTransport } from "@connectrpc/connect-node";
136+
import { UserService } from "./gen/typescript/users/v1/users_connect";
137+
138+
const transport = createGrpcTransport({
139+
baseUrl: "http://localhost:9090",
140+
});
141+
142+
const client = createPromiseClient(UserService, transport);
143+
144+
const response = await client.createUser({
145+
tenantId: "tenant_123",
146+
email: "user@example.com",
147+
username: "johndoe",
148+
firstName: "John",
149+
lastName: "Doe",
150+
});
151+
152+
console.log(`Created user: ${response.user?.metadata?.id}`);
153+
```
154+
155+
## 5. Explore Domains
156+
157+
### Core Domain
158+
Common types, tenant context, events
159+
```bash
160+
cat proto/core/README.md
161+
```
162+
163+
### Auth Domain
164+
Authentication, sessions, tokens
165+
```bash
166+
cat proto/auth/README.md
167+
```
168+
169+
### Users Domain
170+
User management, profiles
171+
```bash
172+
ls proto/users/v1/
173+
```
174+
175+
### Tenants Domain
176+
Multi-tenant management
177+
```bash
178+
cat proto/tenants/README.md
179+
```
180+
181+
### Billing Domain
182+
Subscriptions, invoices, payments
183+
```bash
184+
ls proto/billing/v1/
185+
```
186+
187+
### Access Policy Domain
188+
Roles, permissions, authorization
189+
```bash
190+
ls proto/access_policy/v1/
191+
```
192+
193+
### Notifications Domain
194+
Multi-channel notifications
195+
```bash
196+
ls proto/notifications/v1/
197+
```
198+
199+
## 6. Make Changes
200+
201+
### Create Feature Branch
202+
203+
```bash
204+
git checkout -b feature/my-changes
205+
```
206+
207+
### Edit Proto Files
208+
209+
```bash
210+
# Edit a domain
211+
vim proto/users/v1/users.proto
212+
213+
# Lint changes
214+
buf lint
215+
216+
# Format changes
217+
buf format -w
218+
```
219+
220+
### Check Breaking Changes
221+
222+
```bash
223+
buf breaking --against '.git#branch=main'
224+
```
225+
226+
### Test Generation
227+
228+
```bash
229+
buf generate
230+
```
231+
232+
### Commit Changes
233+
234+
```bash
235+
git add .
236+
git commit -m "feat: add new field to User"
237+
git push origin feature/my-changes
238+
```
239+
240+
## 7. Common Tasks
241+
242+
### List All Services
243+
244+
```bash
245+
find proto -name "*.proto" -exec grep "^service" {} +
246+
```
247+
248+
### List All Messages
249+
250+
```bash
251+
find proto -name "*.proto" -exec grep "^message" {} +
252+
```
253+
254+
### Count Proto Files
255+
256+
```bash
257+
find proto -name "*.proto" | wc -l
258+
```
259+
260+
### View Domain Structure
261+
262+
```bash
263+
tree proto/
264+
```
265+
266+
## 8. CI/CD
267+
268+
The repository includes GitHub Actions workflow that:
269+
- ✅ Lints all changes
270+
- ✅ Checks for breaking changes
271+
- ✅ Generates code for all languages
272+
- ✅ Creates schema inventory
273+
- ✅ Publishes to Buf Schema Registry (when configured)
274+
- ✅ Generates per-domain clients
275+
276+
Workflow runs on:
277+
- Every push
278+
- Every pull request
279+
280+
## 9. Documentation
281+
282+
### Main Documentation
283+
- [README.md](README.md) - Overview and features
284+
- [ARCHITECTURE.md](docs/ARCHITECTURE.md) - Design patterns
285+
- [CLIENT_GENERATION.md](docs/CLIENT_GENERATION.md) - Generate clients
286+
- [DEPLOYMENT.md](docs/DEPLOYMENT.md) - Deploy services
287+
- [CONTRIBUTING.md](CONTRIBUTING.md) - Contribution guide
288+
289+
### Domain Documentation
290+
- [Core](proto/core/README.md)
291+
- [Auth](proto/auth/README.md)
292+
- [Tenants](proto/tenants/README.md)
293+
294+
## 10. Support
295+
296+
### Issues
297+
Open an issue: https://github.com/geniustechspace/protobuf/issues
298+
299+
### Questions
300+
Start a discussion: https://github.com/geniustechspace/protobuf/discussions
301+
302+
### Community
303+
Join Discord: [link]
304+
305+
## Quick Reference
306+
307+
### Buf Commands
308+
309+
```bash
310+
buf lint # Lint schemas
311+
buf format -w # Format schemas
312+
buf breaking # Check breaking changes
313+
buf generate # Generate code
314+
buf dep update # Update dependencies
315+
```
316+
317+
### Directory Structure
318+
319+
```
320+
protobuf/
321+
├── proto/ # Protocol buffer definitions
322+
│ ├── core/ # Common types
323+
│ ├── auth/ # Authentication
324+
│ ├── users/ # User management
325+
│ ├── access_policy/ # Authorization
326+
│ ├── tenants/ # Multi-tenancy
327+
│ ├── billing/ # Payments
328+
│ └── notifications/ # Notifications
329+
├── gen/ # Generated code (gitignored)
330+
├── docs/ # Documentation
331+
├── buf.yaml # Buf configuration
332+
├── buf.gen.yaml # Code generation config
333+
└── .github/workflows/ # CI/CD pipelines
334+
```
335+
336+
### Key Concepts
337+
338+
- **Multi-Tenancy**: All requests include `tenant_id`
339+
- **Versioning**: v1, v2, etc. for backward compatibility
340+
- **Events**: Domain events for state changes
341+
- **Metadata**: All entities include common metadata
342+
- **Pagination**: Standard pagination for lists
343+
344+
## Next Steps
345+
346+
1. ✅ Install Buf and clone repo
347+
2. ✅ Generate code for your language
348+
3. ✅ Read domain documentation
349+
4. ✅ Build your first service
350+
5. ✅ Contribute improvements
351+
352+
Happy coding! 🚀

0 commit comments

Comments
 (0)