Skip to content

Commit 078ee3b

Browse files
committed
feat: Update documentation and improve content clarity across multiple files
1 parent cc8de91 commit 078ee3b

File tree

9 files changed

+90
-1003
lines changed

9 files changed

+90
-1003
lines changed

content/_index.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ layout: hextra-home
1111

1212
<div class="hx:mt-6 hx:mb-6">
1313
{{< hextra/hero-headline >}}
14-
Build pragmatic Go backends&nbsp;<br class="hx:sm:block hx:hidden" />with Sphere
14+
A pragmatic Go toolkit that starts&nbsp;<br class="hx:sm:block hx:hidden" />monolithic and scales to microservices
1515
{{< /hextra/hero-headline >}}
1616
</div>
1717

1818
<div class="hx:mb-12">
1919
{{< hextra/hero-subtitle >}}
20-
Monolithic-first toolkit with codegen for contracts, errors, stubs, and clients
20+
Define once in Protobuf, generate everything: handlers, routes, errors, and clients
2121
{{< /hextra/hero-subtitle >}}
2222
</div>
2323

@@ -27,27 +27,27 @@ layout: hextra-home
2727

2828
{{< hextra/feature-grid >}}
2929
{{< hextra/feature-card
30-
title="Contracts First"
31-
subtitle="Define APIs in Protobuf and entities in Ent; generate Go handlers, routers, bindings, and clients."
30+
title="Protocol-First Design"
31+
subtitle="Define once in Protobuf, generate everywhere. Get Go handlers, HTTP routing, client SDKs, and OpenAPI docs from a single source of truth."
3232
>}}
3333
{{< hextra/feature-card
34-
title="Monolith-First Template"
35-
subtitle="Start with a single binary using Gin + Wire; evolve to multi-service when needed."
34+
title="Pragmatic Monolith Template"
35+
subtitle="Start simple with Gin + Wire + Ent in a single binary. Clean architecture that scales from MVP to microservices when needed."
3636
>}}
3737
{{< hextra/feature-card
38-
title="Code Generation"
39-
subtitle="protoc-gen-sphere, protoc-gen-route, protoc-gen-sphere-binding, and protoc-gen-sphere-errors automate server, routing, tags, and typed errors."
38+
title="Complete Code Generation"
39+
subtitle="Automated toolchain with protoc-gen-sphere ecosystem: server stubs, HTTP routing, field binding, typed errors, and validation."
4040
>}}
4141
{{< hextra/feature-card
42-
title="Typed Errors"
43-
subtitle="Define error enums in .proto; get consistent HTTP JSON with status, code, reason, and message."
42+
title="Structured Error Handling"
43+
subtitle="Define error enums in protobuf with automatic HTTP status mapping. Get consistent JSON responses with code, reason, and message."
4444
>}}
4545
{{< hextra/feature-card
46-
title="Swagger & Clients"
47-
subtitle="Generate OpenAPI from contracts and optional TypeScript SDKs for frontends."
46+
title="Full-Stack Development"
47+
subtitle="Generate Swagger documentation, TypeScript SDKs, and validation schemas. Bridge backend and frontend with type safety."
4848
>}}
4949
{{< hextra/feature-card
50-
title="CLI & Layout"
51-
subtitle="sphere-cli and sphere-layout bootstrap projects with Makefile workflows and a sane project structure."
50+
title="Developer Experience"
51+
subtitle="sphere-cli for project scaffolding, Makefile workflows, and clean project structure. Focus on business logic, not boilerplate."
5252
>}}
5353
{{< /hextra/feature-grid >}}

content/docs/components/protoc-gen-route.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: protoc-gen-route
3-
weight: 35
3+
weight: 33
44
---
55

