Documentation

Prerequisites

Before setting up PocketKit, ensure you have the following installed:

  • Node.js (latest LTS version recommended)
  • Docker and Docker Compose

Installation Steps

  1. Clone the PocketKit repository

    git clone https://github.com/your-pocketkit-repo-url.git
    cd pocketkit
  2. Install dependencies

    npm install
  3. Set up environment variables

    Create a .env file in the root directory based on the .env.example file. Add the following variables:

    PUBLIC_POCKETBASE_URL=http://127.0.0.1:8090/
    PADDLE_API_KEY=your_paddle_api_key
    PADDLE_SECRET=your_paddle_secret
    PUBLIC_PADDLE_TOKEN=your_public_paddle_token
    APP_SECRET=your_app_secret

    Replace your_paddle_api_key, your_paddle_secret, and your_public_paddle_token with your actual Paddle credentials. Replace your_app_secret with a random string. Visit webhooksite to get a webhook token

    Explanation of variables:

    • PUBLIC_POCKETBASE_URL: The URL where PocketBase is accessible (both server-side and client-side)
    • PADDLE_API_KEY: Your Paddle API key for payment processing, reading user subscriptions etc
    • PADDLE_SECRET: Your Paddle secret for webhook verification
    • PUBLIC_PADDLE_TOKEN: Your public Paddle token for client-side Paddle.js initialization
    • APP_SECRET: A secret key used for various security purposes, including CSRF protection and hashing.

    Note: Ensure that your PocketBase instance is running on the specified URL. You may need to adjust this URL based on your specific setup or production environment.

  4. Start the development environment

    docker-compose up -d

    This will start PocketBase and MailHog containers as defined in the docker-compose.yaml file.

  5. Run the development server

    npm run dev

    This will start the SvelteKit development server.

Accessing Services

Configuration

PocketBase

PocketBase is configured to use the following:

  • Public directory: ./pocketbase/pb_public
  • Hooks directory: ./pocketbase/pb_hooks
  • Migrations directory: ./pocketbase/pb_migrations

The Paddle secret is passed to PocketBase as an environment variable.

OAuth2 settings

See Pocketbase documentation for more details on how to set up OAuth2. https://pocketbase.io/docs/authentication#oauth2-integration

Mail settings

For local development, you can use MailHog to intercept emails sent by your application. Login to PocketBase at http://localhost:8090/_/ and go to Settings > Mail > SMTP. Set the SMTP server to 172.17.0.1 and the port to 1025.

MailHog

MailHog is set up to intercept emails sent by your application during development. You can view these emails in the MailHog UI.