Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions templates/assistant-ui/.cursor/rules/echo_rules.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
description: Guidelines for building Echo-powered chat applications with assistant-ui, AI SDK v5, and the assistant-ui React component library
globs: **/*.ts,**/*.tsx,**/*.js,**/*.jsx
---

# Echo Assistant-UI Guidelines

## SDK Setup
- Server-side: Initialize in `src/echo/index.ts` with `@merit-systems/echo-next-sdk`
- Client-side: Wrap app with `EchoProvider` from `@merit-systems/echo-next-sdk/client`

## Assistant-UI Integration

### Runtime Provider
- Use `AssistantRuntimeProvider` and `useEdgeRuntime` from `@assistant-ui/react`
- Use `@assistant-ui/react-markdown` for rendering markdown in messages
- Use `@assistant-ui/react-ai-sdk` for AI SDK v5 integration

### Chat Components
- Use `@assistant-ui/react` primitives: `Thread`, `ThreadWelcome`, `Composer`, `AssistantMessage`, `UserMessage`

### Streaming API Route
- Use `streamText` from `ai` with Echo-proxied models
- Import models from `@/echo`, not directly from `@ai-sdk/openai`

## Environment Variables
- `ECHO_APP_ID` — Server-side Echo identifier
- `NEXT_PUBLIC_ECHO_APP_ID` — Client-side Echo identifier
24 changes: 24 additions & 0 deletions templates/authjs/.cursor/rules/echo_rules.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
description: Guidelines for building Echo-powered Next.js applications with Auth.js (NextAuth v5) authentication, including provider setup and session management
globs: **/*.ts,**/*.tsx,**/*.js,**/*.jsx
---

# Echo Auth.js Integration Guidelines

## SDK Setup
- Server-side: Initialize Echo in `src/echo/index.ts` with `@merit-systems/echo-next-sdk`
- Auth: Configure Auth.js with the Echo provider

## Auth.js Configuration
- Use `EchoProvider` from `@merit-systems/echo-authjs-provider`
- Mount Auth.js handlers at `src/app/api/auth/[...nextauth]/route.ts`
- Server components: `const session = await auth()`
- Client components: Use `useSession()` from `next-auth/react`

## Echo TypeScript SDK
- Use `@merit-systems/echo-typescript-sdk` for server-side Echo API calls

## Environment Variables
- `ECHO_APP_ID` — Echo application identifier (also used as Auth.js client ID)
- `AUTH_SECRET` — NextAuth secret for session encryption
- `NEXTAUTH_URL` — Deployment URL for Auth.js callbacks
24 changes: 24 additions & 0 deletions templates/echo-cli/.cursor/rules/echo_rules.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
description: Guidelines for building Echo-powered CLI applications, including SDK setup, authentication flows, wallet integration, and AI chat sessions
globs: **/*.ts,**/*.js
---

# Echo CLI Guidelines

## SDK Setup
- Use `@merit-systems/echo-typescript-sdk` for server/CLI contexts
- Use `@merit-systems/ai-x402` for x402 payment protocol integration
- Use `@ai-sdk/openai` and `ai` for CLI chat

## Authentication
- Echo OAuth — Browser-based OAuth with PKCE
- Crypto Wallet — WalletConnect or local wallet with private key
- Use `conf` package for persistent configuration storage

## CLI Framework
- Use `commander` for command definitions
- Use `@clack/prompts` for interactive selection
- Use `chalk` for colored output, `ora` for spinners, `cli-table3` for tables

## Environment Variables
- `ECHO_APP_ID` — Echo application identifier
24 changes: 24 additions & 0 deletions templates/next-chat/.cursor/rules/echo_rules.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
description: Guidelines for building Echo-powered Next.js chat applications with AI SDK streaming, shadcn/ui components, and real-time message handling
globs: **/*.ts,**/*.tsx,**/*.js,**/*.jsx
---

# Echo Next.js Chat Guidelines