66
`protoc-gen-route` is a protoc plugin that generates routing code from `.proto` files. It is designed to inspect service definitions within your protobuf files and automatically generate corresponding route handlers based on a specified template. This plugin creates Go code that provides structured routing with operation constants, extra data handling, server interfaces, and codec interfaces for seamless integration with various transport protocols.
@@ -395,3 +395,7 @@ service UserService {
395395
- Combine with `protoc-gen-sphere-errors` for consistent error handling
396396
- Works with any transport layer that can use the generated interfaces
397397

398+
## See Also
399+
400+
- Concepts: ../../concepts/protocol-and-codegen
401+
- Component: ./protoc-gen-sphere

content/docs/components/protoc-gen-sphere-binding.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: protoc-gen-sphere-binding
3-
weight: 36
3+
weight: 34
44
---
55

66
`protoc-gen-sphere-binding` is a protoc plugin that generates Go struct tags for Sphere binding from `.proto` files. It is designed to inspect service definitions within your protobuf files and automatically generate corresponding Go struct tags based on sphere binding annotations.
@@ -278,3 +278,8 @@ func inspectTags() {
278278
}
279279
```
280280

281+
## See Also
282+
283+
- Guides: ../../guides/api-definitions
284+
- Component: ./protoc-gen-sphere
285+
- Concepts: ../../concepts/protocol-and-codegen

content/docs/components/protoc-gen-sphere-errors.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: protoc-gen-sphere-errors
3-
weight: 37
3+
weight: 35
44
---
55

66
`protoc-gen-sphere-errors` is a protoc plugin that generates error handling code from `.proto` files. It is designed to inspect enum definitions within your protobuf files and automatically generate corresponding error handling code based on the sphere errors framework. This plugin creates Go code that provides structured error handling with HTTP status codes, error codes, and customizable messages.
@@ -199,3 +199,8 @@ When used with Sphere's HTTP server utilities, these errors are automatically co
199199
- Sphere's Gin layer maps these to structured JSON with correct HTTP status
200200
- Pair with a global error parser if you need to merge validation/notfound/custom errors
201201
- The generated errors integrate seamlessly with Sphere's server utilities for consistent API responses
202+
203+
## See Also
204+
205+
- Guides: ../../guides/error-handling
206+
- Concepts: ../../concepts/protocol-and-codegen

content/docs/components/protoc-gen-sphere.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: protoc-gen-sphere
3-
weight: 38
3+
weight: 32
44
---
55

66
Generates HTTP server code from `.proto` service definitions, using `google.api.http` annotations and Sphere server utilities (Gin-based).
@@ -46,3 +46,9 @@ Notes
4646
- Works hand-in-hand with Sphere’s Gin helpers: `WithJson`, `ShouldBindJSON`, `ShouldBindUri`, `ShouldBindQuery`
4747
- Pair with `protoc-gen-sphere-binding` to inject binding tags into generated structs
4848

49+
## See Also
50+
51+
- Guides: ../../guides/api-definitions
52+
- Component: ./protoc-gen-sphere-binding
53+
- Component: ./protoc-gen-sphere-errors
54+
- Concepts: ../../concepts/protocol-and-codegen

content/docs/components/sphere-cli.md

Lines changed: 4 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: sphere-cli
3-
weight: 32
3+
weight: 31
44
---
55

66
Sphere CLI (`sphere-cli`) is a command-line tool designed to streamline the development of [Sphere](https://github.com/go-sphere/sphere) projects. It helps you create new projects, generate service code, manage Protobuf definitions, and perform other common development tasks.
@@ -139,70 +139,10 @@ Renames the Go module path across the entire repository. This is useful when you
139139
sphere-cli rename --old <old-module-path> --new <new-module-path>
140140
```
141141

142-
## Workflow Examples
142+
## Common Workflows
143143

144-
### Creating a New Project
145-
146-
```shell
147-
# 1. Create the project
148-
sphere-cli create --name myapp --module github.com/myorg/myapp
149-
150-
# 2. Navigate to the project
151-
cd myapp
152-
153-
# 3. Initialize dependencies
154-
make init
155-
156-
# 4. Generate initial code
157-
make gen/all
158-
```
159-
160-
### Adding a New Service
161-
162-
```shell
163-
# 1. Generate the proto file
164-
sphere-cli service proto --name UserService --package api.v1
165-
166-
# 2. Edit the generated proto file to add methods
167-
# vim proto/api/v1/user_service.proto
168-
169-
# 3. Generate the Go implementation
170-
sphere-cli service golang --name UserService --package api.v1 --mod github.com/myorg/myapp
171-
172-
# 4. Generate all code
173-
make gen/all
174-
```
175-
176-
### Working with Ent Schemas
177-
178-
```shell
179-
# 1. Define your Ent schemas in internal/pkg/database/ent/schema/
180-
181-
# 2. Convert Ent schemas to proto
182-
sphere-cli entproto --path ./internal/pkg/database/ent/schema --proto ./proto/entpb
183-
184-
# 3. Generate database code
185-
make gen/db
186-
187-
# 4. Generate API code
188-
make gen/proto
189-
```
190-
191-
## Integration with Make
192-
193-
Sphere projects use Makefiles to orchestrate common tasks. The CLI integrates well with these targets:
194-
195-
```makefile
196-
# Generate database code from Ent schemas
197-
gen/db:
198-
sphere-cli entproto
199-
go generate ./internal/pkg/database/ent
200-
201-
# Create a new service
202-
service/%:
203-
sphere-cli service proto --name $* --package api.v1
204-
sphere-cli service golang --name $* --package api.v1
205-
```
144+
- Quick project setup and generation: ../../getting-started/quickstart
145+
- Day-to-day development loop: ../../getting-started/workflow
206146

207147
## Best Practices
208148

@@ -245,4 +185,3 @@ make gen/all # Regenerate everything
245185
- [Quick Start](../../getting-started/quickstart) - Complete project setup guide
246186
- [Project Structure](../../concepts/project-structure) - Understanding the generated project layout
247187
- [Components Overview](../) - Details about protoc plugins used by sphere-cli
248-

0 commit comments

Comments
 (0)