forked from pocketbase/pocketbase
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 3d07f02
Showing
484 changed files
with
92,412 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# These are supported funding model platforms | ||
|
||
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] | ||
patreon: # Replace with a single Patreon username | ||
open_collective: # Replace with a single Open Collective username | ||
ko_fi: # Replace with a single Ko-fi username | ||
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel | ||
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry | ||
liberapay: # Replace with a single Liberapay username | ||
issuehunt: # Replace with a single IssueHunt username | ||
otechie: # Replace with a single Otechie username | ||
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry | ||
custom: ['https://www.paypal.com/donate?hosted_button_id=S98EMBN3G3HZY'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
name: basebuild | ||
|
||
on: | ||
pull_request: | ||
push: | ||
|
||
jobs: | ||
goreleaser: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: latest | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: '>=1.18.0' | ||
|
||
# This step usually is not needed because the /ui/dist is pregenerated locally | ||
# but its here to ensure that each release embeds the latest admin ui artifacts. | ||
# If the artificats differs, a "dirty error" is thrown - https://goreleaser.com/errors/dirty/ | ||
- name: Build Admin dashboard UI | ||
run: npm --prefix=./ui ci && npm --prefix=./ui run build | ||
|
||
- name: Run GoReleaser | ||
uses: goreleaser/goreleaser-action@v3 | ||
with: | ||
distribution: goreleaser | ||
version: latest | ||
args: release --rm-dist | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/.vscode/ | ||
|
||
.DS_Store | ||
|
||
# goreleaser builds folder | ||
/.builds/ | ||
|
||
# examples app directories | ||
pb_data | ||
pb_public | ||
|
||
# tests coverage | ||
coverage.out | ||
|
||
# plaintask todo files | ||
*.todo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
project_name: pocketbase | ||
|
||
dist: .builds | ||
|
||
before: | ||
hooks: | ||
- go mod tidy | ||
|
||
builds: | ||
- main: ./examples/base | ||
binary: pocketbase | ||
env: | ||
- CGO_ENABLED=0 | ||
goos: | ||
- linux | ||
- windows | ||
- darwin | ||
goarch: | ||
- amd64 | ||
- arm64 | ||
|
||
release: | ||
draft: true | ||
|
||
archives: | ||
- | ||
format: zip | ||
files: | ||
- LICENSE* | ||
- CHANGELOG* | ||
|
||
checksum: | ||
name_template: 'checksums.txt' | ||
|
||
snapshot: | ||
name_template: "{{ incpatch .Version }}-next" | ||
|
||
changelog: | ||
sort: asc | ||
filters: | ||
exclude: | ||
- '^examples:' | ||
- '^ui:' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
The MIT License (MIT) | ||
Copyright (c) 2022, Gani Georgiev | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software | ||
and associated documentation files (the "Software"), to deal in the Software without restriction, | ||
including without limitation the rights to use, copy, modify, merge, publish, distribute, | ||
sublicense, and/or sell copies of the Software, and to permit persons to whom the Software | ||
is furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all copies or | ||
substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING | ||
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, | ||
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
<p align="center"> | ||
<a href="https://pocketbase.io" target="_blank" rel="noopener"> | ||
<img src="https://i.imgur.com/ZfD4BHO.png" alt="PocketBase - open source backend in 1 file" /> | ||
</a> | ||
</p> | ||
|
||
<p align="center"> | ||
<a href="https://github.com/pocketbase/pocketbase/actions/workflows/release.yaml" target="_blank" rel="noopener"><img src="https://github.com/pocketbase/pocketbase/actions/workflows/release.yaml/badge.svg" alt="build" /></a> | ||
<a href="https://github.com/pocketbase/pocketbase/releases" target="_blank" rel="noopener"><img src="https://img.shields.io/github/release/pocketbase/pocketbase.svg" alt="Latest releases" /></a> | ||
<a href="https://pkg.go.dev/github.com/pocketbase/pocketbase" target="_blank" rel="noopener"><img src="https://godoc.org/github.com/ganigeorgiev/fexpr?status.svg" alt="Go package documentation" /></a> | ||
</p> | ||
|
||
[PocketBase](https://pocketbase.io) is an open source Go backend, consisting of: | ||
|
||
- embedded database (_SQLite_) with **realtime subscriptions** | ||
- backed-in **files and users management** | ||
- convenient **Admin dashboard UI** | ||
- and simple **REST-ish API** | ||
|
||
**For documentation and examples, please visit https://pocketbase.io/docs.** | ||
|
||
> ⚠️ Although the web API defintions are considered stable, | ||
> please keep in mind that PocketBase is still under active development | ||
> and therefore full backward compatibility is not guaranteed before reaching v1.0.0. | ||
|
||
## API SDK clients | ||
|
||
The easiest way to interact with the API is to use one of the official SDK clients: | ||
|
||
- **JavaScript - [pocketbase/js-sdk](https://github.com/pocketbase/js-sdk)** (_browser and node_) | ||
- **Dart** - _soon_ | ||
|
||
|
||
## Overview | ||
|
||
PocketBase could be used as a standalone app or as a Go framework/toolkit that enables you to build | ||
your own custom app specific business logic and still have a single portable executable at the end. | ||
|
||
### Installation | ||
|
||
```sh | ||
# go 1.18+ | ||
go get github.com/pocketbase/pocketbase | ||
``` | ||
|
||
### Example | ||
|
||
```go | ||
package main | ||
|
||
import ( | ||
"log" | ||
"net/http" | ||
|
||
"github.com/labstack/echo/v5" | ||
"github.com/pocketbase/pocketbase" | ||
"github.com/pocketbase/pocketbase/apis" | ||
"github.com/pocketbase/pocketbase/core" | ||
) | ||
|
||
func main() { | ||
app := pocketbase.New() | ||
|
||
app.OnBeforeServe().Add(func(e *core.ServeEvent) error { | ||
// add new "GET /api/hello" route to the app router (echo) | ||
e.Router.AddRoute(echo.Route{ | ||
Method: http.MethodGet, | ||
Path: "/api/hello", | ||
Handler: func(c echo.Context) error { | ||
return c.String(200, "Hello world!") | ||
}, | ||
Middlewares: []echo.MiddlewareFunc{ | ||
apis.RequireAdminOrUserAuth(), | ||
}, | ||
}) | ||
|
||
return nil | ||
}) | ||
|
||
if err := app.Start(); err != nil { | ||
log.Fatal(err) | ||
} | ||
} | ||
``` | ||
|
||
### Running and building | ||
|
||
Running/building the application is the same as for any other Go program, aka. just `go run` and `go build`. | ||
|
||
**PocketBase embeds SQLite, but doesn't require CGO.** | ||
|
||
If CGO is enabled, it will use [mattn/go-sqlite3](https://pkg.go.dev/github.com/mattn/go-sqlite3) driver, otherwise - [modernc.org/sqlite](https://pkg.go.dev/modernc.org/sqlite). | ||
|
||
Enable CGO only if you really need to squeeze the read/write query performance at the expense of complicating cross compilation. | ||
|
||
### Testing | ||
|
||
PocketBase comes with mixed bag of unit and integration tests. | ||
To run them, use the default `go test` command: | ||
```sh | ||
go test ./... | ||
``` | ||
|
||
Check also the [Testing guide](http://pocketbase.io/docs/testing) to learn how to write your own custom application tests. | ||
|
||
## Security | ||
|
||
If you discover a security vulnerability within PocketBase, please send an e-mail to **support at pocketbase.io**. | ||
|
||
All reports will be promptly addressed and you'll be credited accordingly. | ||
|
||
|
||
## Contributing | ||
|
||
PocketBase is free and open source project licensed under the [MIT License](LICENSE.md). | ||
|
||
You could help continuing its development by: | ||
|
||
- [Suggest new features, report issues and fix bugs](https://github.com/pocketbase/pocketbase/issues) | ||
- [Donate a small amount](https://pocketbase.io/support-us) | ||
|
||
> Please also note that PocketBase was initially created to serve as a new backend for my other open source project - [Presentator](https://presentator.io) (see [#183](https://github.com/presentator/presentator/issues/183)), | ||
so all feature requests will be first aligned with what we need for Presentator v3. |
Oops, something went wrong.