A complete system for creating autonomous, animated cats on the web.
graph TB
subgraph "User Interface"
USER[Developer/User]
end
subgraph "High-Level API"
SDK[Meowzer SDK<br/>Integration Layer]
end
subgraph "Core Libraries"
MEOWKIT[Meowkit<br/>Cat Creation]
MEOWTION[Meowtion<br/>Animation & Movement]
MEOWBRAIN[Meowbrain<br/>AI Behavior]
MEOWBASE[Meowbase<br/>IndexedDB Storage]
end
subgraph "Data"
PROTOCAT[ProtoCat<br/>Cat Definition]
CAT[Cat Instance<br/>Animated Sprite]
BRAIN[Brain Instance<br/>Decision Engine]
end
USER -->|meowzer.cats.create| SDK
SDK -->|buildCat| MEOWKIT
SDK -->|animateCat| MEOWTION
SDK -->|createBrain| MEOWBRAIN
SDK -->|save/load| MEOWBASE
MEOWKIT -->|generates| PROTOCAT
MEOWTION -->|creates| CAT
MEOWBRAIN -->|creates| BRAIN
PROTOCAT -->|used by| MEOWTION
CAT -->|controlled by| BRAIN
MEOWBASE -->|stores| PROTOCAT
style SDK fill:#ff9500
style MEOWKIT fill:#4a9eff
style MEOWTION fill:#50c878
style MEOWBRAIN fill:#da70d6
style MEOWBASE fill:#ffd700
High-level API that orchestrates all libraries. Provides a class-based interface for cat creation and management.
Key Features:
- Unified
Meowzerclass with manager pattern - Cat lifecycle management via
meowzer.catsmanager - Storage operations via
meowzer.storagemanager - Interaction system via
meowzer.interactionsmanager - Plugin system for extensibility
Transforms user settings into structured cat data with SVG sprites.
Key Features:
- Procedural pixel-art SVG generation
- Seed-based cat serialization (shareable cat codes)
- Builder pattern for controlled creation
- Zero dependencies for sprite generation
Brings cat sprites to life with animations and physics.
Key Features:
- GSAP-based state animations (idle, walking, running, sitting, sleeping, playing)
- Smooth movement with curved path following
- Physics simulation (velocity, friction, boundaries)
- Modular architecture (DOM, movement, physics modules)
Autonomous decision-making for lifelike cat behavior.
Key Features:
- Personality-driven behavior (6 presets: lazy, playful, curious, aloof, energetic, balanced)
- Motivation system (rest, stimulation, exploration)
- 5 behavior types (wandering, resting, playing, observing, exploring)
- Decision engine with weighted behavior selection
Document database for persisting cat collections.
Key Features:
- Document-based collections stored in IndexedDB
- LRU cache with automatic eviction
- Full CRUD operations for collections and cats
- Sample dataset for learning and demos
- Result pattern for consistent error handling
// Initialize Meowzer
import { Meowzer } from "meowzer";
const meowzer = new Meowzer();
await meowzer.init();
// Simple: Create a random cat
const cat = await meowzer.cats.create();
// Cat automatically appears on the page!
// Advanced: Full control
const customCat = await meowzer.cats.create({
name: "Whiskers",
description: "A playful orange tabby",
settings: {
color: "#FF9500",
eyeColor: "#00FF00",
pattern: "tabby",
size: "medium",
furLength: "short",
},
});
// Set personality
customCat.setPersonality("playful");
// Management
const allCats = meowzer.cats.getAll();
await meowzer.cats.destroyAll(); // Clean up when donesequenceDiagram
participant User
participant Meowzer
participant Meowkit
participant Meowtion
participant Meowbrain
User->>Meowzer: meowzer.cats.create(options)
Meowzer->>Meowkit: buildCat(settings)
Meowkit-->>Meowzer: ProtoCat (id, seed, SVG, appearance)
Meowzer->>Meowtion: new Cat(protoCat)
Meowtion-->>Meowzer: Cat instance (animated sprite)
Meowzer->>Meowbrain: new Brain(cat)
Meowbrain-->>Meowzer: Brain instance
Meowzer-->>User: MeowzerCat (unified interface)
User->>Meowzer: cat.lifecycle.resume()
Meowzer->>Meowbrain: brain.start()
loop Decision Loop
Meowbrain->>Meowbrain: Calculate motivations
Meowbrain->>Meowbrain: Choose behavior
Meowbrain->>Meowtion: Execute movement
end
meowzer/
โโโ meowzer/ # Monorepo root for packages
โ โโโ meowkit/ # Cat creation library
โ โ โโโ builder.ts
โ โ โโโ validation.ts
โ โ โโโ serialization.ts
โ โ โโโ svg-generator.ts
โ โ โโโ color-utils.ts
โ โโโ meowtion/ # Animation library
โ โ โโโ cat.ts
โ โ โโโ state-machine.ts
โ โ โโโ animations/
โ โ โโโ cat/
โ โ โโโ dom.ts
โ โ โโโ movement.ts
โ โ โโโ physics.ts
โ โโโ meowbrain/ # AI behavior library
โ โ โโโ brain.ts
โ โ โโโ decision-engine.ts
โ โ โโโ behaviors.ts
โ โ โโโ personality.ts
โ โ โโโ behavior-orchestrator.ts
โ โโโ meowbase/ # IndexedDB storage
โ โ โโโ meowbase.ts
โ โ โโโ collections/
โ โ โโโ cats/
โ โ โโโ storage/
โ โโโ sdk/ # Integration layer (package: "meowzer")
โ โ โโโ meowzer-sdk.ts
โ โ โโโ meowzer-cat.ts
โ โ โโโ managers/
โ โ โ โโโ cat-manager.ts
โ โ โ โโโ storage-manager.ts
โ โ โ โโโ interaction-manager.ts
โ โ โ โโโ hook-manager.ts
โ โ โโโ interactions/
โ โ โโโ cat-modules/
โ โโโ ui/ # Web components library
โ โ โโโ components/
โ โ โโโ providers/
โ โ โโโ controllers/
โ โโโ types/ # Shared TypeScript types
โ โโโ utilities/
โ โโโ event-emitter.ts # Shared event system
โโโ docs/ # Documentation website (Astro + Starlight)
โ โโโ src/
โ โโโ content/
โโโ demo/ # Demo website (Astro)
โโโ meta/ # Project documentation
โโโ *.md
## ๐ ๏ธ Development
### Initial Setup
From the root directory:
```bash
npm install # Installs all dependencies using npm workspaces
Each package has its own test suite:
cd meowzer/meowkit && npm test
cd meowzer/meowtion && npm test
cd meowzer/meowbrain && npm test
cd meowzer/meowbase && npm test
cd meowzer/meowzer && npm testcd docs
npm run dev # Start dev server at http://localhost:5173
npm run build # Build for production
npm run preview # Preview production buildEach package has comprehensive documentation:
- Meowkit README - Cat creation API, seed format, builder pattern
- Meowtion README - Animation system, movement, state machine
- Meowbrain README - AI behaviors, personalities, decision engine
- Meowbase README - Storage API, collections, result pattern- SDK README - High-level API, managers, configuration
- UI README - Web components, providers, playground
- Documentation Site - Astro + Starlight docs site
- Interactive Websites: Add autonomous cats to engage visitors
- Games: Create cat characters with unique personalities
- Learning Tool: Study AI decision-making and animation systems
- Art Projects: Generate and share unique cat designs via seeds
- Demos: Showcase web technologies (IndexedDB, SVG, animations)
- Modular Design: Each library has a single, focused responsibility
- Layered Abstraction: Low-level libraries (Meowkit) โ High-level API (Meowzer)
- Type Safety: Full TypeScript with comprehensive type definitions
- Zero Config: Sensible defaults, optional customization
- Event-Driven: Shared EventEmitter for reactive programming
- Testable: Pure functions, dependency injection, comprehensive tests
The root package.json provides convenient scripts:
npm run dev:docs- Start docs development servernpm run build:docs- Build docs for productionnpm run dev:demo- Start demo development servernpm run build:demo- Build demo for productionnpm run build:sdk- Build SDK packagenpm run build:ui- Build UI components packagenpm run build- Build both SDK and UI packages
- Meowkit: See meowzer/meowkit/README.md
- Meowtion: See meowzer/meowtion/README.md
- Meowbrain: See meowzer/meowbrain/README.md
- Meowbase: See meowzer/meowbase/README.md
- SDK: See meowzer/sdk/README.md
- UI: See meowzer/ui/README.md
- Documentation Site: docs/ - Astro + Starlight
Each package has its own test suite using Vitest:
cd meowzer/meowkit && npm test
cd meowzer/meowtion && npm test
cd meowzer/meowbrain && npm test
cd meowzer/meowbase && npm test
cd meowzer/sdk && npm test
cd meowzer/ui && npm testMIT