This doc is for anyone who wants to run, build, or change the code — new or experienced.
- Users (just installing): see the README.
- Developers: this file + the Repository structure in the README.
Good for UI, layout, and component work:
cd frontend
npm install
npm run devOpens a Vite dev server. The app can run without a backend (e.g. uses localStorage for some data). To talk to a real Home Assistant instance, open the app through HA (e.g. /skydark) or configure the connection as your setup requires.
-
Install the integration into your Home Assistant (see README).
-
Build the frontend and copy it into the integration:
cd frontend npm run buildThe build output goes to
custom_components/skydark_calendar/www/. Restart Home Assistant if the integration was already loaded.
| Part | Where | Tech |
|---|---|---|
| Backend | custom_components/skydark_calendar/ |
Python, Home Assistant integration |
| Frontend | frontend/ |
React, TypeScript, Vite, Tailwind |
| API | frontend/src/lib/skyDarkApi.ts ↔ websocket_api.py |
WebSocket commands (skydark_calendar/*) |
| Data | database.py + SQLite |
Stored under HA config/skydark_calendar/ |
Changing the UI: work in frontend/src/ (views, components, contexts).
Changing data or HA behavior: work in custom_components/skydark_calendar/ (database, services, websocket_api).
| Command | Where | What it does |
|---|---|---|
npm run dev |
frontend/ |
Start Vite dev server |
npm run build |
frontend/ |
TypeScript + Vite build → custom_components/.../www |
npm run test |
frontend/ |
Run Vitest tests |
npm run test:watch |
frontend/ |
Vitest watch mode |
-
Frontend change
- Edit files under
frontend/src/. - Run
npm run devto test in the browser, ornpm run buildand restart HA to test in the panel.
- Edit files under
-
Backend change
- Edit Python under
custom_components/skydark_calendar/. - Restart Home Assistant (or reload the integration) and test in the Skydark panel.
- Edit Python under
-
New WebSocket command or service
- Backend: add handler in
websocket_api.pyor register a service inservices.pyandservices.yaml. - Frontend: add a function in
skyDarkApi.tsthat sends the right message or calls the service.
- Backend: add handler in
- Frontend: TypeScript, React function components; existing style in
frontend/src/is the reference. - Backend: Follow existing Python style in
custom_components/skydark_calendar/; HA integration conventions apply.
Open an issue or discussion on GitHub. For install/config problems, check the README Troubleshooting section first.