Enhanced PocketBase Server

A powerful extension of PocketBase with extensive monitoring, logging, and analytics capabilities.

Dashboard Preview

Core Features

System Monitoring

Real-time metrics for CPU, memory, disk, network, and runtime stats. Monitor your server's health at a glance.

Structured Logging

Comprehensive logging with error tracking and request tracing for better debugging and system insights.

Visitor Analytics

Track and analyze visitor statistics, page views, device types, and browsers to understand your user base.

PocketBase Integration

Seamlessly piggybacks off PocketBase's superuser authentication and CSS for a consistent experience.

Quick Start

Here's how to get started with pb-ext:

package main

import (
	"log"
	"net/http"
	"strconv"
	"time"

	app "github.com/magooney-loon/pb-ext/core"
	"github.com/pocketbase/pocketbase/core"
)

func main() {
	initApp()
}

func initApp() {
	srv := app.New()

	app.SetupLogging(srv)

	srv.App().OnServe().BindFunc(func(e *core.ServeEvent) error {
		app.SetupRecovery(srv.App(), e)
		return e.Next()
	})

	registerRoutes(srv.App())

	if err := srv.Start(); err != nil {
		srv.App().Logger().Error("Fatal application error",
			"error", err,
			"uptime", srv.Stats().StartTime,
			"total_requests", srv.Stats().TotalRequests.Load(),
			"active_connections", srv.Stats().ActiveConnections.Load(),
			"last_request_time", srv.Stats().LastRequestTime.Load(),
		)
		log.Fatal(err)
	}
}

To run the server:

go run cmd/server/main.go serve

Architecture

├── cmd/
│   └── server/          # Server initialization
└── core/
    ├── logging/         # Logging and error handling
    ├── monitoring/      # System metrics collection 
    └── server/          # Core server implementation

Dashboard Access

The enhanced dashboard provides a comprehensive view of your server's health and visitor analytics.

Admin Panel

127.0.0.1:8090/_

Server Dashboard

127.0.0.1:8090/_/_

The dashboard utilizes PocketBase's superuser authentication system, ensuring that only authorized administrators can access the monitoring and analytics features.