Skip to content

Local Development

This guide will help you get PocketKit running on your local machine.

Before you begin, make sure you have the following installed:

  • Node.js (v18 or higher)
  • Package manager (npm, yarn, or pnpm)
  • Git

The fastest way to get started is using the automated setup script:

Terminal window
# Clone the repository
git clone https://github.com/stijnbakk/PocketKit.git
cd PocketKit
# Run the get started script
./GET-STARTED.sh

The script will prompt you to choose between:

  1. SvelteKit (app-svelte directory)
  2. React/Next.js (app-react directory)

Then it will automatically:

  1. Initialize a fresh git repository
  2. Install dependencies (auto-detects pnpm/yarn/npm)
  3. Download PocketBase for your operating system
  4. Create an initial commit

Once complete, start developing:

Terminal window
# For SvelteKit
cd app-svelte
yarn dev
# For React/Next.js
cd app-react
yarn dev

If you prefer to set up manually or the script doesn’t work for your system, follow these steps.

PocketKit provides two frontend options:

PocketKit/
├── app-svelte/ # SvelteKit frontend application
├── app-react/ # Next.js frontend application
├── server/ # PocketBase backend (shared by both)
└── docs/ # Documentation (Starlight)

Choose one app directory based on your preferred framework.

Navigate to your chosen app directory and install the dependencies:

Terminal window
# For SvelteKit
cd app-svelte
yarn install
# OR for React/Next.js
cd app-react
yarn install

For local development, you need to download the PocketBase executable:

  1. Visit pocketbase.io
  2. Download the appropriate version for your operating system
  3. Place the pocketbase executable in the server/ directory

Note: Make sure the file is named pocketbase and is executable.

On macOS/Linux, you may need to make it executable:

Terminal window
chmod +x ../server/pocketbase

From your chosen app directory, run:

SvelteKit:

Terminal window
cd app-svelte
yarn dev

This single command will:

  • Start the SvelteKit dev server on http://localhost:5173
  • Launch PocketBase on http://localhost:8090

React/Next.js:

Terminal window
cd app-react
yarn dev

This single command will:

  • Start the Next.js dev server on http://localhost:3000
  • Launch PocketBase on http://localhost:8090

Once both servers are running:

SvelteKit:

React/Next.js:

On first run, you’ll need to create an admin account:

  1. Visit http://localhost:8090/_
  2. Create your admin email and password
  3. This account is for managing your backend (users, collections, settings)

Both apps use environment variables for configuration.

SvelteKit - Create .env in the app-svelte/ directory:

Terminal window
PUBLIC_POCKETBASE_URL=http://127.0.0.1:8090

React/Next.js - Create .env.local in the app-react/ directory:

Terminal window
NEXT_PUBLIC_POCKETBASE_URL=http://127.0.0.1:8090

Frontend code: Edit files in your chosen app directory - changes will hot reload automatically

  • SvelteKit: app-svelte/src/
  • Next.js: app-react/src/

Backend:

  • Schema: Use the PocketBase admin UI at http://localhost:8090/_
  • Hooks: Add JavaScript/TypeScript files to server/pb_hooks/ (requires PocketBase restart)

PocketBase uses SQLite and stores all data in server/pb_data/. This directory is created automatically when you first run PocketBase.

Both apps include complete auth flows:

SvelteKit:

React/Next.js:

Create a test user to verify everything works.

If port 5173 or 8090 is already in use:

  • SvelteKit: Stop the process using port 5173, or modify the port in vite.config.ts
  • PocketBase: Stop any running PocketBase instances, or modify the port in the dev script

If you get an error about PocketBase not being found:

  1. Make sure you downloaded the PocketBase executable
  2. Verify it’s in the server/ directory
  3. Ensure it’s named pocketbase (no file extension on macOS/Linux)
  4. Verify it’s executable (chmod +x server/pocketbase on macOS/Linux)

On macOS, you might see a security warning when running PocketBase:

  1. Go to System SettingsPrivacy & Security
  2. Look for a message about PocketBase being blocked
  3. Click Allow Anyway
  4. Run the dev command again

Now that you have PocketKit running locally:

  • Explore the Authentication system to understand how auth works
  • Learn how to Deploy to production
  • Start building your app:
    • SvelteKit: Modify files in app-svelte/src/routes/
    • Next.js: Modify files in app-react/src/app/