example

command
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 20, 2026 License: AGPL-3.0 Imports: 12 Imported by: 0

README

useradmin example

A self-contained example server that boots useradmin on an in-memory SQLite database. No external services required.

Run

go run ./example

Then open http://localhost:8080/ in your browser.

The repo includes a taskfile.yml and .air.toml for hot-reload development with Air and Task.

Install the tools once:

# Install task:  https://taskfile.dev/installation/
# Install air:
task air:install

Then start the example with hot reload:

task dev

Or use Air directly:

air

What it does

  • Creates an in-memory SQLite database (reset on every restart)
  • Initializes userstore, geostore (with auto-seed), and sessionstore with auto-migration
  • Seeds 40 sample users (mixed statuses) plus 1 administrator
  • Mounts the user admin panel at /admin/users
  • Serves a landing page at / that links into the admin

Authentication

The example is open (no authentication) so you can click around immediately. In a real integration, provide AuthUserID and AuthUser callbacks that read your session/JWT from the request context, and gate the /admin/users route behind your auth middleware.

Persistence

To use a file-based database instead of in-memory, change dbFile:

const dbFile = "useradmin_example.db"

Data will persist across restarts.

Documentation

Overview

Example useradmin server.

Boots an HTTP server with an in-memory SQLite database and mounts the useradmin panel at /admin/users. No external services required.

Run from the useradmin module root:

go run ./example

Then open http://localhost:8080/ in your browser.

The example is open (no authentication) so you can click around immediately. To wire authentication, provide AuthUserID and AuthUser callbacks that read your session/JWT from the request context.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL