Skip to main content
The Placecard kit is an npm package, @pincast/placecard-kit, that puts a person’s cards on a table they can sort, filter and flip. Your server fetches the cards and your key stays there. The kit only draws what it’s handed. These steps build a small app called Lantern Walk with Vite and Vue. It runs on sample cards until you add a key.

Install

You need Node 20.12 or later. Work in an empty folder, or in the lantern-walk folder if you built Your first collect:

Save your set

GET /sets/{set} answers with a set’s name and counts, without its cards, so your app keeps its own copy of what it sent to PUT /sets/{set}. Save this one as data/set.json:
data/set.json
Here’s where the kit puts each field:

Add the server route

This file reads one person’s collects with your key and turns them into the collection the table draws. cardsRoute takes that person as its third argument. Save it as server/cards.js:
server/cards.js
ttFromAppSet marks the cards in the collects as held. The rest of the set waits under the Missing chip. A retired card shows only to a person who holds it, and an experience card never shows. null means no one is signed in. The table then shows 0 cards and a Your first card tile, with no chips, as it does for a person who holds nothing yet.

Draw the table

The config goes in src/tabletop.js:
src/tabletop.js
  • faces declares every face your cards take. lantern is this app’s own, drawn by the kit’s destination face.
  • theme.class goes on the table, over the kit’s Card room theme. fonts: [] means the page loads no outside fonts.
  • hand names where the kit stores a person’s hand of cards: localStorage, unless you pass a store.
Mount it from src/main.js. ttHtmlLock stops the page scrolling behind an open card:
src/main.js
Your face’s look lives in src/cards.css, under its data-face:
src/cards.css
Three small files finish the app. Vite mounts the route while you develop:
vite.config.js
index.html
.gitignore
Start it:
Open http://localhost:5173. Ferry Steps and Harbor Light are on the table, and Market Cross is under the Missing chip. On a phone, swipe the row of chips at the bottom of the screen to reach Missing. Tap a card to open it, then tap Back on the open card to read the other side. The Back link at the top of the table goes to /. To change its words or its address, add links: { back: { label: 'Home', href: '/' } } to the config. npx vite has no sign-in, and it runs on a different port from the :3000 address you registered. It shows the sample cards or, once you add a key, the one test person in PINCAST_ACTOR. With the .env from Your first collect, it has a key and no test person, so the table starts empty.

Go live

Every key is live, so what you write with one is real (Test and live). To ask for a key, write to andrew@pincast.fm. If you built Your first collect, your key and set are already in place. Skip to Show the table to the person who signed in.
  1. Change lantern-walk to your app’s id in server/cards.js and src/tabletop.js. It’s the part of your key between pck_ and the next underscore.
  2. Put your key in a file named .env, next to package.json, with the API’s address and one test person for npx vite to show. Git ignores it:
    .env
  3. Register the set. Its meta.listed is false, so it stays off the Placecard map and front page:
  4. Record one collect for that guest:
  5. Restart npx vite. The table now shows that guest’s one card, with the other two under Missing.

Show the table to the person who signed in

Your first collect ends with a server that knows who signed in. Serve the table from that server and hand it the session’s person. It runs on http://localhost:3000, the address your sign-in client allows, so sign-in and the table share one cookie. Work in the lantern-walk folder, with the files above beside server.mjs.
  1. Change lantern-walk to your app’s id in server/cards.js and src/tabletop.js. If you registered a scratch set, change old-town-lanterns in both files too.
  2. Build the table into dist:
  3. Save the table’s routes as server/table.js:
    server/table.js
  4. Add one import at the top of server.mjs:
  5. In the request handler at the bottom of server.mjs, add one line above res.writeHead(404).end():
  6. Stop the server if it’s running, and start it again:
Sign in at http://localhost:3000, then open http://localhost:3000/table. The table shows the cards that person holds, with the rest of the set under Missing. The person comes from the session, so nothing sent from the browser can ask for someone else’s cards. Anyone signed out who opens /table lands on /, where they can sign in. Run npx vite build again after you change anything in src, and restart the server after you change anything in server. In production, do the same on your own server: pass cardsRoute the person from your session, and run it from the project folder, where it reads data/set.json and dist.

Test it with the kit’s conformance suite

ttConformance checks your config, your collection, your theme’s tokens, your class names and the table’s markup at phone and laptop widths. Install what it needs:
test/conformance.test.js
The first run writes the expected markup to test/goldens. Read it and commit it, and later runs compare against it. A new app id, theme or face changes that markup, so write it again when you make one:

When something goes wrong

The kit’s contract lists every config key, face, theme token and event.