1. Custom Application
  2. Custom Application
Edit on GitHub

Custom Application

Use xpb plugins inside a custom PocketBase application for modularity.

You can still take advantage of the PocketBuilds ecosystem even when building a custom pocketbase application. Using xpb in this way is a great way to organize and modularize your project.

my_project
hooks
hooks.go
api
api.go
go.mod
go.sum
main.go
go
// main.go
package main

import (
	"log"

	"github.com/pocketbase/pocketbase"
	"github.com/pocketbuilds/xpb"

	_ "github.com/pocketbuilds/xpb/pkg/plugins/defaults"

	_ "my_project/api"
	_ "my_project/hooks"

	_ "github.com/pocketbuilds/created_by"
	_ "github.com/pocketbuilds/last_login"
)

func main() {
	app := pocketbase.New()

	if err := xpb.Setup(app); err != nil {
		log.Fatal(err)
	}

	if err := app.Start(); err != nil {
		log.Fatal(err)
	}
}