Skip to content

Petstore Example App

Garret Premo edited this page Mar 31, 2026 · 2 revisions

Petstore Example App

Overview

The Petstore API is a lightweight Bun + SQLite server included in the apijack repo. It serves as the running example throughout this wiki. Use it to follow along with any guide.

Prerequisites

Bun runtime is required.

curl -fsSL https://bun.sh/install | bash

Running the App

Clone the Petstore example repo and start the server:

git clone https://github.com/Premo-Cloud/apijack-petstore-example.git
cd apijack-petstore-example
bun run start

The server runs on port 3459.

Credentials

HTTP Basic Auth: username admin, password password

Endpoints

Method Path Description
GET /v3/api-docs OpenAPI 3.0 spec (no auth)
GET /pets List pets (filter: ?species=dog, ?status=available)
POST /pets Create a pet
GET /pets/:id Get a pet by ID
PUT /pets/:id Update a pet
DELETE /pets/:id Delete a pet
POST /pets/:id/adopt Adopt a pet (assign to owner)
GET /owners List owners
POST /owners Create an owner
GET /owners/:id Get owner with their pets
PUT /owners/:id Update an owner
DELETE /owners/:id Delete an owner

Data Model

Pets: id, name, species (dog/cat/bird/fish/rabbit), age, status (available/pending/adopted), ownerId (nullable)

Owners: id, name, email

Seed Data

The app starts with pre-loaded data. The database is in-memory, so it resets on each restart.

Owners

ID Name Email
1 Alice Johnson alice@example.com
2 Bob Smith bob@example.com

Pets

ID Name Species Age Status Owner
1 Buddy dog 3 adopted Alice
2 Whiskers cat 2 available
3 Goldie fish 1 available
4 Rex dog 5 adopted Bob
5 Luna cat 1 pending

Quick Test

Verify the server is running:

curl -s -u admin:password http://localhost:3459/pets | head -20

Clone this wiki locally