1Create two Notion databases
📋 Models database
PropertyTypeNotes
NameTitleModel name, e.g. KAB03
DescriptionTextOptional — full product name
📦 Stock database
PropertyTypeNotes
Serial NumberTitleRename the default title column
ModelRelation→ points to Models database
StatusSelectIn Stock · Sold · Reserved
Sold DateDateAuto-set when sold
NotesTextOptional — customer, order ref
To create the Relation: in the Stock database, add a new property → choose Relation → select your Models database.
2Create a Notion Integration & share both databases
Go to notion.so/my-integrations → New Integration → "Stock Tracker" → copy the token. Then open each database, click ··· → Connections → add your integration.
3Deploy your Cloudflare Worker proxy (free)
Go to workers.cloudflare.com → Create Worker → paste this code → deploy. Then go to Settings → Variables and Secrets → add NOTION_API_KEY as a Secret with your integration token:
addEventListener('fetch', event => {
event.respondWith(handleRequest(event.request))
})
async function handleRequest(request) {
if (request.method === 'OPTIONS') {
return new Response(null, { headers: {
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Methods': 'GET,POST,PATCH,OPTIONS',
'Access-Control-Allow-Headers': 'Content-Type',
}})
}
const url = new URL(request.url)
const path = url.pathname.replace(/^\/+/, '')
const notionUrl = `https://api.notion.com/v1/${path}${url.search}`
const body = ['GET','HEAD'].includes(request.method) ? undefined : await request.text()
const resp = await fetch(notionUrl, {
method: request.method,
headers: {
Authorization: `Bearer ${NOTION_API_KEY}`,
'Content-Type': 'application/json',
'Notion-Version': '2022-06-28',
},
body,
})
const out = new Response(resp.body, resp)
out.headers.set('Access-Control-Allow-Origin', '*')
return out
}