@yottagraph-app/aether-instructions 1.1.10 → 1.1.11
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/commands/build_my_app.md +2 -2
- package/package.json +1 -1
- package/rules/aether.mdc +2 -2
- package/rules/architecture.mdc +2 -2
- package/rules/server.mdc +37 -15
package/commands/build_my_app.md
CHANGED
|
@@ -82,7 +82,7 @@ Key capabilities:
|
|
|
82
82
|
|
|
83
83
|
- **Query Server / Elemental API** -- the primary data source. Use `useElementalClient()` from `@yottagraph-app/elemental-api/client`. See the `api` rule.
|
|
84
84
|
- **KV storage** -- always available for preferences and lightweight data (see `pref` rule)
|
|
85
|
-
- **
|
|
85
|
+
- **Neon Postgres** -- check if `DATABASE_URL` is in `.env` for database access (see `server` rule)
|
|
86
86
|
- **AI agent chat** -- use the `useAgentChat` composable to build a chat UI for deployed agents
|
|
87
87
|
- **MCP servers** -- Lovelace MCP servers may be available (check `.cursor/mcp.json`)
|
|
88
88
|
- **Components** -- Vuetify 3 component library is available
|
|
@@ -104,7 +104,7 @@ Plan what you'll build:
|
|
|
104
104
|
1. What pages to create in `pages/`
|
|
105
105
|
2. What reusable components to extract into `components/`
|
|
106
106
|
3. What shared logic belongs in `composables/`
|
|
107
|
-
4. What data needs to be persisted (and whether KV or
|
|
107
|
+
4. What data needs to be persisted (and whether KV or Neon Postgres is appropriate)
|
|
108
108
|
5. Whether the app needs AI agents or MCP servers
|
|
109
109
|
6. Whether the app needs an agent chat page (use the `useAgentChat` composable)
|
|
110
110
|
7. Whether `app.vue` needs a sidebar, tabs, or other navigation (and what it should look like)
|
package/package.json
CHANGED
package/rules/aether.mdc
CHANGED
|
@@ -10,7 +10,7 @@ alwaysApply: true
|
|
|
10
10
|
|
|
11
11
|
**Data:** The Query Server (Elemental API) is the primary data source -- entities, news, filings, sentiment, relationships, events. Use `useElementalClient()` from `@yottagraph-app/elemental-api/client`. Do NOT call external APIs for data the platform provides. Discovery-first: use `getSchema()` to discover entity types and properties at runtime. Skill docs: `skills/elemental-api/` (API endpoints) and `skills/data-model/` (Lovelace entity types, properties, relationships, YAML schemas per fetch source; `SKILL.md` first). Run `npm install` if those directories are empty. Lovelace MCP servers may also be configured (see `api` rule) but are optional — check your tool list before assuming they're available.
|
|
12
12
|
|
|
13
|
-
**Storage:** KV (Upstash Redis) for preferences and lightweight state via `Pref<T>` from `usePrefsStore()`.
|
|
13
|
+
**Storage:** KV (Upstash Redis) for preferences and lightweight state via `Pref<T>` from `usePrefsStore()`. Neon Postgres for relational data if connected (check `.env` for `DATABASE_URL`).
|
|
14
14
|
|
|
15
15
|
**Source of truth:** `DESIGN.md` -- read before starting work, update when changing features. The starter UI is placeholder -- replace freely. Feature docs in `design/` for implementation planning.
|
|
16
16
|
|
|
@@ -18,4 +18,4 @@ alwaysApply: true
|
|
|
18
18
|
|
|
19
19
|
**First action for a new project:** Run `/build_my_app`.
|
|
20
20
|
|
|
21
|
-
**Task-specific rules:** `architecture` (project structure, navigation, server routes, agents, MCP), `api` (Elemental API client, schema discovery, gotchas, optional MCP servers), `design` (DESIGN.md workflow, feature docs), `ui` (page templates, layout patterns), `cookbook` (copy-paste UI patterns), `pref` (KV preferences), `branding` (colors, fonts), `server` (Nitro routes,
|
|
21
|
+
**Task-specific rules:** `architecture` (project structure, navigation, server routes, agents, MCP), `api` (Elemental API client, schema discovery, gotchas, optional MCP servers), `design` (DESIGN.md workflow, feature docs), `ui` (page templates, layout patterns), `cookbook` (copy-paste UI patterns), `pref` (KV preferences), `branding` (colors, fonts), `server` (Nitro routes, Neon Postgres), `something-broke` (error recovery, build failures).
|
package/rules/architecture.mdc
CHANGED
|
@@ -30,11 +30,11 @@ mcp-servers/ # MCP servers (Python, deploy to Cloud Run)
|
|
|
30
30
|
|---|---|---|
|
|
31
31
|
| Query Server (Elemental API) | Lovelace Knowledge Graph | Entities, news, relationships, events, sentiment, filings |
|
|
32
32
|
| KV (Upstash Redis) | User preferences, lightweight state | Settings, watchlists, UI state that should persist |
|
|
33
|
-
|
|
|
33
|
+
| Neon Postgres | App-specific relational data | Custom tables, complex queries (if connected — check `DATABASE_URL` in `.env`) |
|
|
34
34
|
|
|
35
35
|
Use `useElementalClient()` for Query Server data (see `api` rule).
|
|
36
36
|
Use `Pref<T>` or `usePrefsStore()` for KV (see `pref` rule).
|
|
37
|
-
Check `.env` for `
|
|
37
|
+
Check `.env` for `DATABASE_URL` before using Neon Postgres (see `server` rule).
|
|
38
38
|
|
|
39
39
|
## Adding Pages
|
|
40
40
|
|
package/rules/server.mdc
CHANGED
|
@@ -67,33 +67,55 @@ if (redis) {
|
|
|
67
67
|
|
|
68
68
|
Returns `null` if KV is not configured (env vars missing). Always check.
|
|
69
69
|
|
|
70
|
-
##
|
|
70
|
+
## Neon Postgres
|
|
71
71
|
|
|
72
|
-
If
|
|
72
|
+
If a Neon database is connected to the project, Vercel auto-injects
|
|
73
|
+
`DATABASE_URL` (pooled) and `DATABASE_URL_UNPOOLED` (direct). For local
|
|
74
|
+
development, copy the connection string from Vercel project settings into
|
|
75
|
+
`.env`.
|
|
73
76
|
|
|
74
|
-
|
|
75
|
-
- `NUXT_PUBLIC_SUPABASE_ANON_KEY` — Public anon key (safe for client-side)
|
|
76
|
-
- `SUPABASE_SERVICE_ROLE_KEY` — Server-only service role key (never expose to client)
|
|
77
|
-
- `SUPABASE_DB_URL` — Direct Postgres connection string
|
|
77
|
+
### Utility pattern
|
|
78
78
|
|
|
79
|
-
|
|
79
|
+
Create `server/utils/neon.ts` following the same lazy-init pattern as
|
|
80
|
+
`redis.ts` — export a getter that returns `null` when the env var is missing:
|
|
80
81
|
|
|
81
82
|
```typescript
|
|
82
|
-
import {
|
|
83
|
+
import { neon, type NeonQueryFunction } from '@neondatabase/serverless';
|
|
83
84
|
|
|
84
|
-
|
|
85
|
-
process.env.NUXT_PUBLIC_SUPABASE_URL!,
|
|
86
|
-
process.env.SUPABASE_SERVICE_ROLE_KEY!, // server routes only
|
|
87
|
-
);
|
|
85
|
+
let _sql: NeonQueryFunction | null = null;
|
|
88
86
|
|
|
89
|
-
|
|
87
|
+
export function getDb(): NeonQueryFunction | null {
|
|
88
|
+
if (_sql) return _sql;
|
|
89
|
+
const url = process.env.DATABASE_URL;
|
|
90
|
+
if (!url) return null;
|
|
91
|
+
_sql = neon(url);
|
|
92
|
+
return _sql;
|
|
93
|
+
}
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Install the driver: `npm install @neondatabase/serverless`
|
|
97
|
+
|
|
98
|
+
### Usage in server routes
|
|
99
|
+
|
|
100
|
+
```typescript
|
|
101
|
+
import { getDb } from '~/server/utils/neon';
|
|
102
|
+
|
|
103
|
+
export default defineEventHandler(async () => {
|
|
104
|
+
const sql = getDb();
|
|
105
|
+
if (!sql) throw createError({ statusCode: 503, statusMessage: 'Database not configured' });
|
|
106
|
+
|
|
107
|
+
const rows = await sql`SELECT * FROM notes ORDER BY created_at DESC`;
|
|
108
|
+
return rows;
|
|
109
|
+
});
|
|
90
110
|
```
|
|
91
111
|
|
|
92
|
-
|
|
112
|
+
The driver uses tagged template literals for automatic SQL injection
|
|
113
|
+
protection — `await sql\`SELECT * FROM notes WHERE id = ${id}\`` is safe.
|
|
114
|
+
No ORM, no query builder, no connection pool setup needed.
|
|
93
115
|
|
|
94
116
|
## Key Differences from Client-Side Code
|
|
95
117
|
|
|
96
118
|
- Server routes run on the server (Node.js), not in the browser
|
|
97
|
-
- They have access to Redis,
|
|
119
|
+
- They have access to Redis, Neon Postgres, secrets, and server-only APIs
|
|
98
120
|
- They do NOT have access to Vue composables, Vuetify, or any client-side code
|
|
99
121
|
- Use `defineEventHandler`, not Vue component patterns
|