Skip to content

feat(data): add local data service as Vite middleware#23

Merged
jheddings merged 1 commit intomainfrom
feat/data-service
Mar 30, 2026
Merged

feat(data): add local data service as Vite middleware#23
jheddings merged 1 commit intomainfrom
feat/data-service

Conversation

@jheddings
Copy link
Copy Markdown
Collaborator

@jheddings jheddings commented Mar 30, 2026

Summary

  • Adds LocalStore — file-based CRUD storage that reads/writes JSON files in the plugin's .data/ directory
  • Adds GraphQL-like handler supporting find, findOne, create, update, and delete operations
  • Adds Vite plugin that mounts the handler as Connect middleware at /api/data/graphql during everywhere view
  • Server-side code lives in cli/src/data/ (separate from the client SDK)

Plugins can now seed .data/<ModelName>.json files and interact with them through the data service while previewing. The useQuery/useMutation hooks from #22 will resolve against this endpoint via the HttpResolver.

Test plan

  • 118 tests pass across 17 test files
  • just check passes (typecheck + lint)
  • Smoke tested end-to-end: seed .data/Employee.json, start viewer, CRUD via curl
  • Create seed data in examples/hello/.data/ and verify all operations via curl:
    npm run preview
    # find, findOne, create, update, delete via POST /api/data/graphql
  • Verify .data/ files update on disk after create/update/delete

🤖 Generated with Claude Code

Adds a file-backed data service that runs inside the Vite dev server
during `everywhere view`. Plugins can read/write domain data via a
GraphQL-like protocol at /api/data/graphql, with records persisted to
JSON files in the plugin's .data/ directory.

- LocalStore: file-based CRUD storage with JSON files per model
- GraphQL handler: find, findOne, create, update, delete operations
- Vite plugin: Connect middleware wired into the existing dev server

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@jheddings jheddings merged commit 400bc16 into main Mar 30, 2026
2 checks passed
@jheddings jheddings deleted the feat/data-service branch March 30, 2026 23:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant