Skip to content

Quickstart

Let’s install hpy, create a project and call its starter query on a local instance. Installation and Running locally explain steps 1 to 3 in more detail.

You need macOS or Linux (on Windows, use WSL), and the DID of an atproto account to develop with. Use a test account, because the local instance writes to that account’s real PDS, and you probably don’t want test records piling up in your main account. pds.rip issues sandbox accounts.

  1. Let’s install hpy from its beta channel, then check it:

    brew
    brew install happyproto/tap/hpy-betahpy --version

    For the install script and other package managers, see Install hpy.

  2. Now let’s create a project:

    hpy
    hpy happyview create --name my-app

    create asks for a Superadmin DID (your test account’s DID), Interpreters (keep the default, Lua), Libraries (none are needed here) and an App name (it defaults to my-app). It then prints:

    Output

    created /home/you/my-app  cd my-app  hpy happyview dev

    The project contains a query lexicon, src/lexicons/com/example/hello.json, and the Lua script that answers it, hello.lua.

  3. Looking good! Let’s run the project as a local instance:

    my-app
    cd my-apphpy happyview dev

    The first run downloads HappyView and the project’s plugins. When the instance is ready, dev prints:

    Output

    happyview dev: serving /home/you/my-app at http://127.0.0.1:3000dashboard: http://127.0.0.1:3000/dashboard/writes from this instance go to your real PDS and the live network, where any instance indexing the same collections, including your production one, will index them; use `hpy happyview dev --network local` to keep test writes private

    Leave it running.

  4. In another terminal, let’s call the starter query:

    curl
    curl 'http://127.0.0.1:3000/xrpc/com.example.hello?name=Ada'

    The instance answers:

    Output

    {"message":"Hello, Ada!"}

    Without name, the query answers {"message":"Hello, world!"}. If we edit hello.lua and save it, the next request runs the new version.

  • Running locally: what dev reloads, where it keeps data, and its options, including a local atproto network.
  • Installation: every install method, each create prompt, and the files create writes.