Skip to content

fibonacci998/kinAI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

115 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

KinAI Logo

KinAI

Your family, smarter together.

An AI-powered family coordination platform that connects smart home devices, manages tasks, tracks expenses, and sends intelligent notifications — with Claude AI as the brain making context-aware decisions.

Backend CI Frontend CI TypeScript Claude AI NestJS React PWA License


The Problem

Modern families juggle dozens of apps: one for smart devices, another for groceries, a third for tasks, and group chats for coordination. Nothing talks to each other. KinAI unifies it all into one intelligent assistant that understands your family's context.

How It Works

                              ┌─────────────────────┐
                              │   Smart Devices     │
                              │  LG  Bosch  Imou    │
                              └────────┬────────────┘
                                       │ webhooks/events
┌──────────┐    WebSocket     ┌────────▼────────────┐     ┌─────────────┐
│          │◄────────────────►│                     │────►│  Claude AI  │
│  React   │   REST API       │   NestJS Backend    │◄────│  (Sonnet 4) │
│   PWA    │◄────────────────►│                     │     └─────────────┘
│          │                  │  Bull Queue + Redis │
└──────────┘                  └─────────┬───────────┘
                                        │
                              ┌─────────▼───────────┐
                              │   PostgreSQL        │
                              │   17 models · Prisma│
                              └─────────────────────┘

Key Features

AI-Powered Family Chat

Family and personal chat modes with Claude AI. @mention a family member to notify them instantly. Claude understands who's home, what tasks are pending, and what devices are running.

Smart Device Integration

Connect LG ThinQ, Bosch Home Connect, and Imou cameras. When the washer finishes, Claude checks who's free and notifies the right person. Late-night motion? Parents get alerted with a camera snapshot analyzed by Claude Vision.

Expense Tracking with Vision

Paste a receipt screenshot in chat — Claude extracts the amount, merchant, and category automatically. Family members get notified. Ask "how much did we spend this month?" for instant breakdowns.

Fridge Inventory

Take a photo of your fridge — Claude identifies all items. Groceries from receipts are auto-added. Get recipe suggestions, expiry alerts, and shopping lists based on what you have.

Tasks & Reminders

Create tasks through natural conversation: "Remind @Dad to take medicine at 9PM every day". Claude extracts the schedule, creates the reminder, and sends push notifications with snooze support.

MCP Server

Expose your family data as an MCP server so external AI tools (Claude.ai, Cursor) can query your fridge, devices, tasks, and expenses through standardized tool calls.

Custom Family Rules

Set rules like "Always respond in Vietnamese" or "Notify both parents for security events". Rules apply across all AI interactions — chat, device events, and notifications.

Smart Decision Examples

Trigger Context AI Decision
Washer done Dad is free, Mom is cooking Push to Dad: "Laundry's done, can you fold?"
Motion at door 10 PM, camera snapshot Push to both: "Person detected at front door" + snapshot
Kid's room motion 11 PM, late night Push to parents: "Movement in kid's room"
Receipt pasted 450,000 VND at Circle K Auto-categorize, save expense, notify spouse
"What should I cook?" Chicken + tomatoes in fridge Suggest recipes from available ingredients

Tech Stack

Layer Technology
Frontend React 18 (PWA), Firebase Auth, FCM, WebSocket
Backend NestJS, TypeScript, Prisma 7, PostgreSQL
AI Claude API (Sonnet 4) — chat, vision, decisions
Devices LG ThinQ, Bosch Home Connect, Imou Camera APIs
Queue Bull + Redis (scheduled reminders, recurring tasks)
Push Firebase Cloud Messaging
Calendar Google Calendar API (schedule awareness)
MCP Model Context Protocol server for external AI tools
CI/CD GitHub Actions, Docker, GHCR

Project Structure

