veryfront 0.0.3 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,7 +1,214 @@
1
1
  # Veryfront
2
2
 
3
- Modern React meta-framework with native AI capabilities.
3
+ Veryfront is a **zero-config React framework** for building **agentic applications**. Automatically discovers agents, tools, and routes through file-based conventions.
4
+
5
+ ## Installation
6
+
7
+ **npm**
8
+ ```bash
9
+ npm install veryfront ai zod
10
+ ```
11
+
12
+ **yarn**
13
+ ```bash
14
+ yarn add veryfront ai zod
15
+ ```
16
+
17
+ **pnpm**
18
+ ```bash
19
+ pnpm add veryfront ai zod
20
+ ```
21
+
22
+ **bun**
23
+ ```bash
24
+ bun add veryfront ai zod
25
+ ```
26
+
27
+ **Deno**
28
+ ```bash
29
+ deno add npm:veryfront npm:ai npm:zod
30
+ ```
31
+
32
+ ---
33
+
34
+ ## Project Structure
35
+
36
+ ```
37
+ my-ai-app/
38
+ ├── .env
39
+ ├── app/
40
+ │ ├── chat/page.tsx
41
+ │ └── api/chat/route.ts
42
+ └── ai/
43
+ ├── agents/assistant.ts # Auto-registered
44
+ ├── tools/calculator.ts # Auto-discovered
45
+ └── resources/users/profile.ts # MCP resources
46
+ ```
47
+
48
+ The `ai/` directory auto-enables AI features. No config required.
49
+
50
+ ---
51
+
52
+ ## Quick Start
53
+
54
+ **1. Create an agent**
55
+
56
+ `ai/agents/assistant.ts`:
57
+ ```typescript
58
+ import { agent } from 'veryfront/ai';
59
+
60
+ export default agent({
61
+ model: 'openai/gpt-4',
62
+ system: 'You are a helpful assistant.',
63
+ tools: { calculator: true },
64
+ });
65
+ ```
66
+
67
+ **2. Add a tool**
68
+
69
+ `ai/tools/calculator.ts`:
70
+ ```typescript
71
+ import { tool } from 'veryfront/ai';
72
+ import { z } from 'zod';
73
+
74
+ export default tool({
75
+ description: 'Perform calculations',
76
+ inputSchema: z.object({ expression: z.string() }),
77
+ execute: async ({ expression }) => ({ result: eval(expression) }),
78
+ });
79
+ ```
80
+
81
+ **3. Create the API endpoint**
82
+
83
+ `app/api/chat/route.ts`:
84
+ ```typescript
85
+ import { agents } from '@/ai/agents';
86
+
87
+ export async function POST(req: Request) {
88
+ const { messages } = await req.json();
89
+ return agents.assistant.stream({ messages }).toDataStreamResponse();
90
+ }
91
+ ```
92
+
93
+ **4. Add the UI**
94
+
95
+ `app/chat/page.tsx`:
96
+ ```tsx
97
+ 'use client';
98
+ import { Chat } from 'veryfront/ai/components';
99
+ import { useChat } from 'veryfront/ai/react';
100
+
101
+ export default function ChatPage() {
102
+ return <Chat {...useChat({ api: '/api/chat' })} />;
103
+ }
104
+ ```
105
+
106
+ **5. Run**
107
+
108
+ ```bash
109
+ # Set your API key
110
+ echo "OPENAI_API_KEY=sk-..." > .env
111
+
112
+ # Start development server
113
+ npx veryfront dev
114
+ ```
115
+
116
+ Visit `localhost:3000/chat` - your agent can now use the calculator tool.
117
+
118
+ ---
119
+
120
+ ## UI Customization
121
+
122
+ **Styled components** (production-ready):
123
+ ```tsx
124
+ import { Chat } from 'veryfront/ai/components';
125
+ ```
126
+
127
+ **Primitives** (bring your own styles):
128
+ ```tsx
129
+ import { ChatContainer, MessageList, MessageItem } from 'veryfront/ai/primitives';
130
+ ```
131
+
132
+ **Headless hooks** (total control):
133
+ ```tsx
134
+ import { useChat } from 'veryfront/ai/react';
135
+ ```
136
+
137
+ ---
138
+
139
+ ## Model Context Protocol
140
+
141
+ MCP exposes your tools and resources to external AI applications. Enabled by default when `ai/` directory exists.
142
+
143
+ **Add a resource:**
144
+
145
+ `ai/resources/users/profile.ts`:
146
+ ```typescript
147
+ import { resource } from 'veryfront/ai';
148
+ import { z } from 'zod';
149
+
150
+ export default resource({
151
+ description: 'Get user profile',
152
+ paramsSchema: z.object({ userId: z.string() }),
153
+ async load({ userId }) {
154
+ return await db.users.findUnique({ where: { id: userId } });
155
+ },
156
+ });
157
+ ```
158
+
159
+ **Run MCP server:**
160
+ ```bash
161
+ npx veryfront dev --mcp # Port 3001 by default
162
+ ```
163
+
164
+ ---
165
+
166
+ ## Features
167
+
168
+ - **Zero config** - Auto-discovery from file structure
169
+ - **Multi-runtime** - Deno, Node.js, Bun, Cloudflare Workers
170
+ - **Full-stack React** - SSR, SSG, ISR, JIT rendering
171
+ - **MCP built-in** - Model Context Protocol server
172
+ - **Production-ready** - Rate limiting, caching, cost tracking, security
173
+
174
+ ---
175
+
176
+ ## Documentation
177
+
178
+ - [Quick Start Tutorial](https://veryfront.com/docs/learn/quickstart)
179
+ - [AI Getting Started](https://veryfront.com/docs/ai/getting-started)
180
+ - [Routing Guide](https://veryfront.com/docs/guides/routing)
181
+ - [Deployment Guide](https://veryfront.com/docs/guides/deployment)
182
+ - [API Reference](https://veryfront.com/docs/reference/ai)
183
+
184
+ [Browse all docs →](https://veryfront.com/docs)
185
+
186
+ ---
187
+
188
+ ## CLI Commands
189
+
190
+ ```bash
191
+ # Development
192
+ npx veryfront dev
193
+
194
+ # Build for production
195
+ npx veryfront build
196
+
197
+ # Start production server
198
+ npx veryfront start
199
+
200
+ # Run with MCP server
201
+ npx veryfront dev --mcp
202
+ ```
203
+
204
+ ---
205
+
206
+ ## Examples
207
+
208
+ See the [examples directory](https://github.com/veryfront/veryfront/tree/main/examples) for complete working examples.
209
+
210
+ ---
4
211
 
5
212
  ## License
6
213
 
7
- MIT License - see [LICENSE](./LICENSE)
214
+ MIT - see [LICENSE](./LICENSE)
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env node
2
+ // CLI entry point - calls main() from the bundled CLI
3
+ import { main } from '../dist/cli.js';
4
+ main().catch(err => {
5
+ console.error(err);
6
+ process.exit(1);
7
+ });
@@ -0,0 +1,7 @@
1
+ // src/ai/client.ts
2
+ import { useChat, useCompletion } from "ai/react";
3
+ export {
4
+ useChat,
5
+ useCompletion
6
+ };
7
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/ai/client.ts"],
4
+ "sourcesContent": ["/**\n * Client-only AI SDK exports\n *\n * This module exports React hooks from AI SDK that can only be used in browser environments.\n * These hooks require browser-specific APIs and should not be bundled for server-side code.\n *\n * @module ai/client\n */\n\n// Re-export AI SDK React hooks (battle-tested, proven in production)\n// These are client-only and require browser environment\nexport { useChat, useCompletion } from \"ai/react\";\n\n// Re-export core types that are useful on the client\nexport type { UseChatOptions, UseCompletionOptions } from \"ai/react\";\n"],
5
+ "mappings": ";AAWA,SAAS,SAAS,qBAAqB;",
6
+ "names": []
7
+ }