LogoLogo
  • Getting Started
  • CLI
    • Docker
    • Config.yaml
  • GUI (SOON)
  • Tunnels Types
    • HTTP/s
      • HTTP/s plugins
      • HTTP/s apps
    • TLS
    • TCP
    • UDP
  • Reservations
    • Domain
    • Endpoint
  • Troubleshoot
    • Common errors
  • Tutorials
    • Expose a local web server
    • Expose Apache/Nginx web server
    • Share files from localhost
    • Use LocalXpose with Traefik
    • Expose PocketBase backend
    • Create a custom domain name
    • Make Let's Encrypt certificate
    • Access your IP camera remotely
    • Access your Raspberry Pi remotely
    • Sync your Keepass password manager
    • Expose localhost RASA chatbot for Telegram Integration
    • Expose your local Netdata Instance
    • Testing Stripe webhook
    • Expose localhost Kubernetes
    • Expose database server (PostgreSQL)
    • Exposing local Minecraft server
    • More Tutorials
Powered by GitBook
On this page
  • PocketBase
  • Prerequisites
  • Step 1 - Start PocketBase service
  • Step 2 - Create admin account
  • Step 3 - Create a collection with some records (optional)
  • Step 4 - API access
  • Step 5 - Access PocketBase API from the internet

Was this helpful?

  1. Tutorials

Expose PocketBase backend

This tutorial will explain how to expose a localhost PocketBase backend and give it a shareable link that is accessible from the internet.

PreviousUse LocalXpose with TraefikNextCreate a custom domain name

Last updated 2 years ago

Was this helpful?

PocketBase

for your next SaaS and Mobile app in 1 file, consisting of embedded database (SQLite) with realtime subscriptions, built-in users management, convenient dashboard UI and simple REST-ish API.

Explore the to see all the features and capabilities of PocketBase.

Prerequisites

  • .

  • .

Step 1 - Start PocketBase service

./pocketbase serve
# > Server started at: http://localhost:8090
#   - REST API: http://localhost:8090/api/
#   - Admin UI: http://localhost:8090/_/

Step 2 - Create admin account

Navigate to http://localhost:8090/_/ and fill the required fields.

Step 3 - Create a collection with some records (optional)

Create collection for example post collection:

Add some posts:

Step 4 - API access

Grant access to API list action:

Confirm API access via localhost:

curl http://localhost:8090/api/collections/posts/records

JSON result (example):

{
	"page": 1,
	"perPage": 30,
	"totalItems": 2,
	"items": [{
		"@collectionId": "WvcPifBVEqtFagS",
		"@collectionName": "posts",
		"created": "2022-07-29 03:03:09.326",
		"id": "uh6ON17M1PQvM7b",
		"post": "lorem ipsum dolor ... bibendum ... donec suscipit.",
		"slug": "hello-world",
		"title": "Hello world",
		"updated": "2022-07-29 03:03:09.326"
	}, {
		"@collectionId": "WvcPifBVEqtFagS",
		"@collectionName": "posts",
		"created": "2022-07-29 03:03:55.468",
		"id": "lk4Zp5nvuStwRzJ",
		"post": "lorem ipsum dolor sit amet, consectetur adipiscing elit. morbi bibendum commodo congue. vivamus efficitur aliquam felis, id viverra eros blandit sit amet. nam feugiat purus ac sem aliquam, sit amet dictum dui bibendum. sed tincidunt porttitor odio at feugiat. cras sed viverra libero. suspendisse potenti. nulla eu ullamcorper quam, in tempus nulla. quisque accumsan euismod finibus.\r\n",
		"slug": "testing-1-2-3",
		"title": "Testing 1 2 3",
		"updated": "2022-07-29 03:04:02.263"
	}]
}

Step 5 - Access PocketBase API from the internet

Create HTTP tunnel and forward the traffic to local PocketBase address.

loclx tunnel http --to localhost:8090 

which results:

Test API access via loclx.io sub-domain:

You can also utilize the PocketBase Javascript SDK () to consume the API.

Open Source backend
documentation
PocketBase
LocalXpose
pocketbase/js-sdk
Create admin account
Create collection
Add posts
Grant to List action
HTTP Tunnel
API access