This document explains how to run InkSight locally and how the current codebase is structured.
If you only want a product overview, start with the repository README.md.
This guide is mainly for developers, self-hosters, and anyone debugging the full backend + webapp + device flow.
Use this guide if you want to:
- run the backend and WebApp locally
- self-host your own InkSight instance
- debug flashing, configuration, preview, or API behavior
The repository currently has three main parts:
backend/— FastAPI backend for rendering, configuration, weather, modes, auth, and statswebapp/— Next.js web app for the website, web flasher, login, device configuration, and previewfirmware/— ESP32 firmware built with PlatformIO / Arduino
- Python 3.10+
pip
- Node.js 20+ recommended
npm
- PlatformIO
cd backend
pip install -r requirements.txt
python scripts/setup_fonts.py
cp .env.example .env
# Fill in the environment variables you need
python -m uvicorn api.index:app --host 0.0.0.0 --port 8080The sample file is located at: backend/.env.example
The most important variables currently used by the code are:
DEEPSEEK_API_KEYDASHSCOPE_API_KEYMOONSHOT_API_KEYDEBUG_MODEDEFAULT_CITYDB_PATHADMIN_TOKEN
Notes:
- If a user does not configure their own model/API key in the profile page, the backend falls back to these environment-level keys.
DEFAULT_CITYis the system fallback weather city and defaults to杭州.
cd webapp
cp .env.example .env
npm install
npm run devThe sample file is located at: webapp/.env.example
Current key variables:
INKSIGHT_BACKEND_API_BASE=http://127.0.0.1:8080NEXT_PUBLIC_FIRMWARE_API_BASE=(optional)
For local development, the recommended setup is:
- backend:
http://127.0.0.1:8080 - frontend:
http://127.0.0.1:3000
After startup, the usual local entry points are:
| Entry | URL | Purpose |
|---|---|---|
| WebApp | http://127.0.0.1:3000 |
Website, local development, web flasher, login, config, preview |
| Backend API | http://127.0.0.1:8080 |
FastAPI API server |
| Preview API | http://127.0.0.1:8080/api/preview?persona=WEATHER |
Mode-level preview/debug entry |
The backend still exposes some compatibility pages such as the old config page, dashboard, and editor, but the recommended configuration entry is now the WebApp Device Configuration flow.
In the current product structure:
- the Device Configuration page manages:
- modes
- preferences
- shared members
- device status
- the Profile page manages:
- text model provider / model / API key
- image model provider / model / API key
- free quota and access mode
So model and API key settings live in the profile page, not inside the device config tabs.
If you also want to build or flash firmware locally:
cd firmware
pio run
pio run --target upload
pio device monitorThe default environment is:
epd_42_wsv2_ssd1683_c3_promini
For other supported hardware profiles, see:
firmware/platformio.inidocs/hardware.md
cd backend
pytestcd webapp
npm run lint
npx tsc --noEmitThe current WebApp uses next/font with online font fetching.
In restricted or offline environments, npm run build may fail if it cannot reach Google Fonts.
This does not usually affect day-to-day npm run dev, but it matters for CI and production builds.
Default ports are:
- frontend:
3000 - backend:
8080
If you change ports, also update INKSIGHT_BACKEND_API_BASE accordingly.
Check the following first:
- backend
.envcontains valid platform-level API keys - your user profile contains valid personal model/API key settings
- backend logs show no auth, quota, or upstream provider errors