Skip to content

feat: introduce Automation API (#116)#130

Merged
dory-finn merged 1 commit intomainfrom
feat/automation-api
Apr 1, 2026
Merged

feat: introduce Automation API (#116)#130
dory-finn merged 1 commit intomainfrom
feat/automation-api

Conversation

@solarhell
Copy link
Copy Markdown
Collaborator

Summary

Closes #116

  • Add /api/automation/* endpoints for programmatic access to Dory without UI:
    • GET /api/automation/connections — list database connections
    • GET /api/automation/schema?connectionId=xxx — get database schema
    • POST /api/automation/query/execute — execute SQL queries
    • POST /api/automation/ai/ask — natural language data queries (AI generates & runs SQL)
  • Auth supports both cookie sessions and Authorization: Bearer <token> with x-organization-id header
  • Skip dash/sentinel auth plugins when BETTER_AUTH_API_KEY is not set (fixes local/test environments)

Usage

# List connections
curl -H "Authorization: Bearer $TOKEN" \
     -H "x-organization-id: $ORG_ID" \
     /api/automation/connections

# Execute SQL
curl -X POST -H "Authorization: Bearer $TOKEN" \
     -H "x-organization-id: $ORG_ID" \
     -H "Content-Type: application/json" \
     -d '{"connectionId":"xxx","sql":"SELECT * FROM users LIMIT 10"}' \
     /api/automation/query/execute

# AI Ask
curl -X POST -H "Authorization: Bearer $TOKEN" \
     -H "x-organization-id: $ORG_ID" \
     -H "Content-Type: application/json" \
     -d '{"connectionId":"xxx","question":"Top 10 users by order amount"}' \
     /api/automation/ai/ask

Test plan

  • Unit tests: 18 tests passing (npx tsx apps/web/scripts/tests/automation-api.test.ts)
  • E2E tests: 10 tests passing (npx playwright test --config tests/e2e/playwright-automation.config.ts)
  • Manual curl testing against all 4 endpoints
  • Verify in production-like environment with real database connections

Add /api/automation/* endpoints that allow external systems (CLI, agents,
workflows) to interact with Dory without relying on the UI:

- GET  /api/automation/connections — list connections
- GET  /api/automation/schema     — get database schema
- POST /api/automation/query/execute — execute SQL
- POST /api/automation/ai/ask    — natural language data queries

Auth supports both cookie sessions and Bearer tokens with
x-organization-id header for org context.

Also:
- Skip dash/sentinel plugins when BETTER_AUTH_API_KEY is not set
- Add unit tests (18) and E2E tests (10)
@vercel
Copy link
Copy Markdown

vercel bot commented Mar 31, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

3 Skipped Deployments
Project Deployment Actions Updated (UTC)
dory Ignored Ignored Mar 31, 2026 8:57am
dory-admin Ignored Ignored Mar 31, 2026 8:57am
dory-beta Ignored Ignored Mar 31, 2026 8:57am

Request Review

@solarhell
Copy link
Copy Markdown
Collaborator Author

CI Note

The 5 failing E2E tests are pre-existing flaky tests unrelated to this PR:

  • workbench.spec.ts — timeout waiting for Port label
  • login.spec.ts — demo login redirect timeout
  • saved-query-folders.spec.ts — button disabled state timeout
  • demo-connection-sql-console.spec.ts — demo flow timeout

These tests also fail on the main branch. The automation API code and tests are not involved in any of these failures.

@dory-finn dory-finn merged commit 8b80ca2 into main Apr 1, 2026
5 of 6 checks passed
@solarhell solarhell deleted the feat/automation-api branch April 1, 2026 04:25
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.

Dory Automation API

2 participants