@dedesfr/prompter 0.9.0 → 1.1.0
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/CHANGELOG.md +35 -0
- package/README.md +105 -77
- package/dist/cli/index.js +25 -1
- package/dist/cli/index.js.map +1 -1
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +35 -9
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/login.d.ts +4 -0
- package/dist/commands/login.d.ts.map +1 -0
- package/dist/commands/login.js +56 -0
- package/dist/commands/login.js.map +1 -0
- package/dist/commands/logout.d.ts +4 -0
- package/dist/commands/logout.d.ts.map +1 -0
- package/dist/commands/logout.js +14 -0
- package/dist/commands/logout.js.map +1 -0
- package/dist/commands/update.d.ts +0 -2
- package/dist/commands/update.d.ts.map +1 -1
- package/dist/commands/update.js +19 -48
- package/dist/commands/update.js.map +1 -1
- package/dist/commands/whoami.d.ts +4 -0
- package/dist/commands/whoami.d.ts.map +1 -0
- package/dist/commands/whoami.js +42 -0
- package/dist/commands/whoami.js.map +1 -0
- package/dist/core/auth-store.d.ts +10 -0
- package/dist/core/auth-store.d.ts.map +1 -0
- package/dist/core/auth-store.js +39 -0
- package/dist/core/auth-store.js.map +1 -0
- package/dist/core/config.d.ts +0 -7
- package/dist/core/config.d.ts.map +1 -1
- package/dist/core/config.js +0 -128
- package/dist/core/config.js.map +1 -1
- package/dist/core/registry.d.ts +18 -0
- package/dist/core/registry.d.ts.map +1 -0
- package/dist/core/registry.js +94 -0
- package/dist/core/registry.js.map +1 -0
- package/package.json +7 -1
- package/AGENTS.md +0 -123
- package/CLAUDE.md +0 -17
- package/build.js +0 -20
- package/convex-setup.md +0 -403
- package/dist/core/prompt-templates.d.ts +0 -23
- package/dist/core/prompt-templates.d.ts.map +0 -1
- package/dist/core/prompt-templates.js +0 -3485
- package/dist/core/prompt-templates.js.map +0 -1
- package/prompt/ai-humanizer.md +0 -45
- package/prompt/api-contract-generator.md +0 -234
- package/prompt/apply.md +0 -17
- package/prompt/archive.md +0 -21
- package/prompt/design-system.md +0 -210
- package/prompt/document-explainer.md +0 -149
- package/prompt/epic-generator.md +0 -198
- package/prompt/epic-single.md +0 -47
- package/prompt/erd-generator.md +0 -130
- package/prompt/fsd-generator.md +0 -157
- package/prompt/prd-agent-generator.md +0 -147
- package/prompt/prd-generator.md +0 -195
- package/prompt/product-brief.md +0 -289
- package/prompt/proposal.md +0 -22
- package/prompt/qa-test-scenario.md +0 -133
- package/prompt/skill-creator.md +0 -350
- package/prompt/story-generator.md +0 -278
- package/prompt/story-single.md +0 -70
- package/prompt/tdd-generator.md +0 -294
- package/prompt/tdd-lite-generator.md +0 -224
- package/prompt/wireframe-generator.md +0 -219
- package/skills/ai-context-generator/SKILL.md +0 -54
- package/skills/ai-context-generator/references/AGENTS.template.md +0 -83
- package/skills/ai-context-generator/references/CLAUDE.template.md +0 -39
- package/skills/ai-context-generator/references/behavioral-guidelines.md +0 -71
- package/skills/ai-context-generator/references/discovery-checklist.md +0 -40
- package/skills/ai-context-generator/references/examples/AGENTS.good.md +0 -103
- package/skills/ai-context-generator/references/extraction-checklist.md +0 -23
- package/skills/ai-context-generator/references/overlays/laravel.md +0 -44
- package/skills/ai-humanizer/SKILL.md +0 -50
- package/skills/api-contract-generator/SKILL.md +0 -243
- package/skills/apply/SKILL.md +0 -23
- package/skills/archive/SKILL.md +0 -27
- package/skills/cerebro/SKILL.md +0 -187
- package/skills/cerebro/references/agents.md +0 -213
- package/skills/code-review/SKILL.md +0 -373
- package/skills/code-review/assets/report-template-agent.md +0 -212
- package/skills/code-review/assets/report-template-compact.md +0 -81
- package/skills/code-review/assets/report-template-full.md +0 -264
- package/skills/code-review/assets/report-template-human.md +0 -168
- package/skills/code-review/references/universal-patterns.md +0 -495
- package/skills/design-md/README.md +0 -34
- package/skills/design-md/SKILL.md +0 -172
- package/skills/design-md/examples/DESIGN.md +0 -154
- package/skills/design-system/SKILL.md +0 -216
- package/skills/design-system-generator/SKILL.md +0 -324
- package/skills/design-system-generator/assets/design-system-template.md +0 -348
- package/skills/design-system-generator/references/extraction-patterns.md +0 -321
- package/skills/doc-builder/SKILL.md +0 -115
- package/skills/doc-builder/references/ui-patterns.md +0 -394
- package/skills/document-explainer/SKILL.md +0 -155
- package/skills/document-translator/SKILL.md +0 -58
- package/skills/enhance/SKILL.md +0 -47
- package/skills/enhance-prompt/README.md +0 -34
- package/skills/enhance-prompt/SKILL.md +0 -204
- package/skills/enhance-prompt/references/KEYWORDS.md +0 -114
- package/skills/epic-generator/SKILL.md +0 -204
- package/skills/epic-single/SKILL.md +0 -63
- package/skills/erd-generator/SKILL.md +0 -138
- package/skills/feature-planner/SKILL.md +0 -305
- package/skills/feature-planner/assets/implementation-plan-template.md +0 -85
- package/skills/frontend-design/LICENSE.txt +0 -177
- package/skills/frontend-design/SKILL.md +0 -42
- package/skills/fsd-generator/SKILL.md +0 -163
- package/skills/gamma-builder/SKILL.md +0 -134
- package/skills/laravel-code-review/SKILL.md +0 -383
- package/skills/laravel-code-review/assets/report-template-agent.md +0 -195
- package/skills/laravel-code-review/assets/report-template-compact.md +0 -79
- package/skills/laravel-code-review/assets/report-template-full.md +0 -253
- package/skills/laravel-code-review/assets/report-template-human.md +0 -159
- package/skills/laravel-code-review/references/laravel-patterns.md +0 -571
- package/skills/laravel-code-review/references/php84-features.md +0 -442
- package/skills/mcp-builder/LICENSE.txt +0 -202
- package/skills/mcp-builder/SKILL.md +0 -236
- package/skills/mcp-builder/reference/evaluation.md +0 -602
- package/skills/mcp-builder/reference/mcp_best_practices.md +0 -249
- package/skills/mcp-builder/reference/node_mcp_server.md +0 -970
- package/skills/mcp-builder/reference/python_mcp_server.md +0 -719
- package/skills/mcp-builder/scripts/connections.py +0 -151
- package/skills/mcp-builder/scripts/evaluation.py +0 -373
- package/skills/mcp-builder/scripts/example_evaluation.xml +0 -22
- package/skills/mcp-builder/scripts/requirements.txt +0 -2
- package/skills/meeting-notes/SKILL.md +0 -159
- package/skills/meeting-notes/evals/evals.json +0 -23
- package/skills/prd-agent-generator/SKILL.md +0 -132
- package/skills/prd-generator/SKILL.md +0 -211
- package/skills/product-brief/SKILL.md +0 -141
- package/skills/project-orchestrator/SKILL.md +0 -487
- package/skills/project-orchestrator/assets/caddy-vps-setup.md +0 -180
- package/skills/project-orchestrator/assets/plan-summary-template.md +0 -159
- package/skills/prompter-specs/SKILL.md +0 -115
- package/skills/prompter-workflow/SKILL.md +0 -166
- package/skills/prompter-workflow/evals/evals.json +0 -89
- package/skills/proposal/SKILL.md +0 -28
- package/skills/qa-test-scenario/SKILL.md +0 -149
- package/skills/skill-creator/SKILL.md +0 -173
- package/skills/sph-generator/SKILL.md +0 -488
- package/skills/story-generator/SKILL.md +0 -285
- package/skills/story-single/SKILL.md +0 -86
- package/skills/tdd-generator/SKILL.md +0 -300
- package/skills/tdd-lite-generator/SKILL.md +0 -230
- package/skills/ui-ux-pro/SKILL.md +0 -199
- package/skills/ui-ux-pro/assets/design-spec-template.md +0 -173
- package/skills/ui-ux-pro/references/component-patterns.md +0 -255
- package/skills/ui-ux-pro/references/design-principles.md +0 -167
- package/skills/wireframe-generator/SKILL.md +0 -227
- package/src/cli/index.ts +0 -223
- package/src/commands/archive.ts +0 -302
- package/src/commands/change.ts +0 -292
- package/src/commands/config.ts +0 -233
- package/src/commands/guide.ts +0 -50
- package/src/commands/init.ts +0 -597
- package/src/commands/list.ts +0 -194
- package/src/commands/show.ts +0 -138
- package/src/commands/spec.ts +0 -251
- package/src/commands/update.ts +0 -129
- package/src/commands/upgrade.ts +0 -30
- package/src/commands/validate.ts +0 -326
- package/src/core/artifact-graph/graph.ts +0 -167
- package/src/core/artifact-graph/index.ts +0 -44
- package/src/core/artifact-graph/instruction-loader.ts +0 -302
- package/src/core/artifact-graph/resolver.ts +0 -226
- package/src/core/artifact-graph/schema.ts +0 -124
- package/src/core/artifact-graph/state.ts +0 -64
- package/src/core/artifact-graph/types.ts +0 -65
- package/src/core/completions/command-registry.ts +0 -382
- package/src/core/completions/completion-provider.ts +0 -128
- package/src/core/completions/generators/bash-generator.ts +0 -191
- package/src/core/completions/generators/fish-generator.ts +0 -188
- package/src/core/completions/generators/powershell-generator.ts +0 -223
- package/src/core/completions/generators/zsh-generator.ts +0 -281
- package/src/core/completions/templates/bash-templates.ts +0 -24
- package/src/core/completions/templates/fish-templates.ts +0 -40
- package/src/core/completions/templates/powershell-templates.ts +0 -25
- package/src/core/completions/templates/zsh-templates.ts +0 -36
- package/src/core/completions/types.ts +0 -90
- package/src/core/config-schema.ts +0 -230
- package/src/core/config.ts +0 -181
- package/src/core/configurators/slash/antigravity.ts +0 -10
- package/src/core/configurators/slash/base.ts +0 -109
- package/src/core/configurators/slash/claude.ts +0 -10
- package/src/core/configurators/slash/codex.ts +0 -10
- package/src/core/configurators/slash/droid.ts +0 -10
- package/src/core/configurators/slash/forge.ts +0 -10
- package/src/core/configurators/slash/github-copilot.ts +0 -10
- package/src/core/configurators/slash/index.ts +0 -10
- package/src/core/configurators/slash/kilocode.ts +0 -10
- package/src/core/configurators/slash/opencode.ts +0 -10
- package/src/core/configurators/slash/registry.ts +0 -51
- package/src/core/converters/json-converter.ts +0 -62
- package/src/core/global-config.ts +0 -136
- package/src/core/parsers/change-parser.ts +0 -234
- package/src/core/parsers/markdown-parser.ts +0 -237
- package/src/core/parsers/requirement-blocks.ts +0 -234
- package/src/core/prompt-templates.ts +0 -3504
- package/src/core/schemas/base.schema.ts +0 -20
- package/src/core/schemas/change.schema.ts +0 -42
- package/src/core/schemas/index.ts +0 -20
- package/src/core/schemas/spec.schema.ts +0 -17
- package/src/core/skill-discovery.ts +0 -68
- package/src/core/specs-apply.ts +0 -483
- package/src/core/styles/palette.ts +0 -8
- package/src/core/templates/agents-template.ts +0 -459
- package/src/core/templates/claude-template.ts +0 -2
- package/src/core/templates/index.ts +0 -3
- package/src/core/templates/project-template.ts +0 -32
- package/src/core/validation/constants.ts +0 -48
- package/src/core/validation/types.ts +0 -19
- package/src/core/validation/validator.ts +0 -449
- package/src/core/view.ts +0 -219
- package/src/index.ts +0 -1
- package/src/utils/change-metadata.ts +0 -171
- package/src/utils/change-utils.ts +0 -131
- package/src/utils/file-system.ts +0 -252
- package/src/utils/index.ts +0 -12
- package/src/utils/interactive.ts +0 -29
- package/src/utils/item-discovery.ts +0 -66
- package/src/utils/match.ts +0 -26
- package/src/utils/shell-detection.ts +0 -62
- package/src/utils/task-progress.ts +0 -43
- package/tsconfig.json +0 -28
package/AGENTS.md
DELETED
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
<!-- PROMPTER:START -->
|
|
2
|
-
# Prompter Instructions
|
|
3
|
-
|
|
4
|
-
These instructions are for AI assistants working in this project.
|
|
5
|
-
|
|
6
|
-
Always open `@/prompter/AGENTS.md` when the request:
|
|
7
|
-
- Mentions planning or proposals (words like proposal, spec, change, plan)
|
|
8
|
-
- Introduces new capabilities, breaking changes, architecture shifts, or big performance/security work
|
|
9
|
-
- Sounds ambiguous and you need the authoritative spec before coding
|
|
10
|
-
|
|
11
|
-
Use `@/prompter/AGENTS.md` to learn:
|
|
12
|
-
- How to create and apply change proposals
|
|
13
|
-
- Spec format and conventions
|
|
14
|
-
- Project structure and guidelines
|
|
15
|
-
- Show Remaining Tasks
|
|
16
|
-
|
|
17
|
-
<!-- PROMPTER:END -->
|
|
18
|
-
|
|
19
|
-
# AGENTS — Project Knowledge Base
|
|
20
|
-
## 1. 📍 Project Summary
|
|
21
|
-
Prompter CLI is a local-first developer tool that scaffolds and maintains AI workflow prompt templates. It initializes a `prompter/` workspace, generates slash-command templates for multiple AI coding tools, and lists enhanced prompts created by those workflows.
|
|
22
|
-
|
|
23
|
-
## 2. 🧱 Tech Stack
|
|
24
|
-
- Language: TypeScript (ESM)
|
|
25
|
-
- Runtime: Node.js >= 20
|
|
26
|
-
- CLI Framework: `commander`
|
|
27
|
-
- Interactive Prompts: `@inquirer/prompts`
|
|
28
|
-
- Terminal Output: `chalk`
|
|
29
|
-
- Build: `tsc` via `build.js`
|
|
30
|
-
- Tests: `vitest` (configured, no tests present)
|
|
31
|
-
|
|
32
|
-
## 3. 🏗️ Architecture Overview
|
|
33
|
-
- CLI entrypoint: `bin/prompter.js` → `dist/cli/index.js`.
|
|
34
|
-
- Commands: `init`, `update`, `list` implemented in `src/commands/`.
|
|
35
|
-
- Config and constants in `src/core/config.ts`.
|
|
36
|
-
- Template system in `src/core/templates/`, including slash-command bodies and project templates.
|
|
37
|
-
- Tool-specific workflow generation via configurators in `src/core/configurators/slash/`.
|
|
38
|
-
- Filesystem-only operations; no network or backend components.
|
|
39
|
-
|
|
40
|
-
## 4. 📁 Folder Structure & Important Files
|
|
41
|
-
- `src/cli/index.ts`: CLI command definitions.
|
|
42
|
-
- `src/commands/init.ts`: initialization workflow and tool selection.
|
|
43
|
-
- `src/commands/update.ts`: update workflow files.
|
|
44
|
-
- `src/commands/list.ts`: list enhanced prompts.
|
|
45
|
-
- `src/core/config.ts`: constants, supported tools, prompter directory helpers.
|
|
46
|
-
- `src/core/templates/`: template bodies and markers for workflow files.
|
|
47
|
-
- `src/core/configurators/slash/`: tool-specific file paths and frontmatter.
|
|
48
|
-
- `bin/prompter.js`: production CLI entry.
|
|
49
|
-
- `docs/product-spec.md`: product specification reference.
|
|
50
|
-
|
|
51
|
-
## 5. 🔑 Core Business Logic & Domain Rules
|
|
52
|
-
- Initialization is idempotent: if `prompter/` exists, `prompter init` exits with a warning.
|
|
53
|
-
- Workflow files include managed markers: `<!-- prompter-managed-start -->` and `<!-- prompter-managed-end -->`.
|
|
54
|
-
- Updates only replace content between markers; missing markers are treated as errors.
|
|
55
|
-
- Enhanced prompts live at `prompter/<slug>/enhanced-prompt.md`.
|
|
56
|
-
|
|
57
|
-
## 6. 🗂️ Data Models / Entities
|
|
58
|
-
- `ToolChoice`: tool selection metadata (name, id, availability, label).
|
|
59
|
-
- `EnhancedPrompt`: `{ id, path, createdAt }` derived from filesystem stats.
|
|
60
|
-
|
|
61
|
-
## 7. 🧠 Domain Vocabulary / Glossary
|
|
62
|
-
- **Prompter**: the CLI tool.
|
|
63
|
-
- **Enhanced Prompt**: AI-generated specification saved to `prompter/<slug>/enhanced-prompt.md`.
|
|
64
|
-
- **Workflow File**: tool-specific slash-command template file.
|
|
65
|
-
- **Markers**: managed section boundaries for safe updates.
|
|
66
|
-
|
|
67
|
-
## 8. 👥 Target Users & Personas
|
|
68
|
-
- Developers using AI coding assistants who want standardized prompt workflows.
|
|
69
|
-
- Team leads who need consistent prompt enhancement across repositories.
|
|
70
|
-
|
|
71
|
-
## 9. ✨ UI/UX Principles
|
|
72
|
-
- Clear CLI output with status icons and colorized feedback.
|
|
73
|
-
- Minimal prompts; optional non-interactive operation via flags.
|
|
74
|
-
|
|
75
|
-
## 10. 🔒 Security / Privacy Rules
|
|
76
|
-
- No authentication or authorization.
|
|
77
|
-
- Local filesystem only; no network calls.
|
|
78
|
-
- Avoid storing sensitive data in prompts unless repository policies allow it.
|
|
79
|
-
|
|
80
|
-
## 11. 🤖 Coding Conventions & Standards
|
|
81
|
-
- ESM imports with explicit `.js` extensions in compiled paths.
|
|
82
|
-
- Strict TypeScript (`tsconfig.json` uses `strict: true`).
|
|
83
|
-
- Prefer small, focused modules and clear command boundaries.
|
|
84
|
-
|
|
85
|
-
## 12. 🧩 Development Rules for AI Agents (must include rules: never invent endpoints/fields/models, match existing coding style and architecture, modify only necessary parts — never full rewrite, ask before executing risky changes, return diffs/patch format when editing)
|
|
86
|
-
- Never invent endpoints, fields, or models that do not exist in the repository.
|
|
87
|
-
- Match the existing coding style, module boundaries, and architecture.
|
|
88
|
-
- Modify only necessary parts; never do a full rewrite.
|
|
89
|
-
- Ask before executing risky or destructive changes.
|
|
90
|
-
- Return diffs/patch format when editing.
|
|
91
|
-
|
|
92
|
-
## 13. 🗺️ Integration Map
|
|
93
|
-
- Supported AI tools and their workflow file paths:
|
|
94
|
-
- Antigravity: `.agent/workflows/prompter-enhance.md`
|
|
95
|
-
- Claude Code: `.claude/commands/prompter/enhance.md`
|
|
96
|
-
- Codex: `.codex/prompts/prompter-enhance.md`
|
|
97
|
-
- GitHub Copilot: `.github/prompts/prompter-enhance.md`
|
|
98
|
-
- OpenCode: `.opencode/prompts/prompter-enhance.md`
|
|
99
|
-
- Kilo Code: `.kilocode/workflows/prompter-enhance.md`
|
|
100
|
-
|
|
101
|
-
## 14. 🗺️ Roadmap & Future Plans
|
|
102
|
-
- None documented in the repository.
|
|
103
|
-
|
|
104
|
-
## 15. ⚠️ Known Issues / Limitations
|
|
105
|
-
- No tests present despite vitest configuration.
|
|
106
|
-
- `prompter update` runs across all known tools, not just configured ones.
|
|
107
|
-
- Update requires markers; files missing markers cannot be updated.
|
|
108
|
-
|
|
109
|
-
## 16. 🧪 Testing Strategy
|
|
110
|
-
- Intended test runner: `vitest` (no test files currently present).
|
|
111
|
-
|
|
112
|
-
## 17. 🧯 Troubleshooting Guide
|
|
113
|
-
- If `prompter update` fails, verify the workflow file contains the managed markers.
|
|
114
|
-
- If `prompter list` is empty, ensure enhanced prompts exist at `prompter/<slug>/enhanced-prompt.md`.
|
|
115
|
-
- If `prompter init` says already initialized, remove or rename the existing `prompter/` directory only if safe.
|
|
116
|
-
|
|
117
|
-
## 18. 📞 Ownership / Responsibility Map
|
|
118
|
-
- Not specified; treat as repository owner-maintained.
|
|
119
|
-
|
|
120
|
-
## ⏳ Missing Information Needed
|
|
121
|
-
- Business roadmap, release plans, or milestones.
|
|
122
|
-
- Ownership contacts and support process.
|
|
123
|
-
- Any data retention or compliance requirements.
|
package/CLAUDE.md
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
<!-- PROMPTER:START -->
|
|
2
|
-
# Prompter Instructions
|
|
3
|
-
|
|
4
|
-
These instructions are for AI assistants working in this project.
|
|
5
|
-
|
|
6
|
-
Always open `@/prompter/CLAUDE.md` when the request:
|
|
7
|
-
- Mentions planning or proposals (words like proposal, spec, change, plan)
|
|
8
|
-
- Introduces new capabilities, breaking changes, architecture shifts, or big performance/security work
|
|
9
|
-
- Sounds ambiguous and you need the authoritative spec before coding
|
|
10
|
-
|
|
11
|
-
Use `@/prompter/CLAUDE.md` to learn:
|
|
12
|
-
- How to create and apply change proposals
|
|
13
|
-
- Spec format and conventions
|
|
14
|
-
- Project structure and guidelines
|
|
15
|
-
- Show Remaining Tasks
|
|
16
|
-
|
|
17
|
-
<!-- PROMPTER:END -->
|
package/build.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { execSync } from 'child_process';
|
|
2
|
-
import { rmSync, existsSync } from 'fs';
|
|
3
|
-
|
|
4
|
-
console.log('🔨 Building Prompter...\n');
|
|
5
|
-
|
|
6
|
-
// Clean dist directory
|
|
7
|
-
if (existsSync('dist')) {
|
|
8
|
-
console.log('Cleaning dist directory...');
|
|
9
|
-
rmSync('dist', { recursive: true });
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
// Compile TypeScript
|
|
13
|
-
console.log('Compiling TypeScript...');
|
|
14
|
-
try {
|
|
15
|
-
execSync('npx tsc', { stdio: 'inherit' });
|
|
16
|
-
console.log('\n✅ Build completed successfully!');
|
|
17
|
-
} catch (error) {
|
|
18
|
-
console.error('\n❌ Build failed');
|
|
19
|
-
process.exit(1);
|
|
20
|
-
}
|
package/convex-setup.md
DELETED
|
@@ -1,403 +0,0 @@
|
|
|
1
|
-
# Convex Self-Hosted Setup Guide
|
|
2
|
-
|
|
3
|
-
This document explains how to set up a self-hosted Convex deployment for this project using the official Convex self-hosted flow.
|
|
4
|
-
|
|
5
|
-
It covers:
|
|
6
|
-
|
|
7
|
-
- the Convex backend container
|
|
8
|
-
- the Convex dashboard container
|
|
9
|
-
- the frontend app connected through `VITE_CONVEX_URL`
|
|
10
|
-
- the Convex CLI workflow for deploying schema and functions to a self-hosted instance
|
|
11
|
-
|
|
12
|
-
## Official self-hosted flow
|
|
13
|
-
|
|
14
|
-
The official Convex self-hosted documentation uses this sequence:
|
|
15
|
-
|
|
16
|
-
1. start the backend and dashboard
|
|
17
|
-
2. generate the admin key from the running backend container
|
|
18
|
-
3. save `CONVEX_SELF_HOSTED_URL` and `CONVEX_SELF_HOSTED_ADMIN_KEY` in `.env.local`
|
|
19
|
-
4. use the Convex CLI to deploy schema and functions
|
|
20
|
-
5. run queries, mutations, imports, or seeds against the self-hosted backend
|
|
21
|
-
|
|
22
|
-
Important:
|
|
23
|
-
|
|
24
|
-
- The CLI admin key is generated from the running backend.
|
|
25
|
-
- Do not assume the Docker env value `CONVEX_ADMIN_KEY` is the same value the CLI expects.
|
|
26
|
-
- Do not use a random `openssl rand -hex 32` string as `CONVEX_SELF_HOSTED_ADMIN_KEY` unless Convex explicitly tells you to do so for your setup.
|
|
27
|
-
|
|
28
|
-
## How this project is wired
|
|
29
|
-
|
|
30
|
-
### Frontend
|
|
31
|
-
|
|
32
|
-
The frontend creates the Convex React client from `VITE_CONVEX_URL`:
|
|
33
|
-
|
|
34
|
-
```ts
|
|
35
|
-
const convex = new ConvexReactClient(import.meta.env.VITE_CONVEX_URL as string);
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
That means:
|
|
39
|
-
|
|
40
|
-
- `VITE_CONVEX_URL` must be reachable by the browser
|
|
41
|
-
- the frontend needs this value during local development
|
|
42
|
-
- when building the Docker image, the same value must be passed as a build argument
|
|
43
|
-
|
|
44
|
-
### Deploy script
|
|
45
|
-
|
|
46
|
-
This project exposes a self-hosted deploy script in `package.json`:
|
|
47
|
-
|
|
48
|
-
```json
|
|
49
|
-
{
|
|
50
|
-
"scripts": {
|
|
51
|
-
"deploy:selfhosted": "convex deploy --url $CONVEX_SELF_HOSTED_URL --admin-key $CONVEX_SELF_HOSTED_ADMIN_KEY"
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
## Prerequisites
|
|
57
|
-
|
|
58
|
-
Install these first:
|
|
59
|
-
|
|
60
|
-
- Node.js 22+
|
|
61
|
-
- npm
|
|
62
|
-
- Docker Desktop or Docker Engine with Compose
|
|
63
|
-
- project dependencies installed with `npm install`
|
|
64
|
-
|
|
65
|
-
If `node` or `npm` are missing from your `PATH`, use the Node 22 install configured for this project:
|
|
66
|
-
|
|
67
|
-
```bash
|
|
68
|
-
export PATH="$HOME/.nvm/versions/node/v22.17.1/bin:$PATH"
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
## Environment variables used by this project
|
|
72
|
-
|
|
73
|
-
This project uses two different configuration contexts.
|
|
74
|
-
|
|
75
|
-
### 1. Docker Compose environment
|
|
76
|
-
|
|
77
|
-
The compose stack reads values such as:
|
|
78
|
-
|
|
79
|
-
```env
|
|
80
|
-
APP_ENV=dev
|
|
81
|
-
WEB_PORT=8080
|
|
82
|
-
CONVEX_PORT=3220
|
|
83
|
-
CONVEX_DASHBOARD_PORT=3221
|
|
84
|
-
CONVEX_DASHBOARD_UI_PORT=6792
|
|
85
|
-
VITE_CONVEX_URL=http://localhost:3220
|
|
86
|
-
CONVEX_ADMIN_KEY=replace-with-placeholder-if-needed
|
|
87
|
-
CONVEX_CLOUD_ORIGIN=http://localhost:3220
|
|
88
|
-
CONVEX_SITE_ORIGIN=http://localhost:6792
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
Notes:
|
|
92
|
-
|
|
93
|
-
- `CONVEX_ADMIN_KEY` is passed into the backend container.
|
|
94
|
-
- In practice, the Convex CLI should use the admin key generated from the running backend container.
|
|
95
|
-
- `CONVEX_CLOUD_ORIGIN` should point to the backend API origin.
|
|
96
|
-
- `CONVEX_SITE_ORIGIN` should point to the dashboard UI origin.
|
|
97
|
-
|
|
98
|
-
### 2. Local CLI and frontend environment
|
|
99
|
-
|
|
100
|
-
For local development, `.env.local` should contain:
|
|
101
|
-
|
|
102
|
-
```env
|
|
103
|
-
VITE_CONVEX_URL=http://localhost:3220
|
|
104
|
-
CONVEX_SELF_HOSTED_URL=http://localhost:3220
|
|
105
|
-
CONVEX_SELF_HOSTED_ADMIN_KEY=convex-self-hosted|generated-from-container
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
Notes:
|
|
109
|
-
|
|
110
|
-
- `VITE_CONVEX_URL` is used by the frontend.
|
|
111
|
-
- `CONVEX_SELF_HOSTED_URL` and `CONVEX_SELF_HOSTED_ADMIN_KEY` are used by the Convex CLI.
|
|
112
|
-
- `.env.local` should not be committed.
|
|
113
|
-
|
|
114
|
-
## Reference Docker Compose pattern
|
|
115
|
-
|
|
116
|
-
This project uses the same high-level pattern as the official self-hosted documentation: one backend service and one dashboard service.
|
|
117
|
-
|
|
118
|
-
```yaml
|
|
119
|
-
services:
|
|
120
|
-
convex:
|
|
121
|
-
image: ghcr.io/get-convex/convex-backend:latest
|
|
122
|
-
ports:
|
|
123
|
-
- "${CONVEX_PORT:-3210}:3210"
|
|
124
|
-
- "${CONVEX_DASHBOARD_PORT:-3211}:3211"
|
|
125
|
-
volumes:
|
|
126
|
-
- convex-data:/convex/data
|
|
127
|
-
environment:
|
|
128
|
-
CONVEX_ADMIN_KEY: ${CONVEX_ADMIN_KEY}
|
|
129
|
-
CONVEX_CLOUD_ORIGIN: ${CONVEX_CLOUD_ORIGIN}
|
|
130
|
-
CONVEX_SITE_ORIGIN: ${CONVEX_SITE_ORIGIN}
|
|
131
|
-
|
|
132
|
-
convex-dashboard:
|
|
133
|
-
image: ghcr.io/get-convex/convex-dashboard:latest
|
|
134
|
-
depends_on:
|
|
135
|
-
convex:
|
|
136
|
-
condition: service_started
|
|
137
|
-
ports:
|
|
138
|
-
- "${CONVEX_DASHBOARD_UI_PORT:-6791}:6791"
|
|
139
|
-
environment:
|
|
140
|
-
NEXT_PUBLIC_DEPLOYMENT_URL: ${CONVEX_CLOUD_ORIGIN}
|
|
141
|
-
NEXT_PUBLIC_LOAD_MONACO_INTERNALLY: "true"
|
|
142
|
-
|
|
143
|
-
volumes:
|
|
144
|
-
convex-data:
|
|
145
|
-
```
|
|
146
|
-
|
|
147
|
-
In this repository, the actual compose file also includes a `web` service for the frontend.
|
|
148
|
-
|
|
149
|
-
## Step-by-step setup for this project
|
|
150
|
-
|
|
151
|
-
### 1. Install dependencies
|
|
152
|
-
|
|
153
|
-
From the repository root:
|
|
154
|
-
|
|
155
|
-
```bash
|
|
156
|
-
npm install
|
|
157
|
-
```
|
|
158
|
-
|
|
159
|
-
### 2. Create `.env.dev`
|
|
160
|
-
|
|
161
|
-
Copy the development template:
|
|
162
|
-
|
|
163
|
-
```bash
|
|
164
|
-
cp env.dev.example .env.dev
|
|
165
|
-
```
|
|
166
|
-
|
|
167
|
-
Recommended local values:
|
|
168
|
-
|
|
169
|
-
```env
|
|
170
|
-
APP_ENV=dev
|
|
171
|
-
WEB_PORT=8080
|
|
172
|
-
CONVEX_PORT=3220
|
|
173
|
-
CONVEX_DASHBOARD_PORT=3221
|
|
174
|
-
CONVEX_DASHBOARD_UI_PORT=6792
|
|
175
|
-
VITE_CONVEX_URL=http://localhost:3220
|
|
176
|
-
CONVEX_ADMIN_KEY=replace-with-placeholder-if-needed
|
|
177
|
-
CONVEX_CLOUD_ORIGIN=http://localhost:3220
|
|
178
|
-
CONVEX_SITE_ORIGIN=http://localhost:6792
|
|
179
|
-
```
|
|
180
|
-
|
|
181
|
-
Important:
|
|
182
|
-
|
|
183
|
-
- Treat `CONVEX_ADMIN_KEY` here as backend container configuration.
|
|
184
|
-
- Do not copy this value into `CONVEX_SELF_HOSTED_ADMIN_KEY` for CLI usage unless you have confirmed it is the generated self-hosted admin key for your instance.
|
|
185
|
-
|
|
186
|
-
### 3. Create `.env.local`
|
|
187
|
-
|
|
188
|
-
Create the local file with the frontend URL first:
|
|
189
|
-
|
|
190
|
-
```bash
|
|
191
|
-
cat > .env.local <<'EOF'
|
|
192
|
-
VITE_CONVEX_URL=http://localhost:3220
|
|
193
|
-
EOF
|
|
194
|
-
```
|
|
195
|
-
|
|
196
|
-
You will append the self-hosted CLI settings after the backend starts and after you generate the real admin key.
|
|
197
|
-
|
|
198
|
-
### 4. Start the Convex backend and dashboard
|
|
199
|
-
|
|
200
|
-
Run:
|
|
201
|
-
|
|
202
|
-
```bash
|
|
203
|
-
docker compose --env-file .env.dev up -d convex convex-dashboard
|
|
204
|
-
```
|
|
205
|
-
|
|
206
|
-
Check status:
|
|
207
|
-
|
|
208
|
-
```bash
|
|
209
|
-
docker compose --env-file .env.dev ps
|
|
210
|
-
```
|
|
211
|
-
|
|
212
|
-
Expected result:
|
|
213
|
-
|
|
214
|
-
- `convex` is running
|
|
215
|
-
- `convex-dashboard` is running
|
|
216
|
-
|
|
217
|
-
By default for local development in this project:
|
|
218
|
-
|
|
219
|
-
- backend API is available at `http://localhost:3220`
|
|
220
|
-
- backend dashboard/API port is mapped at `http://localhost:3221`
|
|
221
|
-
- dashboard UI is available at `http://localhost:6792`
|
|
222
|
-
|
|
223
|
-
## 5. Generate the real self-hosted admin key
|
|
224
|
-
|
|
225
|
-
After the backend is running, generate the admin key from the live Convex container.
|
|
226
|
-
|
|
227
|
-
Run:
|
|
228
|
-
|
|
229
|
-
```bash
|
|
230
|
-
docker compose --env-file .env.dev exec convex ./generate_admin_key.sh
|
|
231
|
-
```
|
|
232
|
-
|
|
233
|
-
Expected output format:
|
|
234
|
-
|
|
235
|
-
```text
|
|
236
|
-
convex-self-hosted|...
|
|
237
|
-
```
|
|
238
|
-
|
|
239
|
-
Copy that exact value.
|
|
240
|
-
|
|
241
|
-
Now append the self-hosted CLI settings to `.env.local`:
|
|
242
|
-
|
|
243
|
-
```bash
|
|
244
|
-
cat >> .env.local <<'EOF'
|
|
245
|
-
CONVEX_SELF_HOSTED_URL=http://localhost:3220
|
|
246
|
-
CONVEX_SELF_HOSTED_ADMIN_KEY=paste-the-generated-key-here
|
|
247
|
-
EOF
|
|
248
|
-
```
|
|
249
|
-
|
|
250
|
-
Important:
|
|
251
|
-
|
|
252
|
-
- Use the generated key exactly as printed.
|
|
253
|
-
- If you later recreate the backend state, generate the key again.
|
|
254
|
-
- If the backend uses a persistent Docker volume, the instance credentials can persist across restarts.
|
|
255
|
-
|
|
256
|
-
## 6. Deploy schema and functions
|
|
257
|
-
|
|
258
|
-
With `.env.local` configured, deploy the Convex schema and functions:
|
|
259
|
-
|
|
260
|
-
```bash
|
|
261
|
-
npm run deploy:selfhosted
|
|
262
|
-
```
|
|
263
|
-
|
|
264
|
-
Equivalent raw command:
|
|
265
|
-
|
|
266
|
-
```bash
|
|
267
|
-
convex deploy --url "$CONVEX_SELF_HOSTED_URL" --admin-key "$CONVEX_SELF_HOSTED_ADMIN_KEY"
|
|
268
|
-
```
|
|
269
|
-
|
|
270
|
-
If deployment succeeds, the self-hosted backend now has the current Convex schema and functions.
|
|
271
|
-
|
|
272
|
-
### Project-specific warning
|
|
273
|
-
|
|
274
|
-
This repository currently has a known self-hosted compatibility issue in `convex/schema.ts`: reserved index names such as `by_id` can cause deploy to fail on self-hosted Convex.
|
|
275
|
-
|
|
276
|
-
If you see an error like:
|
|
277
|
-
|
|
278
|
-
```text
|
|
279
|
-
IndexNameReserved: In table "agents" cannot name an index "by_id"
|
|
280
|
-
```
|
|
281
|
-
|
|
282
|
-
rename the reserved index names to something non-reserved such as `by_external_id`, then deploy again.
|
|
283
|
-
|
|
284
|
-
## 7. Seed or run commands against the backend
|
|
285
|
-
|
|
286
|
-
Once deploy succeeds, you can run Convex commands against the self-hosted instance.
|
|
287
|
-
|
|
288
|
-
For this project's seed function:
|
|
289
|
-
|
|
290
|
-
```bash
|
|
291
|
-
npx convex run seed:run '{}' \
|
|
292
|
-
--url http://localhost:3220 \
|
|
293
|
-
--admin-key "$CONVEX_SELF_HOSTED_ADMIN_KEY"
|
|
294
|
-
```
|
|
295
|
-
|
|
296
|
-
You can also use other CLI commands after configuration, for example:
|
|
297
|
-
|
|
298
|
-
```bash
|
|
299
|
-
npx convex --help
|
|
300
|
-
```
|
|
301
|
-
|
|
302
|
-
## 8. Run the frontend locally
|
|
303
|
-
|
|
304
|
-
Start the frontend development server:
|
|
305
|
-
|
|
306
|
-
```bash
|
|
307
|
-
npm run dev
|
|
308
|
-
```
|
|
309
|
-
|
|
310
|
-
Open the local Vite URL shown in the terminal, typically:
|
|
311
|
-
|
|
312
|
-
```text
|
|
313
|
-
http://localhost:5173
|
|
314
|
-
```
|
|
315
|
-
|
|
316
|
-
## 9. Optional Dockerized frontend
|
|
317
|
-
|
|
318
|
-
If you want to run the frontend through Docker Compose too:
|
|
319
|
-
|
|
320
|
-
```bash
|
|
321
|
-
docker compose --env-file .env.dev up -d --build
|
|
322
|
-
```
|
|
323
|
-
|
|
324
|
-
This project passes `VITE_CONVEX_URL` as a Docker build argument so the Vite app can be built with the correct public backend URL.
|
|
325
|
-
|
|
326
|
-
## Verification checklist
|
|
327
|
-
|
|
328
|
-
- `npm install` completes successfully
|
|
329
|
-
- `docker compose --env-file .env.dev up -d convex convex-dashboard` succeeds
|
|
330
|
-
- `docker compose --env-file .env.dev exec convex ./generate_admin_key.sh` returns a `convex-self-hosted|...` key
|
|
331
|
-
- `.env.local` contains `VITE_CONVEX_URL`, `CONVEX_SELF_HOSTED_URL`, and the generated `CONVEX_SELF_HOSTED_ADMIN_KEY`
|
|
332
|
-
- `npm run deploy:selfhosted` succeeds
|
|
333
|
-
- any seed or query command against the backend succeeds
|
|
334
|
-
- `npm run dev` starts the frontend successfully
|
|
335
|
-
- the frontend can load data from Convex
|
|
336
|
-
|
|
337
|
-
## Common mistakes
|
|
338
|
-
|
|
339
|
-
- using `.env.dev`'s `CONVEX_ADMIN_KEY` as the CLI admin key without generating the real self-hosted key from the container
|
|
340
|
-
- using a random string as `CONVEX_SELF_HOSTED_ADMIN_KEY`
|
|
341
|
-
- forgetting to deploy schema and functions before running seed commands
|
|
342
|
-
- using a `VITE_CONVEX_URL` that the browser cannot reach
|
|
343
|
-
- assuming changing `.env.dev` automatically updates credentials already persisted in a Docker volume
|
|
344
|
-
- overlooking self-hosted restrictions such as reserved index names during deploy
|
|
345
|
-
|
|
346
|
-
## Troubleshooting
|
|
347
|
-
|
|
348
|
-
### `401 Unauthorized: BadAdminKey`
|
|
349
|
-
|
|
350
|
-
Cause:
|
|
351
|
-
|
|
352
|
-
- the CLI is using the wrong admin key
|
|
353
|
-
|
|
354
|
-
Fix:
|
|
355
|
-
|
|
356
|
-
1. make sure the backend is running
|
|
357
|
-
2. run `docker compose --env-file .env.dev exec convex ./generate_admin_key.sh`
|
|
358
|
-
3. copy the printed `convex-self-hosted|...` value into `.env.local` as `CONVEX_SELF_HOSTED_ADMIN_KEY`
|
|
359
|
-
4. retry deploy or seed
|
|
360
|
-
|
|
361
|
-
### `Could not find function for 'seed:run'`
|
|
362
|
-
|
|
363
|
-
Cause:
|
|
364
|
-
|
|
365
|
-
- deploy has not succeeded yet, so the function is not available on the backend
|
|
366
|
-
|
|
367
|
-
Fix:
|
|
368
|
-
|
|
369
|
-
1. resolve the deploy error first
|
|
370
|
-
2. rerun `npm run deploy:selfhosted`
|
|
371
|
-
3. rerun the seed command
|
|
372
|
-
|
|
373
|
-
### `IndexNameReserved`
|
|
374
|
-
|
|
375
|
-
Cause:
|
|
376
|
-
|
|
377
|
-
- the schema defines a reserved index name such as `by_id`
|
|
378
|
-
|
|
379
|
-
Fix:
|
|
380
|
-
|
|
381
|
-
- rename the reserved index to a non-reserved name such as `by_external_id`
|
|
382
|
-
- redeploy
|
|
383
|
-
|
|
384
|
-
### Frontend fails because `VITE_CONVEX_URL` is missing
|
|
385
|
-
|
|
386
|
-
Cause:
|
|
387
|
-
|
|
388
|
-
- `.env.local` is missing or incomplete
|
|
389
|
-
|
|
390
|
-
Fix:
|
|
391
|
-
|
|
392
|
-
- recreate `.env.local`
|
|
393
|
-
- restart the frontend dev server
|
|
394
|
-
|
|
395
|
-
## Files in this project you can reuse as references
|
|
396
|
-
|
|
397
|
-
- `package.json`
|
|
398
|
-
- `docker-compose.yml`
|
|
399
|
-
- `Dockerfile`
|
|
400
|
-
- `env.dev.example`
|
|
401
|
-
- `env.prod.example`
|
|
402
|
-
- `src/providers/ConvexClientProvider.tsx`
|
|
403
|
-
- `prompter/changes/add-convex-backend/guide.md`
|