Skip to content

Commit 9672e34

Browse files
committed
docs: Update quickstart and workflow documentation for clarity and accuracy
1 parent ce14e1d commit 9672e34

File tree

2 files changed

+23
-23
lines changed

2 files changed

+23
-23
lines changed

content/docs/getting-started/quickstart.md

Lines changed: 9 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -29,23 +29,13 @@ What you build:
2929
go install github.com/go-sphere/sphere-cli@latest
3030
```
3131

32-
**Install Protoc Plugins:**
33-
```bash
34-
go install github.com/go-sphere/protoc-gen-sphere@latest
35-
go install github.com/go-sphere/protoc-gen-route@latest
36-
go install github.com/go-sphere/protoc-gen-sphere-binding@latest
37-
go install github.com/go-sphere/protoc-gen-sphere-errors@latest
38-
```
39-
4032
**Verify Installation:**
4133
```bash
4234
sphere-cli --version || sphere-cli -h
43-
protoc-gen-sphere --version
44-
protoc-gen-route --version
45-
protoc-gen-sphere-binding --version
46-
protoc-gen-sphere-errors --version
4735
```
4836

37+
> **Note**: You don't need to manually install protoc plugins. After creating a project, run `make init` to automatically install all required dependencies including protoc plugins.
38+
4939
## Create Your First Project
5040

5141
### 1. Bootstrap Project
@@ -57,11 +47,11 @@ sphere-cli create --name myproject --mod github.com/yourusername/myproject
5747
cd myproject
5848
```
5949

60-
This generates a new project with a clean structure based on [sphere-layout](https://github.com/go-sphere/sphere-layout).
50+
This generates a new project with a clean structure based on [sphere-layout](https://github.com/go-sphere/sphere-layout) and automatically installs all required protoc plugins and dependencies.
6151

6252
### 2. Define Database Schema (Ent)
6353

64-
Create your database entities in `/internal/pkg/database/ent/schema`. For example, create `internal/pkg/database/ent/schema/user.go`:
54+
Create your database entities in `internal/pkg/database/schema/`. For example, create `internal/pkg/database/schema/user.go`:
6555

6656
```go
6757
package schema
@@ -100,8 +90,6 @@ syntax = "proto3";
10090
10191
package shared.v1;
10292
103-
option go_package = "myproject/api/shared/v1;sharedv1";
104-
10593
message User {
10694
int64 id = 1;
10795
string name = 2;
@@ -117,8 +105,7 @@ syntax = "proto3";
117105
118106
package api.v1;
119107
120-
option go_package = "myproject/api/api/v1;apiv1";
121-
108+
import "buf/validate/validate.proto";
122109
import "google/api/annotations.proto";
123110
import "shared/v1/user.proto";
124111
@@ -138,13 +125,13 @@ service UserService {
138125
}
139126
140127
message GetUserRequest {
141-
int64 id = 1;
128+
int64 id = 1 [(buf.validate.field).int64.gt = 0];
142129
}
143130
144131
message CreateUserRequest {
145-
string name = 1;
146-
string email = 2;
147-
int32 age = 3;
132+
string name = 1 [(buf.validate.field).required = true];
133+
string email = 2 [(buf.validate.field).required = true];
134+
int32 age = 3 [(buf.validate.field).int32.gt = 0];
148135
}
149136
```
150137

content/docs/getting-started/workflow.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ A typical day-to-day development cycle with Sphere follows this pattern:
1111
## Core Development Loop
1212

1313
1. **Model Your Data**
14-
- Define Ent schemas in `internal/pkg/database/ent/schema/`
14+
- Define Ent schemas in `internal/pkg/database/schema/`
1515
- Run `make gen/db` to generate database code
1616

1717
2. **Define Your API**
@@ -47,6 +47,19 @@ make gen/wire
4747
make run
4848
```
4949

50+
**For a new project setup:**
51+
```bash
52+
# 1. Create project
53+
sphere-cli create --name myproject --mod github.com/user/myproject
54+
cd myproject
55+
56+
# 2. Initialize all dependencies and tools
57+
make init
58+
59+
# 3. Start development
60+
make run
61+
```
62+
5063
**For API changes:**
5164
```bash
5265
# 1. Update .proto files

0 commit comments

Comments
 (0)