nd.js is a small script with web components for the parts of a site that
need a backend. On a Neural Draft hosted site it is served at /_nd/nd.js;
on any other website you load it from the workspace address.
Blocks
Theming: CSS variables
--nd-primary, --nd-surface, --nd-text,
--nd-radius, --nd-font-body, or the unstyled attribute to style them
yourself. get_design_kit on the hosted connector has the full guide.
JS API on window.ND: getPosts({lang, limit}), submitForm(id, fields),
getServices(), getAvailability(service, {month}), getSlots(service, date),
book({...}), subscribe(email, {lang}), getShop({lang}), basket,
order({...}), applyContent(root).
On a Neural Draft hosted site
On a site hosted elsewhere
WordPress, Webflow, Vercel, Netlify, plain HTML: loadnd.js from the
workspace address and use the same tags.
nd.js calls /_nd/api/* on the workspace address from the visitor’s
browser, so that website’s address must be allowed:
- Always allowed: the workspace address, its connected custom domains, and
the website saved on the workspace (with and without
www.). - Anything else: add the origin (
https://www.client.co.uk, no path):- admin: Settings → For developers → Domain and other websites;
- API:
PATCH /v1/projects/mewith{"allowed_origins": [...]}(the list is replaced;[]clears it); - chat:
update_site_basicswithallowed_origins.
- https only;
http://localhost:<port>is accepted for local testing. At most 20 origins.
Access-Control-Allow-Origin for its
own address (preflight 204). A browser on any other site is refused: the
preflight answers 403 and a POST answers 403 origin_not_allowed.
Requests never carry cookies or credentials, and the endpoints stay rate
limited and form-token protected.
Iframe alternative (no allow-list)
embed.js shows the same blocks in an iframe, so it needs no allowed origins:
form (data-nd-id = form id), booking (service, optional),
newsletter, blog-feed (data-nd-limit), shop, product
(data-nd-id = product slug). Optional data-nd-lang.
get_embed_snippet on the hosted connector returns the right snippet plus
steps for WordPress, Wix, Squarespace, Webflow and Shopify.
Fully headless
If you’d rather render everything yourself, read from the API on your server with the workspace key (never in browser code):GET /v1/content?lang=en,GET /v1/content/bulk?keys=a,b&lang=enGET /v1/pages,GET /v1/blog-posts,GET /v1/galleries,GET /v1/images- bookings, products and orders: see the API reference
/v1/public/availability,
/v1/public/bookings, /v1/public/products, POST /v1/contact-forms,
POST /v1/newsletters/subscribe (all take ?project_id=).