|
1 | | -# frame [](https://github.com/pitabwire/frame/actions/workflows/run_tests.yml) [](https://deepwiki.com/pitabwire/frame) |
| 1 | +# Frame |
2 | 2 |
|
3 | | -A simple frame for quickly setting up api servers based on [gocloud](https://github.com/google/go-cloud) framework. |
| 3 | +[](https://github.com/pitabwire/frame/actions/workflows/run_tests.yml) |
| 4 | +[](https://deepwiki.com/pitabwire/frame) |
4 | 5 |
|
5 | | -Features include: |
| 6 | +A fast, extensible Golang framework with a clean plugin-based architecture. |
6 | 7 |
|
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. |
14 | 9 |
|
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 |
18 | 11 |
|
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 |
20 | 20 |
|
21 | | -``` |
22 | | - go get -u github.com/pitabwire/frame |
| 21 | +## Install |
| 22 | + |
| 23 | +```bash |
| 24 | +go get -u github.com/pitabwire/frame |
23 | 25 | ``` |
24 | 26 |
|
25 | | -# Example |
| 27 | +## Minimal Example |
| 28 | + |
| 29 | +```go |
| 30 | +package main |
26 | 31 |
|
27 | | -````go |
28 | 32 | 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" |
35 | 37 | ) |
36 | 38 |
|
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") |
39 | 50 | } |
| 51 | +``` |
40 | 52 |
|
| 53 | +## Documentation |
41 | 54 |
|
42 | | -func main() { |
| 55 | +- Start here: `docs/index.md` |
| 56 | +- Live site: https://pitabwire.github.io/frame/ |
| 57 | + |
| 58 | +## Docs Site (MkDocs) |
43 | 59 |
|
44 | | - serviceName := "service_authentication" |
45 | | - ctx := context.Background() |
| 60 | +```bash |
| 61 | +pip install mkdocs mkdocs-material |
| 62 | +mkdocs serve |
| 63 | +``` |
46 | 64 |
|
47 | | - router := mux.NewRouter().StrictSlash(true) |
48 | | - router.HandleFunc("/", handler) |
| 65 | +## Development |
49 | 66 |
|
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: |
56 | 68 |
|
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: |
59 | 78 |
|
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 |
61 | 83 |
|
| 84 | +AI-assisted contributions are welcome. If you use AI tools, please verify behavior locally and include tests where relevant. |
62 | 85 |
|
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. |
0 commit comments