You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> Important Note: Go modules does not support module aliasing. So we changed the module name to "github.com/pocketbase/pocketbase" to "github.com/AlperRehaYAZGAN/postgresbase" in go.mod file and all imported package prefixes. You could change it back to "github.com/pocketbase/pocketbase" if you want to customize the project.
11
+
12
+
10
13
Pocketbase is a great product and very efficient for small-mid projects. It has no any additional setup for any other features and it is very easy to use on a single server.
11
14
12
15
In our use-case we really need to use postgres as a main database and operate it manually. Also we love what Pocketbase does with CRUD operation and RBAC implementations via simple notations. So we want to use it. Thus we forked it and make it compatible with postgres using its own library called ["pocketbase/dbx"](https://github.com/pocketbase/dbx).
@@ -18,6 +21,13 @@ We just added a following features additinonally to the Pocketbase:
18
21
- We converted [created and updated columns](https://github.com/AlperRehaYAZGAN/postgresbase/blob/master/migrations/1640988000_init.go#L73-L74) to postgres native date types `TIMESTAMPTZ` to support native date operations
19
22
- We write [json functions for postgres](https://github.com/AlperRehaYAZGAN/postgresbase/blob/master/migrations/1640988000_init.go) in migration files to support json equivalent operations from Pocketbase.
20
23
- We add support [RSA256 JWT Public Private Keys](https://github.com/AlperRehaYAZGAN/postgresbase/blob/master/tools/security/jwt.go) while encoding and decoding token. In our case we need to implement Pocketbase to our existing project with RSA keypair. Currently (Pocketbase v0.20.5) supports symmetric encoding only and we extend it.
24
+
- We add [Dockerfile](./Dockerfile) and [docker-compose.yml](./docker-compose.yml) for building and running the project.
25
+
26
+
## TODO
27
+
28
+
29
+
-[ ] OAuth2 challenge and state keys stored in cache on single instance. We need to make it remote cache or database to support oauth2 on deployed multiple instances.
30
+
-[ ] Jwt Extra Claims support on after login and register.
go run -tags pq github.com/pocketbase/pocketbase/examples/base serve
67
+
go run -tags pq ./examples/base serve
58
68
59
69
```
60
70
@@ -78,3 +88,39 @@ docker run -d --name postgresbase \
78
88
-e JWT_PUBLIC_KEY="$(cat $PWD/keys/public.pem)" \
79
89
<your-name>/postgresbase:1.0.0
80
90
```
91
+
92
+
## Extend Pocketbase (Postgresbase)
93
+
We just changed the database connection and added some features to Pocketbase. So you can use all features of current Pocketbase v0.25.0. You could check the [Pocketbase Documentation](https://pocketbase.io/docs) for more information. You can easily use Pocketbase as a library and extend it like shown below.
94
+
95
+
- Install library
96
+
```bash
97
+
go get github.com/AlperRehaYAZGAN/postgresbase # go version v1.21 or higher
98
+
```
99
+
100
+
- You can use everything like Pocketbase but only change the import path
101
+
```go
102
+
package main
103
+
104
+
import (
105
+
"log"
106
+
"os"
107
+
"time"
108
+
109
+
pocketbase "github.com/AlperRehaYAZGAN/postgresbase"// ! Just change the import path
110
+
"github.com/AlperRehaYAZGAN/postgresbase/core"// ! Just change the import path
111
+
"github.com/AlperRehaYAZGAN/postgresbase/plugins/migratecmd"// ! Just change the import path
0 commit comments