- JavaScript 57.7%
- Dart 29.7%
- Go 5.1%
- HTML 5.1%
- Kotlin 1.9%
- Other 0.5%
Wake-up boosters: light check step, "Still up?" follow-up ring (a problem and a photo), gentle volume start, squats step (accelerometer counter), overlay permission page. Habits: morning plan, forgiving streak, wake-time consistency with bedtime reminder, commitment with a pledge, morning snapshot with mood slider and reel, Progress cards and Settings. Problems per alarm may now be 0. Japanese step: sentence generator (grammar templates over a tagged lexicon, three levels), particles / word order / translation exercises answered by drag and drop, floating JMdict dictionary card, settings and review list. Onboarding grows to 24 pages. Drift schema v8. Adds end-to-end tests on the emulator (scripts/e2e.sh, Flutter Driver), design docs and mockups. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> |
||
|---|---|---|
| app | ||
| backend | ||
| docs | ||
| nix | ||
| scripts | ||
| .envrc | ||
| .gitignore | ||
| flake.lock | ||
| flake.nix | ||
| plan.md | ||
| README.md | ||
Wakey
An alarm that rings until you have solved a polynomial and three problems from your TU Delft courses.
app/Flutter app (Android only, Material 3)backend/Go problem bank: HTTP API with Swagger UI at/docs, MCP server, Ranger-style TUI (SQLite, Goose, sqlc)nix/,flake.nixdev shell, package, NixOS moduleservices.wakey, VM testdocs/design, mock-ups, diagrams, API contract
1. Develop and build
Everything runs inside the flake's dev shell (Flutter, Android SDK 35-37, emulator, JDK 17, Go, sqlc, goose). The first nix develop downloads the SDK and emulator image.
nix develop
Back-end:
cd backend && go test ./... && sqlc generate
App (debug build and tests):
cd app && flutter test && flutter build apk --debug
2. Run on an emulator (Pixel 9)
scripts/emulator.sh # creates the "wakey" AVD once, then boots it
cd app && flutter run # in a second terminal
The emulator reaches your machine's server at http://10.0.2.2:8080 (the app's default server URL).
To try the server locally: cd backend && STATE_DIRECTORY=/tmp/wakey go run ./cmd/wakeyd (then go run ./cmd/wakeyd seed and key create, see below).
3. Deploy the back-end on NixOS
Add the flake input and the module to your NixOS configuration:
{
inputs.wakey.url = "git+https://git.bjvanbemmel.nl/bjvanbemmel/wakey";
outputs = { nixpkgs, wakey, ... }: {
nixosConfigurations.myhost = nixpkgs.lib.nixosSystem {
modules = [
wakey.nixosModules.default
{
services.wakey = {
enable = true;
listen = "127.0.0.1:8080"; # put TLS in front of it
# ingestInterval = "weekly"; # refresh quotes from Wikiquote (null disables)
# publicRead = true; # problems readable without a key
# corsOrigins = [ ]; # for other web clients
};
services.nginx.virtualHosts."wakey.example.org" = {
enableACME = true;
forceSSL = true;
locations."/".proxyPass = "http://127.0.0.1:8080";
};
}
];
};
};
}
nixos-rebuild switch, then on the server:
wakey-admin key create --name phone --scopes read,progress --subject beau # prints the key once
curl https://wakey.example.org/health # for your status page
The starter courses, topics and 64 problems (R&L, IP, CO) load on every start (seedOnStart, idempotent). Quotes come from the weekly wakey-ingest timer (systemctl start wakey-ingest to run it now).
Tools installed by the module (sudo wrappers that run as the service user): wakey-admin (key, ingest, seed), wakey-tui (browser with progress bars), wakey-mcp (stdio MCP server).
New courses each quarter need no release: ask Claude (add_course, add_topic, then problems) or POST /v1/courses.
Add problems with Claude: register wakey-mcp as an MCP server, e.g. claude mcp add wakey -- wakey-mcp on the server (or over ssh). The server's built-in instructions tell Claude when to use choice, number or text answers.
API docs: https://wakey.example.org/docs (Swagger UI), spec at /v1/openapi.yaml.
4. Install the app on your phone
Enable developer mode and USB debugging, plug the phone in, then:
SPOTIFY_CLIENT_ID=<your client id> scripts/build-apk.sh
scripts/install-apk.sh
install-apk.sh picks the USB device and ignores wireless devices and emulators; set ANDROID_SERIAL=<serial> to choose another (for wireless debugging use <ip:port>).
In the app: Settings > Server (your URL) and API key (the key from wakey-admin), then Sync now. Grant the permissions it asks for (notifications, alarms & reminders, full-screen alerts; battery optimisation and microphone are recommended/optional).
Signing a release build
Without a keystore the release APK is debug-signed (fine for your own phone). To sign it properly:
keytool -genkeypair -v -keystore ~/wakey.jks -alias wakey -keyalg RSA -keysize 2048 -validity 10000
cat > app/android/key.properties <<'PROPS'
storeFile=/home/you/wakey.jks
storePassword=...
keyAlias=wakey
keyPassword=...
PROPS
key.properties and keystores are git-ignored. Keep the keystore: the Spotify app registration below is tied to its SHA-1.
5. Spotify (optional, for music alarms)
The app uses Spotify's App Remote (to play) and the Web API (to list your library and search). Both need a developer app:
- Open https://developer.spotify.com/dashboard and log in with your Spotify account (Premium is needed for on-demand playback).
- Create app. Name:
Wakey. Redirect URI:spotify-sdk://auth. Tick Android (and Web API) under "APIs used". - In the app's Settings > Android packages add package name
nl.bjvanbemmel.wakeyand the SHA-1 fingerprint of the key that signs your APK:- release keystore:
keytool -list -v -keystore ~/wakey.jks -alias wakey | grep SHA1 - debug build:
keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android | grep SHA1
- release keystore:
- User management: while the app is in Spotify's development mode, add the email of every Spotify account that will use it (you).
- Copy the Client ID (no secret is needed) and build with it:
SPOTIFY_CLIENT_ID=<client id> scripts/build-apk.sh. The ID is not a secret, but keep it out of git;--dart-definebakes it into the APK. - Install the Spotify app on the phone and log in. In an alarm: Sound > Spotify > Choose. The first time, Spotify asks you to approve Wakey.
If Spotify cannot start within 10 seconds of the alarm ringing (no network, app logged out, no Premium), the normal alarm sound plays.
Licence
GPL-3.0-or-later.
MCP over HTTP (claude.ai connector)
wakeyd also serves the MCP tools at /mcp (same port as the API). It needs an API key with the write scope:
- Clients that can send headers:
Authorization: Bearer <key>tohttps://wakey.bjvanbemmel.nl/mcp. - claude.ai custom connectors only take a URL, so the key may be the last path segment:
https://wakey.bjvanbemmel.nl/mcp/<key>. The NixOS config turns off nginx's access log for/mcpso the key is not written to disk; treat the URL as a secret and revoke the key (wakeyd key revoke <id>) if it leaks.
Create a dedicated key: wakey-admin key create --name claude --scopes write --subject beau.
End-to-end tests
scripts/e2e.sh (inside nix develop) boots the emulator if needed, installs a debug build with the Flutter Driver extension and runs app/test_driver/app_test.dart: it seeds an alarm, rings it with adb, and checks the plan banner, the light step (emulator light sensor), the squats step (accelerometer swings injected with adb emu sensor) and the polynomial. Add scenarios there.