## SDK Setup
- Server-side: Initialize in `src/echo/index.ts` with `@merit-systems/echo-next-sdk`
- Client-side: Wrap app with `EchoProvider` from `@merit-systems/echo-next-sdk/client`
- Use `EchoTokens` component for authentication and token management

## Chat Integration
- Use `useChat` hook from `@ai-sdk/react`
- Use `streamText` from `ai` with Echo-proxied models in API routes
- Always verify authentication with `isSignedIn()` before AI calls

## UI Components
- Use shadcn/ui components
- Use Tailwind CSS v4 for styling

## Environment Variables
- `ECHO_APP_ID` — Server-side Echo identifier
- `NEXT_PUBLIC_ECHO_APP_ID` — Client-side Echo identifier
24 changes: 24 additions & 0 deletions templates/next-image/.cursor/rules/echo_rules.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
description: Guidelines for building Echo-powered Next.js image generation applications with AI SDK, image models, and gallery components
globs: **/*.ts,**/*.tsx,**/*.js,**/*.jsx
---

# Echo Next.js Image Generation Guidelines

## SDK Setup
- Server-side: Initialize in `src/echo/index.ts` with `@merit-systems/echo-next-sdk`
- Client-side: Wrap app with `EchoProvider` from `@merit-systems/echo-next-sdk/client`
- Use `EchoTokens` component for authentication and token management

## Image Generation
- Use `experimental_generateImage` from `ai` for image generation
- Display generated images with proper loading states
- Use `next/image` for optimized image rendering when possible

## UI Components
- Use shadcn/ui components
- Build a gallery component for displaying generated images

## Environment Variables
- `ECHO_APP_ID` — Server-side Echo identifier
- `NEXT_PUBLIC_ECHO_APP_ID` — Client-side Echo identifier
24 changes: 24 additions & 0 deletions templates/next-video-template/.cursor/rules/echo_rules.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
description: Guidelines for building Echo-powered Next.js video generation applications with AI video models and video player components
globs: **/*.ts,**/*.tsx,**/*.js,**/*.jsx
---

# Echo Next.js Video Generation Guidelines

## SDK Setup
- Server-side: Initialize in `src/echo/index.ts` with `@merit-systems/echo-next-sdk`
- Client-side: Wrap app with `EchoProvider` from `@merit-systems/echo-next-sdk/client`
- Use `EchoTokens` component for authentication and token management

## Video Generation
- Use Echo-proxied models for video generation
- Build a custom video player or use HTML5 `<video>` element
- Support playback controls: play, pause, seek, volume

## UI Components
- Use shadcn/ui components
- Build a video gallery with thumbnails

## Environment Variables
- `ECHO_APP_ID` — Server-side Echo identifier
- `NEXT_PUBLIC_ECHO_APP_ID` — Client-side Echo identifier
28 changes: 28 additions & 0 deletions templates/next/.cursor/rules/echo_rules.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
description: Guidelines for building Echo-powered Next.js applications, including SDK setup, provider configuration, API routes, and AI integration
globs: **/*.ts,**/*.tsx,**/*.js,**/*.jsx
---

# Echo Next.js Guidelines

## SDK Setup
- Server-side: Initialize in `src/echo/index.ts` with `@merit-systems/echo-next-sdk`
- Client-side: Wrap app with `EchoProvider` from `@merit-systems/echo-next-sdk/client`
- API route: Create catch-all at `src/app/api/echo/[...echo]/route.ts`

## AI Integration
- Always import AI models from `@/echo`, not directly from `@ai-sdk/openai`
- Use Vercel AI SDK v5 patterns for streaming
- Use `isSignedIn()` from `@/echo` to verify authentication

## Components
- Use `EchoTokens` component for auth/token purchase UI (client component)

## Environment Variables
- `ECHO_APP_ID` — Server-side Echo app identifier
- `NEXT_PUBLIC_ECHO_APP_ID` — Client-side Echo app identifier

