powerhour

Powerhour Docs

Documentation

This documentation is written for self-hosted operators. Route references describe in-app paths in your own deployment (for example /transactions), not a hosted web app endpoint.

Scope and Model

Domain separation is explicit:

  • Docs domain: https://docs.powerhour.dev (documentation pages).
  • Marketing domain: https://powerhour.dev (features, security, deployment marketing content).
  • Product runtime: self-hosted instance controlled by deployer; route examples in this doc are app routes, not hosted URLs.

Reader paths

New operator

Scope and Model → Quickstart Flow → Walkthrough

Use this path to validate end-to-end setup before deep tuning.

Security reviewer

Security Model → Operations and Runtime → FAQ

Use this path to inspect controls, boundaries, and practical caveats.

Engineer contributor

Core Modules → API Domains → Implementation Map

Use this path to map features to code ownership quickly.

Product Highlights

Quick orientation for non-engineering readers, with direct route context for operators and developers.

Unified dashboard

Daily financial posture with net worth, balances, category movement, and credit utilization in one command surface.

/, /accounts, /accounts/[id]

Ticker AI diagnostics

Ask direct financial questions, compare trend windows, audit recurring costs, and trigger report generation flows.

/ (embedded), floating chat on dashboard routes

Planner workflows (Beta)

Mode-driven planning for travel, savings targets, and spend reduction with persisted conversations.

/budget-planner, /projections

Transactions and groups

Search and filter transaction history, then organize records into groups for trip/project analysis.

/transactions, /transactions/groups, /transactions/groups/[id]

Recurring and subscription control

Detect recurring items, flag inactive subscriptions, estimate monthly/annual risk, and deactivate noise quickly.

/subscriptions, /projections

Security-first data boundaries

Encrypted tokens, restricted agent views, verified webhooks, and audit events for critical operations.

/settings, /api/webhooks/plaid, /api/audit-log

Quickstart Flow

  1. 1. Authenticate at /login.
  2. 2. Link an institution in /settings.
  3. 3. Trigger manual sync from /settings.
  4. 4. Validate dashboard and accounts: /, /accounts.
  5. 5. Run transaction and recurring checks: /transactions, /subscriptions, /projections.

Core Modules

ModuleIn-app routesPurpose
Dashboard and analytics/, /accounts, /accounts/[id]Consolidated financial posture: KPI cards, net worth, account views, balance history, and trend visualizations.
Transactions and grouping/transactions, /transactions/groups, /transactions/groups/[id]Search, filters, pagination, group assignment, and suggestion workflows for transaction-level analysis.
Projections and recurring/projections, /subscriptionsRecurring detection, shortfall forecasting, subscription audit, and savings trajectory views.
Budgeting and planning/budgets, /budget-plannerAI-generated budget goals plus mode-based planner workflows for travel, savings, and spend reduction.
Settings and control plane/settingsScheduler toggles, institution management, sync controls, password changes, audit events, and configured AI models. Local-model support is in beta.

API Domains

Auth and session

/api/auth/login, /api/auth/logout, /api/auth/me, /api/auth/change-password

Dashboard analytics

/api/dashboard/summary, /api/dashboard/*-history, /api/dashboard/spending-trends, /api/dashboard/category-trends, /api/dashboard/channel-trends, /api/dashboard/credit-utilization

Accounts and transactions

/api/accounts, /api/accounts/[id], /api/transactions, /api/transactions/summary, /api/transactions/daily, /api/transactions/merchants

Budgets, plans, projections

/api/budget-goals, /api/budget-goals/generate, /api/budget-plans, /api/projections, /api/recurring, /api/savings-targets, /api/subscriptions

Agent execution

/api/ai/chat, /api/ai/budget-planner, /api/ai/report, /api/ai/status

Plaid and sync

/api/plaid/link-token, /api/plaid/exchange-token, /api/plaid/institutions, /api/sync, /api/webhooks/plaid

Security Model

  • Encrypted token storage and secure field handling (`lib/crypto.ts`, `lib/crypto-fields.ts`).
  • Session + request middleware gating and authenticated API throttling (`middleware.ts`).
  • Agent-safe database views and schema-level separation (`lib/db/views.ts`, `lib/db/migrations/0000_agent_views.sql`).
  • Plaid webhook verification and sync boundary control (`lib/plaid/webhooks.ts`, `lib/plaid/sync.ts`).
  • Audit event capture for critical actions (`lib/audit-log.ts`, `app/api/audit-log/route.ts`).

Operations and Runtime

AI workflows default to Gemini 2.5 Flash-Lite (gemini-2.5-flash-lite). Local-model support (Beta) covers Ticker, Budget Planner, PDF summaries, smart budget goals, and weekly digests through an OpenAI-compatible server such as Ollama, llama.cpp, or LM Studio.

Set AI_PROVIDER=openai-compatible, AI_BASE_URL to the server's endpoint ending in /v1, and AI_MODEL to a loaded model. A Gemini key is not needed for this provider. Optional overrides use AI_MODEL_CHAT, AI_MODEL_PLANNER, AI_MODEL_REPORT, AI_MODEL_GOALS, and AI_MODEL_DIGEST. Settings → AI models shows the configured models. During beta, tool support, response time, and output quality vary by model.

For Docker deployments, the model endpoint must be reachable from the app container. With Ollama on the host, use http://host.docker.internal:11434/v1. Run Ollama natively on macOS for GPU access and configure a context window of at least 16,384 tokens for the agent tools.

  • Startup initialization handled by instrumentation.ts.
  • Scheduler jobs configured in lib/scheduler.ts.
  • Environment and bootstrap automation in scripts/setup.cjs.
  • Container runtime and reverse proxy in docker/* (source build) and deploy/docker-compose.yml (versioned release image, with a separate migrate service gated behind the tools profile).
  • Health and control routes under /api/health and /api/settings/scheduler.

Implementation Map

AreaPrimary files
Runtime and routingapp/layout.tsx, app/(dashboard)/layout.tsx, middleware.ts, instrumentation.ts
Pagesapp/(auth)/login/page.tsx and app/(dashboard)/*/page.tsx
API routesapp/api/**/route.ts
UI compositioncomponents/dashboard/*, components/chat/*, components/budget-planner/*, components/charts/*
State and hookshooks/use-dashboard.ts, hooks/use-transactions.ts, hooks/use-accounts.ts, hooks/use-expense-groups.ts
AI and toolslib/ai/model.ts, lib/ai/features.ts, lib/agent/agent.ts, lib/agent/budget-planner-agent.ts, lib/agent/tools/*
Domain logiclib/projections.ts, lib/recurring.ts, lib/savings-projections.ts, lib/savings-targets.ts
Data modellib/db/schema.ts, lib/db/views.ts, lib/db/migrations/*
Infra and deploydocker/Dockerfile, docker/docker-compose.yml (source build + optional tls profile), deploy/docker-compose.yml (release image + migrate/tools profile), docker/nginx/nginx.conf, scripts/setup.cjs, scripts/migrate.mjs

Next Reading

  • Walkthroughs for step-by-step operational flows.
  • FAQ for setup, security, and troubleshooting questions.