Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

Lumina

Lumina is an AI-powered journaling companion. This package is its Dart backend, built on Genkit and served over HTTP with shelf. It pairs with a Flutter client.

App Screenshot

What it does

  • Mood analysis — analyzeMoodFlow reads a journal entry and returns a mood label plus a confidence score, using a Gemini prompt defined in prompts/analyzeMood.prompt.
  • Journaling coach — journalCoachFlow generates a single open-ended reflection question for an entry, streaming the response back to the client token-by-token. It calls the getRecentEntries tool to pull the user's journal history for context (see prompts/journalCoach.prompt).
  • Persistence — journal entries are stored locally in SQLite via Drift (lib/database.dart).
  • HTTP middleware — request logging, API-key auth, and CORS are layered onto the Genkit flows via shelf Pipeline in bin/lumina_backend.dart.

Project layout

bin/lumina_backend.dart   Server entrypoint: defines flows, tools, middleware, and routes
lib/database.dart         Drift schema (JournalEntries table) and DAO
prompts/                  Dotprompt templates used by the Genkit flows
test/                     Unit tests

Setup

Requires the Dart SDK (^3.11.5). Install dependencies:

dart pub get

Set the environment variables the server needs before running:

export GEMINI_API_KEY=your-gemini-api-key   # get one at https://aistudio.google.com/apikey
export LUMINA_API_KEY=any-shared-secret      # required by clients as the x-api-key header

Running

dart run bin/lumina_backend.dart

The server listens on 0.0.0.0:3400 and exposes:

  • POST /analyzeMood
  • POST /journalCoach

Both routes require an x-api-key header matching LUMINA_API_KEY, and read the caller's identity from an x-user-id header (defaulting to anonymous).

Development

Regenerate Drift/Schemantic generated code after changing table or schema definitions:

dart run build_runner build --delete-conflicting-outputs

Run tests:

dart test

About

Genkit, Google's open-source framework for building production AI workflows, shipped a Dart SDK.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages