A Minecraft item shop where every order is verified over Discord before it reaches the seller.
Buyers check out with their Discord handle and their Minecraft IGN. They get a one-time order code, the bot DMs them about it, and once the code checks out the bot asks them “are these your items?”. Tapping Yes DMs the seller the items, the buyer's IGN and their Discord handle.
Open the shop · Seller dashboard · Track an order
Rendering mermaid diagram...
The site's own Yes / No buttons call the exact same code as the Discord ones, so an order behaves identically either way — and the whole flow still works if Discord isn't connected yet (you just get a warning instead of a DM).
You need a bot before any DMs will send. Fifteen minutes, once.
- Go to the Discord Developer Portal →
New Application. Name it
NexusMarket. - Bot tab → Reset Token → copy it. That's
DISCORD_BOT_TOKEN. - On the same page, turn Server Members Intent on (NexusMarket uses it to turn a Discord username into a user ID).
- General Information tab → copy Public Key. That's
DISCORD_PUBLIC_KEY. - Still on General Information, set Interactions Endpoint URL to the live URL of
interactions.ts: https://pyroproxies--eaa920dac83211f19bd41607ee4eb77e.web.val.run Discord immediately POSTs a signed ping to it — if it saves without an error, your public key is correct. (It will fail untilDISCORD_PUBLIC_KEYis saved below, so do that first.) - OAuth2 → URL Generator → scopes
bot+applications.commands, permissionsSend Messages. Open the generated URL and invite the bot to your server. The bot must share a server with a buyer to DM them. - Get your own numeric user ID: Discord → Settings → Advanced → Developer Mode on,
then right-click your name → Copy User ID. That's
DISCORD_OWNER_ID, and it's where confirmed orders land.
Every item can carry two prices in server/catalog.ts:
{
id: "mc-netherite-sword",
price: 8.99, // real money (USD)
priceIg: 5_000_000, // in-game money, paid on the server
...
}
At checkout the buyer picks one, and that choice travels with the order the whole way: the item list, the totals in Discord, and the amount the seller is told to collect. In-game orders show up in the seller's DM as "collect 21,000,000$ in game".
Leave priceIg off an item (or set it to 0) and it becomes real money only —
the card shows "real money only", and switching the cart to in-game money blocks
checkout with an itemised reason. That's the right setting for store ranks and for
selling in-game money itself, which you can't pay for with in-game money.
GAME_NAME and SERVER_NAME label all of this in the UI; the currency is
described by IG_LABEL in the catalog file.
| Key | What it's for |
|---|---|
DISCORD_BOT_TOKEN | Bot token. Without it the shop runs but sends no DMs. |
DISCORD_PUBLIC_KEY | Verifies that button clicks really came from Discord. |
DISCORD_GUILD_ID | Your server's ID — used to resolve a buyer's username to an ID. |
DISCORD_OWNER_ID | Your numeric user ID. Confirmed orders are DMed here. |
DISCORD_OWNER_USERNAME | Optional. Defaults to shawtythehottie123. |
GAME_NAME | Optional. Label shown to buyers; defaults to Minecraft. |
SERVER_NAME | Optional. Your server's name, shown in the hero badge. |
ADMIN_KEY | Optional but recommended. Unlocks /admin. |
PAYMENT_LINK | Optional. A PayPal/Cash App link shown at checkout. |
Set them in the val's environment variables — the site tells you when the bot isn't wired
up yet, and every API response carries a warning explaining what was skipped.
Items live in server/catalog.ts and are seeded into SQLite. Change
prices, names, enchants and delivery times there, then bump SEED_VERSION — the
catalog table is replaced wholesale on the next request, so adding, removing and
repricing items all work the same way. Categories ("Gear", "Currency", "Spawners & Rare",
…) become the filter chips automatically.
Already-placed orders are never touched: each order stores its own snapshot of item names and prices.
/admin lists every order with the buyer's Discord handle, IGN, items, total and status,
behind the ADMIN_KEY. pending means the buyer hasn't entered their code yet;
awaiting_confirmation means they're looking at the items; confirmed means you've
already been DMed.
index.ts Hono server: pages + public API
interactions.ts Discord Interactions Endpoint URL handler
server/
catalog.ts The Minecraft item catalog (edit me)
db.ts SQLite schema, items and orders
discord.ts Discord REST helpers + message builders
flow.ts purchase → verify → confirm → notify-the-seller
frontend/
root.tsx HTML shell
lib/api.ts Client types, fetch helpers, tiny router
components/
App.tsx Layout, cart, routing
Store.tsx Hero, how-it-works, catalog grid
Checkout.tsx Discord handle + IGN, order code screen
Verify.tsx "Are these your items?" confirmation
Admin.tsx Seller dashboard
ui.tsx Shared UI primitives
- No gateway connection: Val Town can't hold a WebSocket open, so the bot is purely outbound REST plus Discord's HTTP interactions endpoint.
- Prices are always recomputed server-side from the database, never trusted from the browser.
- Order codes skip
0/O/1/I/Lso they're easy to read off a screen and retype.