## Common Patterns
- Use Next.js 15 App Router (not Pages Router)
- Use Tailwind CSS v4 for styling
- Use `@/` path alias for imports from `src/`
26 changes: 26 additions & 0 deletions templates/nextjs-api-key-template/.cursor/rules/echo_rules.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
description: Guidelines for building Echo-powered Next.js applications with server-side API key management, PostgreSQL database, and Prisma ORM
globs: **/*.ts,**/*.tsx,**/*.js,**/*.jsx,**/*.prisma
---

# Echo Next.js API Key Template Guidelines

## SDK Setup
- Server-side: Initialize Echo in `src/echo/index.ts` with `@merit-systems/echo-next-sdk`
- Client-side: Wrap app with `EchoProvider` from `@merit-systems/echo-next-sdk/client`
- Also uses `@merit-systems/echo-typescript-sdk` for server-side API calls

## Database (Prisma + PostgreSQL)
- Define models in `prisma/schema.prisma`
- Use `@prisma/client` for database queries
- Use global singleton pattern to prevent too many connections in development

## API Key Management
- Store API keys securely in the database (hashed)
- Validate API keys on each request
- Support key rotation and revocation

## Environment Variables
- `ECHO_APP_ID` — Server-side Echo app identifier
- `NEXT_PUBLIC_ECHO_APP_ID` — Client-side Echo app identifier
- `DATABASE_URL` — PostgreSQL connection string
25 changes: 25 additions & 0 deletions templates/react-chat/.cursor/rules/echo_rules.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
description: Guidelines for building Echo-powered React chat applications with Vite, AI SDK streaming, and shadcn/ui components
globs: **/*.ts,**/*.tsx,**/*.js,**/*.jsx
---

# Echo React Chat Guidelines

## SDK Setup
- Wrap app with `EchoProvider` from `@merit-systems/echo-react-sdk`
- Use `import.meta.env.VITE_ECHO_APP_ID` for the Echo app identifier
- Use `EchoTokens` component for authentication and token management

## Chat Integration
- Use `useChat` hook from `@ai-sdk/react`

## UI Components
- Use shadcn/ui components
- Tailwind CSS for styling

## Environment Variables
- `VITE_ECHO_APP_ID` — Client-side Echo identifier (Vite prefix required)

## Build & Development
- Dev: `npm run dev` (Vite)
- This is a client-side only app — no SSR
26 changes: 26 additions & 0 deletions templates/react-image/.cursor/rules/echo_rules.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
description: Guidelines for building Echo-powered React image generation applications with Vite and AI image models
globs: **/*.ts,**/*.tsx,**/*.js,**/*.jsx
---

# Echo React Image Generation Guidelines

## SDK Setup
- Wrap app with `EchoProvider` from `@merit-systems/echo-react-sdk`
- Use `import.meta.env.VITE_ECHO_APP_ID` for the Echo app identifier
- Use `EchoTokens` component for authentication and token management

## Image Generation
- Use `@ai-sdk/react` hooks for prompt submission
- Display generated images with loading states

## UI Components
- Use shadcn/ui components
- Tailwind CSS for styling

## Environment Variables
- `VITE_ECHO_APP_ID` — Client-side Echo identifier (Vite prefix required)

## Build & Development
- Dev: `npm run dev` (Vite)
- This is a client-side only app — no SSR
22 changes: 22 additions & 0 deletions templates/react/.cursor/rules/echo_rules.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
description: Guidelines for building Echo-powered React applications with Vite, including SDK setup, provider configuration, and AI integration
globs: **/*.ts,**/*.tsx,**/*.js,**/*.jsx
---

# Echo React (Vite) Guidelines

## SDK Setup
- Wrap app with `EchoProvider` from `@merit-systems/echo-react-sdk`
- Use `import.meta.env.VITE_ECHO_APP_ID` for environment variables (Vite convention)
- Use `EchoTokens` component for auth and token purchases

## AI Integration
- Use `@ai-sdk/react` hooks for chat and completion UIs
- React 19 is used — leverage new features like `use()` hook

## Environment Variables
- `VITE_ECHO_APP_ID` — Echo app identifier (client-side, exposed to browser)

## Common Patterns
- Build with Vite: `npm run dev`
- No server-side rendering — pure client-side app