Skip to content

Commit 0476f0e

Browse files
committed
docs: align examples, add plugin/AI guidance and samples
1 parent 2a51c04 commit 0476f0e

File tree

22 files changed

+566
-62
lines changed

22 files changed

+566
-62
lines changed
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: "Bug report"
2+
description: "Report a bug in Frame"
3+
title: "[Bug]: "
4+
labels: ["bug"]
5+
body:
6+
- type: textarea
7+
id: summary
8+
attributes:
9+
label: Summary
10+
description: What happened?
11+
validations:
12+
required: true
13+
- type: textarea
14+
id: steps
15+
attributes:
16+
label: Steps to Reproduce
17+
description: Provide minimal steps.
18+
validations:
19+
required: true
20+
- type: textarea
21+
id: expected
22+
attributes:
23+
label: Expected Behavior
24+
validations:
25+
required: true
26+
- type: textarea
27+
id: logs
28+
attributes:
29+
label: Logs / Stack Traces
30+
render: shell
31+
- type: input
32+
id: version
33+
attributes:
34+
label: Frame Version / Commit
35+
placeholder: e.g. v0.9.1 or commit SHA
36+
validations:
37+
required: true
38+
- type: input
39+
id: go
40+
attributes:
41+
label: Go Version
42+
placeholder: e.g. go1.22.2
43+
validations:
44+
required: true
45+
- type: input
46+
id: os
47+
attributes:
48+
label: OS
49+
placeholder: e.g. Ubuntu 22.04
50+
validations:
51+
required: true

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
blank_issues_enabled: true
2+
contact_links:
3+
- name: Questions / Discussions
4+
url: https://github.com/pitabwire/frame/discussions
5+
about: Ask questions or propose ideas.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: "Docs request"
2+
description: "Ask for documentation improvements"
3+
title: "[Docs]: "
4+
labels: ["documentation"]
5+
body:
6+
- type: textarea
7+
id: gap
8+
attributes:
9+
label: Documentation Gap
10+
description: What is missing or unclear?
11+
validations:
12+
required: true
13+
- type: textarea
14+
id: suggestion
15+
attributes:
16+
label: Suggested Content
17+
description: What should be added?
18+
- type: textarea
19+
id: context
20+
attributes:
21+
label: Use Case
22+
description: How do you plan to use this?
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: "Feature request"
2+
description: "Suggest a new feature or improvement"
3+
title: "[Feature]: "
4+
labels: ["enhancement"]
5+
body:
6+
- type: textarea
7+
id: problem
8+
attributes:
9+
label: Problem Statement
10+
description: What problem are you trying to solve?
11+
validations:
12+
required: true
13+
- type: textarea
14+
id: proposal
15+
attributes:
16+
label: Proposed Solution
17+
description: What should Frame do?
18+
validations:
19+
required: true
20+
- type: textarea
21+
id: alternatives
22+
attributes:
23+
label: Alternatives Considered
24+
- type: textarea
25+
id: context
26+
attributes:
27+
label: Additional Context

CONTRIBUTING.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Contributing to Frame
2+
3+
Thanks for helping make Frame better. We welcome contributions of all sizes: docs, examples, tests, new integrations, and core features.
4+
5+
## What We’re Looking For
6+
7+
High-impact contributions that improve usability and adoption:
8+
9+
- Clear onboarding docs, tutorials, and recipes
10+
- Example services that demonstrate real patterns
11+
- New Go Cloud drivers (queue, cache, datastore)
12+
- Middleware, interceptors, or plugins
13+
- Testing utilities and benchmarks
14+
- Performance or reliability improvements
15+
16+
## AI-Assisted Contributions
17+
18+
AI-assisted contributions are welcome. If you use AI tools, please:
19+
20+
- Verify behavior locally and include test coverage when relevant
21+
- Avoid copy-pasting unverified output into production code
22+
- Clearly describe what the change does and why
23+
- Include any prompts or tool notes if they help reviewers understand the change
24+
25+
## Development Workflow
26+
27+
1. Fork the repo and create a branch.
28+
2. Make changes with tests when possible.
29+
3. Run:
30+
31+
```bash
32+
go test -json -cover ./...
33+
```
34+
35+
4. Open a pull request with a clear description, screenshots/logs if helpful.
36+
37+
## Style Expectations
38+
39+
- Keep APIs simple and composable
40+
- Prefer explicit configuration via interfaces
41+
- Avoid breaking changes unless clearly justified
42+
- Keep docs up to date with code changes
43+
44+
## Reporting Issues
45+
46+
When filing issues, include:
47+
48+
- Frame version or commit hash
49+
- Reproduction steps
50+
- Logs or stack traces
51+
- Environment details (Go version, OS)
52+
53+
## License
54+
55+
By contributing, you agree that your contributions will be licensed under the repository’s license.

