mirror of
https://github.com/streetwriters/notesnook-sync-server.git
synced 2026-03-28 22:10:48 +01:00
* inbox: add health endpoint && docs * inbox: update post endpoint uri * inbox: update docs & dockerfile --------- Co-authored-by: Abdullah Atta <abdullahatta@streetwriters.co>
1.7 KiB
1.7 KiB
Notesnook Inbox API
Running locally
Requirements
- Bun (v1.3.0 or higher)
Commands
bun install- Install dependenciesbun run dev- Start the development serverbun run build- Build the project for productionbun run start- Start the production server
Self-hosting
The easiest way to self-host is with Docker or Docker Compose.
Prerequisites:
docker(Engine) installeddocker-compose(optional, for multi-service setups)
Build and run with Docker:
# build the image from the current folder
docker build -t notesnook-inbox-api .
# run the container (example)
docker run --rm -p 3000:3000 \
-e PORT=3000 \
-e NOTESNOOK_API_SERVER_URL="https://api.notesnook.com" \
notesnook-inbox-api
Docker Compose (example):
services:
inbox-api:
image: notesnook-inbox-api
build: .
ports:
- "3000:3000"
environment:
PORT: 3000
NOTESNOOK_API_SERVER_URL: "https://api.notesnook.com"
restart: unless-stopped
Environment variables:
PORT— port the service listens on (default:5181)NOTESNOOK_API_SERVER_URL— base URL of the Notesnook API used to fetch public inbox keys
If you prefer running without Docker, use bun install and bun run start with the environment variables set.
Writing from scratch
The inbox API server is pretty simple to write from scratch in any programming language and/or framework. There's only one endpoint that needs to be implemented, which does these three steps:
- Fetch the user's public inbox API key from the Notesnook API.
- Encrypt the payload using
openpgpor any otheropenpgpcompatible library. - Post the encrypted payload to the Notesnook API.
You can refer to the source code for implementation details.