kinAI/
├── backend/                    # NestJS API server
│   ├── src/
│   │   ├── auth/               # Google OAuth via Firebase
│   │   ├── chat/               # Family & personal chat with Claude
│   │   ├── claude/             # Claude API integration (text + vision)
│   │   ├── common/             # Guards, decorators, types
│   │   ├── device/             # LG, Bosch, Imou, Google Calendar, presence
│   │   ├── expense/            # Receipt scanning & expense tracking
│   │   ├── family-rule/        # Custom LLM behavior rules
│   │   ├── fridge/             # Fridge inventory management
│   │   ├── invite/             # Family invite link system
│   │   ├── llm-usage/          # Token usage & cost tracking
│   │   ├── mcp/                # MCP server (OAuth + tools)
│   │   ├── member/             # Member profiles & FCM tokens
│   │   ├── notification/       # FCM push notifications
│   │   ├── oauth/              # Device OAuth flows
│   │   ├── prisma/             # Database service (Prisma 7)
│   │   └── task/               # Tasks & reminder scheduling
│   └── prisma/
│       └── schema.prisma       # 17 data models
├── frontend/                   # React PWA
│   └── src/
│       ├── components/         # NavBar, shared UI
│       ├── contexts/           # Auth, Language, Theme providers
│       ├── i18n/               # English + Vietnamese translations
│       └── pages/              # Home, Chat, Tasks, Devices, etc.
├── .github/workflows/          # CI/CD pipelines
├── docker-compose.yml          # One-command deployment
└── CLAUDE.md                   # AI-assisted development context

Getting Started

Prerequisites

  • Node.js 22+
  • Docker & Docker Compose

Quick Start

# 1. Clone & start infrastructure
git clone https://github.com/fibonacci998/kinAI.git
cd kinAI
docker compose up postgres redis -d

# 2. Backend
cd backend
cp .env.example .env          # Fill in API keys
npm install
npx prisma migrate dev
npx prisma generate
npm run start:dev

# 3. Frontend (new terminal)
cd frontend
npm install
npm start

One-Command Docker Deploy

docker compose up --build
Service URL
Frontend http://localhost:3001
Backend API http://localhost:3000/api
MCP Server http://localhost:3000/mcp

Environment Variables

Copy backend/.env.example to backend/.env:

Variable Description
DATABASE_URL PostgreSQL connection string
ANTHROPIC_API_KEY Claude API key
FIREBASE_PROJECT_ID Firebase project ID
FIREBASE_PRIVATE_KEY Firebase service account key
FIREBASE_CLIENT_EMAIL Firebase service account email
LG_CLIENT_ID / SECRET LG ThinQ OAuth credentials
BOSCH_CLIENT_ID / SECRET Bosch Home Connect OAuth
IMOU_APP_ID / SECRET Imou camera API credentials

API Overview

Auth & Family
Method Endpoint Description
POST /api/auth/login Login via Firebase token
POST /api/auth/create-family Create family + admin member
POST /api/invite Generate invite link
POST /api/invite/:token/accept Join family via invite
Chat & AI
Method Endpoint Description
POST /api/chat/send Send message (text + image) to Claude
GET /api/chat/messages Get conversation history
WS / WebSocket for real-time messages & typing
Tasks & Expenses
Method Endpoint Description
POST /api/tasks Create task/reminder
PATCH /api/tasks/:id/done Mark task complete
POST /api/tasks/:id/snooze Snooze reminder
POST /api/expenses/scan Upload receipt for AI scanning
Devices
Method Endpoint Description
GET /api/devices/lg/discover Discover LG devices
GET /api/devices/bosch/discover Discover Bosch devices
GET /api/devices/imou/discover Discover Imou cameras
GET /api/devices/presence Who's home (camera-based)
MCP Server
Method Endpoint Description
POST /api/mcp/oauth/token MCP token exchange
GET /api/mcp/tokens List MCP tokens

Available MCP Tools: get_fridge_inventory, add_fridge_item, get_tasks, create_task, get_spending_summary, get_device_status, get_who_is_home, send_notification

Development Progress

Phase Status Description
1. Foundation Done Auth, Family, Invites, FCM, PWA
2. Chat Done Family/Personal modes, @mentions, history
3. Tasks Done Bull Queue, recurring schedules, snooze
4. LG ThinQ Done OAuth, device discovery, push events
5. More Devices Done Bosch, Imou cameras, Google Calendar
6. Expenses & Fridge Done Receipt vision, inventory, recipes
7. MCP Server Done External AI tool access
8. Monetization Planned Stripe, Free/Pro plans

Security

  • Multi-family isolationfamilyId always derived from JWT, never from request
  • 3-layer protection — NestJS Guard + Prisma middleware + database RLS
  • OAuth tokens encrypted at rest per member
  • Invite links expire after 7 days, single-use

License

MIT


Built with Claude AI · Made in Vietnam

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages