# Nearvent
> Deposit-backed event registration you can add to any website. Guests put down a small refundable USDC deposit; people who show up get it back plus an equal share of the no-shows' deposits. Funds sit in a NEAR smart contract, never with the organizer or with us. No platform fee.
An event can instead sell a paid ticket (mode `Ticket`): one price per guest, credited to the host when the guest registers and never refunded. An event is either deposit or ticket, never both.
This file is for AI coding agents adding Nearvent to a host's website. Everything loads from the Nearvent host that serves this file; below it is written as `https://NEARVENT-HOST` (use the origin you fetched this file from).
## Add the widget (any site)
1. Load the script once per page:
``
2. Put the element next to the event, where guests would sign up:
``
The host creates or imports a full event on Nearvent (Integrate at /widget, or /create), then copies its button code from that event's Manage → Integration tab. The same event has a full guest page, admin tools and a quick checkout link. The button opens hosted checkout and can reopen the guest's QR pass, payout or refund. Never copy or modify embed.js; always load it from the host. The button needs no API keys or secrets.
### Attributes
- `mode="button"`: only the button
- `label="…"`: button text
- `then="https://…"`: the site's existing registration form; guests pay the deposit first, then continue there. `{account}` and `{event}` in the URL are replaced (e.g. `?ref={account}`)
- `theme="light|dark|auto"`, `accent="#hex"`, `font="geist|poppins|system"`, `display="serif"`, `radius="12"`: match the site's design
### JavaScript
- `NearEvents.open(EVENT_ID, { then, accent, theme })` opens sign-up from the site's own button
- `window.addEventListener("near-events:registered", e => e.detail)` → `{ eventId, accountId }`
- The element also fires `registered` (bubbles, composed)
### No scripts allowed
``
### Just a link
`https://NEARVENT-HOST/p/EVENT_ID` is the payment page (add `?then=` the same way). Use it in a Luma event description, Instagram bio, WhatsApp, email or a QR code at the venue.
## Where to paste, per platform
- Plain HTML / static: both lines into the page
- Next.js: `next/script` with `strategy="afterInteractive"`, render `` in JSX; TypeScript: declare `"near-event"` in `React.JSX.IntrinsicElements`
- React (Vite): script tag in index.html, element in a component
- Vue / Nuxt: script in index.html or `app.head`; `compilerOptions.isCustomElement = (tag) => tag === "near-event"`
- Svelte / Astro: script in the root layout
- Angular: script in index.html, `CUSTOM_ELEMENTS_SCHEMA`
- WordPress: a "Custom HTML" block
- Webflow: an "Embed" element
- Tilda: an "HTML code" block (T123)
- Wix: "Embed code" → "Embed HTML"
- Squarespace: a "Code" block
- Framer: an "Embed" component (HTML)
- Luma, Google Forms, Typeform, Eventbrite: they don't run scripts; put the payment link `https://NEARVENT-HOST/p/EVENT_ID?then=` in the description or first question
## Content-Security-Policy
If the site sets one, allow: `script-src`, `frame-src` and `connect-src` for `https://NEARVENT-HOST`.
## Read-only API
`GET https://NEARVENT-HOST/api/embed/EVENT_ID` → `{ id, title, starts_at, ends_at, status, deposit_usdc, mode, going, capacity, full }` (CORS open). `mode` is `Deposit` or `Ticket`; `deposit_usdc` is the price in both.
## Verify
Run the site, open the page, confirm the deposit box or button renders and that clicking Pay deposit opens the Nearvent window. Report which files changed.