README.md

Lines changed: 64 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,86 @@
1-
# frame [![Build Status](https://github.com/pitabwire/frame/actions/workflows/run_tests.yml/badge.svg?branch=main)](https://github.com/pitabwire/frame/actions/workflows/run_tests.yml) [![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/pitabwire/frame)
1+
# Frame
22

3-
A simple frame for quickly setting up api servers based on [gocloud](https://github.com/google/go-cloud) framework.
3+
[![Build Status](https://github.com/pitabwire/frame/actions/workflows/run_tests.yml/badge.svg?branch=main)](https://github.com/pitabwire/frame/actions/workflows/run_tests.yml)
4+
[![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/pitabwire/frame)
45

5-
Features include:
6+
A fast, extensible Golang framework with a clean plugin-based architecture.
67

7-
- An http server
8-
- A grpc server
9-
- Database setup using [Gorm](https://github.com/go-gorm/gorm) with migrations and multitenancy support
10-
- Easy queue publish and subscription support
11-
- Localization
12-
- Authentication adaptor for oauth2 and jwt access
13-
- Authorization adaptor
8+
Frame helps you spin up HTTP and gRPC services with minimal boilerplate while keeping strong runtime management, observability, and portable infrastructure via Go Cloud.
149

15-
The goal of this project is to simplify starting up servers with minimal boiler plate code.
16-
All components are very pluggable with only the necessary configured items loading at runtime
17-
thanks to the power of go-cloud under the hood.
10+
## Features
1811

19-
# Getting started:
12+
- HTTP and gRPC servers with built-in lifecycle management
13+
- Datastore setup using GORM with migrations and multi-tenancy
14+
- Queue publish/subscribe (Go Cloud drivers: `mem://`, `nats://`, etc.)
15+
- Cache manager with multiple backends
16+
- OpenTelemetry tracing, metrics, and logs
17+
- OAuth2/JWT authentication and authorization adapters
18+
- Worker pool for background tasks
19+
- Localization utilities
2020

21-
```
22-
go get -u github.com/pitabwire/frame
21+
## Install
22+
23+
```bash
24+
go get -u github.com/pitabwire/frame
2325
```
2426

25-
# Example
27+
## Minimal Example
28+
29+
```go
30+
package main
2631

27-
````go
2832
import (
29-
"context"
30-
"fmt"
31-
"github.com/gorilla/mux"
32-
"github.com/pitabwire/frame"
33-
"log"
34-
"net/http"
33+
"context"
34+
"net/http"
35+
36+
"github.com/pitabwire/frame"
3537
)
3638

37-
func handler(w http.ResponseWriter, r *http.Request) {
38-
fmt.Fprintf(w, "Frame says yelloo!")
39+
func main() {
40+
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
41+
w.Write([]byte("Frame says hello"))
42+
})
43+
44+
_, svc := frame.NewService(
45+
frame.WithName("hello"),
46+
frame.WithHTTPHandler(http.DefaultServeMux),
47+
)
48+
49+
_ = svc.Run(context.Background(), ":8080")
3950
}
51+
```
4052

53+
## Documentation
4154

42-
func main() {
55+
- Start here: `docs/index.md`
56+
- Live site: https://pitabwire.github.io/frame/
57+
58+
## Docs Site (MkDocs)
4359

44-
serviceName := "service_authentication"
45-
ctx := context.Background()
60+
```bash
61+
pip install mkdocs mkdocs-material
62+
mkdocs serve
63+
```
4664

47-
router := mux.NewRouter().StrictSlash(true)
48-
router.HandleFunc("/", handler)
65+
## Development
4966

50-
server := frame.HttpHandler(router)
51-
service := frame.NewService(frame.WithName(serviceName,server))
52-
err := service.Run(ctx, ":7654")
53-
if err != nil {
54-
log.Fatal("main -- Could not run Server : %v", err)
55-
}
67+
To run tests, start the Docker Compose file in `./tests`, then run:
5668

57-
}
58-
````
69+
```bash
70+
go test -json -cover ./...
71+
```
72+
73+
## Contributing
74+
75+
If Frame helped you, please consider starring the repo and sharing it.
76+
77+
We’re actively looking for contributions that make Frame easier to use and more productive for Go teams. Examples:
5978

60-
Detailed guides can be found in `docs/index.md` (and on https://pitabwire.github.io/frame/).\n+\n+## Docs site (MkDocs)\n+\n+```bash\n+pip install mkdocs mkdocs-material\n+mkdocs serve\n+```\n*** End Patch"}**
79+
- Improve onboarding guides or add real-world examples
80+
- Add new Go Cloud drivers (queue, cache, datastore)
81+
- Add middleware, interceptors, or CLI tooling
82+
- Expand testing utilities or reference architectures
6183

84+
AI-assisted contributions are welcome. If you use AI tools, please verify behavior locally and include tests where relevant.
6285

63-
## development
64-
To run tests start the docker compose file in ./tests
65-
then run :
66-
````
67-
go test -json -cover ./...
68-
````
86+
Open an issue or PR with your idea — even small improvements make a big difference.

docs/ai-assistants.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# Using Frame with AI Coding Assistants
2+
3+
This page exists to help humans and AI tools converge on the **correct** Frame usage patterns.
4+
5+
## Preferred Bootstrap Pattern
6+
7+
Always start services like this:
8+
9+
```go
10+
ctx, svc := frame.NewService(
11+
frame.WithName("my-service"),
12+
frame.WithHTTPHandler(router),
13+
// other options...
14+
)
15+
16+
if err := svc.Run(ctx, ":8080"); err != nil {
17+
log.Fatal(err)
18+
}
19+
```
20+
21+
This is the canonical pattern that matches Frame’s API.
22+
23+
## Recommended Project Layout
24+
25+
```text
26+
/cmd/myservice/main.go
27+
/internal/handlers/...
28+
/internal/plugins/...
29+
/internal/clients/...
30+
/configs/...
31+
```
32+
33+
## How to Ask AI for Frame Code
34+
35+
Use these prompt patterns:
36+
37+
- “Generate a new HTTP service using Frame, using the canonical `ctx, svc := frame.NewService(...)` bootstrap pattern.”
38+
- “Create a new Frame plugin as a `WithXxx` option that registers a queue subscriber.”
39+
- “Add a datastore setup using `WithDatastore` and a migration step.”
40+
41+
## Frame Plugin Mental Model
42+
43+
A plugin is a `frame.Option` helper that configures a `Service` and registers startup/cleanup hooks. See `docs/plugins-options.md`.
44+
45+
## Don’ts
46+
47+
- Don’t assume `NewService` returns `*Service` directly; it returns `(context.Context, *Service)`.
48+
- Don’t assume `WithName` accepts a handler; use `WithHTTPHandler` separately.

docs/architecture.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,15 @@ Frame is a fast, extensible Go framework built around a minimal core `Service` a
1111

1212
Frame bootstraps a `Service` that owns shared runtime state and managers. Options configure the service and register startup hooks. The service then starts HTTP/gRPC servers, background workers, and pluggable components.
1313

14+
```
15+
ctx, svc := frame.NewService(
16+
frame.WithName("my-service"),
17+
frame.WithHTTPHandler(handler),
18+
// other options...
19+
)
20+
_ = svc.Run(ctx, ":8080")
21+
```
22+
1423
```
1524
Service
1625
-> Config (env, YAML, or custom)

docs/examples.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Examples
2+
3+
These examples are small, compilable, and use the canonical Frame bootstrap pattern.
4+
5+
## HTTP Basic
6+
7+
- Path: `examples/http-basic`
8+
- Run: `go run ./examples/http-basic`
9+
10+
## gRPC Basic
11+
12+
- Path: `examples/grpc-basic`
13+
- Run: `go run ./examples/grpc-basic`
14+
15+
## Queue Basic
16+
17+
- Path: `examples/queue-basic`
18+
- Run: `go run ./examples/queue-basic`
19+
20+
## Datastore Basic
21+
22+
- Path: `examples/datastore-basic`
23+
- Run: `go run ./examples/datastore-basic`

0 commit comments

Comments
 (0)