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.
-
Let’s install
hpyfrom itsbetachannel, then check it:brew brew install happyproto/tap/hpy-betahpy --version
For the install script and other package managers, see Install hpy.
-
Now let’s create a project:
hpy hpy happyview create --name my-appcreateasks 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 tomy-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. -
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,
devprints: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.
-
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 edithello.luaand save it, the next request runs the new version.
Next steps
Section titled “Next steps”- Running locally: what
devreloads, where it keeps data, and its options, including a local atproto network. - Installation: every install method, each
createprompt, and the filescreatewrites.
© HappyProto

