This quickstart uses the current PassKit TypeScript gRPC SDK and follows the flows in PassKit's Node and Java quickstarts.
It demonstrates how to:
- connect to PassKit with mutual TLS;
- upload pass images;
- create templates, a membership program, and tiers;
- enrol and update members;
- check a member in and out;
- list members and member events with server-streaming RPCs;
- create a carrier, airports, flight designator, flight, and boarding pass; and
- clean up the objects created by the example.
- Node.js 20 or later
- A free PassKit account
- PassKit SDK credentials from Developer Tools in your account
-
Put the following credentials in
certs/:ca-chain.pemcertificate.pemkey.pem
-
Update the API region in
config/config.ts. Usegrpc.pub1.passkit.iofor Europe orgrpc.pub2.passkit.iofor the US. -
Install dependencies. The latest SDK commit is currently ahead of npm, so it is pinned to its GitHub source archive and built automatically during installation.
npm install
-
To run flights, provide the identifier of an Apple pass certificate already uploaded to PassKit:
export PASSKIT_APPLE_CERTIFICATE='pass.com.your-airline'
-
Supply the private-key passphrase and run all four quickstarts:
PASSKIT_PASSPHRASE='your-passphrase' npm run dev
Run one quickstart at a time with --quickstart:
npm run dev -- --quickstart loyalty
npm run dev -- --quickstart coupons
npm run dev -- --quickstart event-tickets
npm run dev -- --quickstart flightsThe examples delete the resources they create after completing. Pass --keep if you want to inspect them in your PassKit account:
npm run dev -- --quickstart loyalty --keepThe repository builds and runs in both module formats. You do not need to edit imports or change package.json when switching—the npm script selects the appropriate build.
Use ESM:
npm run dev:esm -- --quickstart loyaltyUse CommonJS:
npm run dev:cjs -- --quickstart loyaltynpm run dev is an alias for dev:esm, so ESM is the default. The -- forwards subsequent options such as --quickstart and --keep to the quickstart.
First build both formats:
npm run buildThen select the format when starting:
# ESM
npm run start:esm -- --quickstart loyalty
# CommonJS
npm run start:cjs -- --quickstart loyaltynpm start is an alias for start:esm. To retain created PassKit resources, the same flags work with either format:
npm run start:esm -- --quickstart coupons --keep
npm run start:cjs -- --quickstart coupons --keepnpm run build:esm
npm run build:cjsThe ESM compiler uses tsconfig.esm.json and writes to dist/esm. The CommonJS compiler uses tsconfig.cjs.json and writes to dist/cjs. Each build script also writes a small package.json into the output directories so Node interprets their .js files correctly.
| Task | ESM | CommonJS |
|---|---|---|
| Develop/run | npm run dev:esm |
npm run dev:cjs |
| Build | npm run build:esm |
npm run build:cjs |
| Run built output | npm run start:esm |
npm run start:cjs |
| Output | dist/esm |
dist/cjs |
npm run build
npm startThe SDK uses Buf-generated message schemas. Create messages with create(Schema, initialValues). ConnectRPC supplies the gRPC transport and exposes server streams as async iterables.