@geenius/adapters 0.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.
Files changed (151) hide show
  1. package/.changeset/config.json +11 -0
  2. package/.github/CODEOWNERS +1 -0
  3. package/.github/ISSUE_TEMPLATE/bug_report.md +16 -0
  4. package/.github/ISSUE_TEMPLATE/feature_request.md +11 -0
  5. package/.github/PULL_REQUEST_TEMPLATE.md +10 -0
  6. package/.github/dependabot.yml +11 -0
  7. package/.github/workflows/ci.yml +23 -0
  8. package/.github/workflows/release.yml +29 -0
  9. package/.nvmrc +1 -0
  10. package/.project/ACCOUNT.yaml +4 -0
  11. package/.project/IDEAS.yaml +7 -0
  12. package/.project/PROJECT.yaml +11 -0
  13. package/.project/ROADMAP.yaml +15 -0
  14. package/CHANGELOG.md +11 -0
  15. package/CODE_OF_CONDUCT.md +16 -0
  16. package/CONTRIBUTING.md +26 -0
  17. package/LICENSE +21 -0
  18. package/README.md +202 -0
  19. package/SECURITY.md +15 -0
  20. package/SUPPORT.md +8 -0
  21. package/package.json +51 -0
  22. package/packages/convex/README.md +64 -0
  23. package/packages/convex/package.json +42 -0
  24. package/packages/convex/src/adapter.ts +39 -0
  25. package/packages/convex/src/index.ts +19 -0
  26. package/packages/convex/src/mutations.ts +142 -0
  27. package/packages/convex/src/queries.ts +106 -0
  28. package/packages/convex/src/schema.ts +54 -0
  29. package/packages/convex/src/types.ts +20 -0
  30. package/packages/convex/tsconfig.json +11 -0
  31. package/packages/convex/tsup.config.ts +10 -0
  32. package/packages/react/README.md +1 -0
  33. package/packages/react/package.json +45 -0
  34. package/packages/react/src/components/AdapterCard.tsx +49 -0
  35. package/packages/react/src/components/AdapterConfigForm.tsx +118 -0
  36. package/packages/react/src/components/AdapterList.tsx +84 -0
  37. package/packages/react/src/components/AdapterStatusBadge.tsx +30 -0
  38. package/packages/react/src/components/index.ts +4 -0
  39. package/packages/react/src/hooks/index.ts +75 -0
  40. package/packages/react/src/index.tsx +44 -0
  41. package/packages/react/src/pages/AdapterDetailPage.tsx +133 -0
  42. package/packages/react/src/pages/AdaptersPage.tsx +111 -0
  43. package/packages/react/src/pages/index.ts +2 -0
  44. package/packages/react/src/provider/AdapterProvider.tsx +115 -0
  45. package/packages/react/src/provider/index.ts +2 -0
  46. package/packages/react/tsconfig.json +18 -0
  47. package/packages/react/tsup.config.ts +10 -0
  48. package/packages/react-css/README.md +1 -0
  49. package/packages/react-css/package.json +44 -0
  50. package/packages/react-css/src/adapters.css +1576 -0
  51. package/packages/react-css/src/components/AdapterCard.tsx +34 -0
  52. package/packages/react-css/src/components/AdapterConfigForm.tsx +63 -0
  53. package/packages/react-css/src/components/AdapterList.tsx +40 -0
  54. package/packages/react-css/src/components/AdapterStatusBadge.tsx +21 -0
  55. package/packages/react-css/src/components/index.ts +4 -0
  56. package/packages/react-css/src/hooks/index.ts +75 -0
  57. package/packages/react-css/src/index.tsx +25 -0
  58. package/packages/react-css/src/pages/AdapterDetailPage.tsx +133 -0
  59. package/packages/react-css/src/pages/AdaptersPage.tsx +111 -0
  60. package/packages/react-css/src/pages/index.ts +2 -0
  61. package/packages/react-css/src/provider/AdapterProvider.tsx +115 -0
  62. package/packages/react-css/src/provider/index.ts +2 -0
  63. package/packages/react-css/src/styles.css +494 -0
  64. package/packages/react-css/tsconfig.json +19 -0
  65. package/packages/react-css/tsup.config.ts +2 -0
  66. package/packages/shared/README.md +1 -0
  67. package/packages/shared/package.json +39 -0
  68. package/packages/shared/src/__tests__/adapters.test.ts +545 -0
  69. package/packages/shared/src/admin/index.ts +2 -0
  70. package/packages/shared/src/admin/interface.ts +34 -0
  71. package/packages/shared/src/admin/localStorage.ts +109 -0
  72. package/packages/shared/src/ai/anthropic.ts +123 -0
  73. package/packages/shared/src/ai/cloudflare-gateway.ts +130 -0
  74. package/packages/shared/src/ai/gemini.ts +181 -0
  75. package/packages/shared/src/ai/index.ts +14 -0
  76. package/packages/shared/src/ai/interface.ts +11 -0
  77. package/packages/shared/src/ai/localStorage.ts +78 -0
  78. package/packages/shared/src/ai/ollama.ts +143 -0
  79. package/packages/shared/src/ai/openai.ts +120 -0
  80. package/packages/shared/src/ai/vercel-ai.ts +101 -0
  81. package/packages/shared/src/auth/better-auth.ts +118 -0
  82. package/packages/shared/src/auth/clerk.ts +151 -0
  83. package/packages/shared/src/auth/convex-auth.ts +125 -0
  84. package/packages/shared/src/auth/index.ts +10 -0
  85. package/packages/shared/src/auth/interface.ts +17 -0
  86. package/packages/shared/src/auth/localStorage.ts +125 -0
  87. package/packages/shared/src/auth/supabase-auth.ts +136 -0
  88. package/packages/shared/src/config.ts +57 -0
  89. package/packages/shared/src/constants.ts +122 -0
  90. package/packages/shared/src/db/convex.ts +146 -0
  91. package/packages/shared/src/db/index.ts +10 -0
  92. package/packages/shared/src/db/interface.ts +13 -0
  93. package/packages/shared/src/db/localStorage.ts +91 -0
  94. package/packages/shared/src/db/mongodb.ts +125 -0
  95. package/packages/shared/src/db/neon.ts +171 -0
  96. package/packages/shared/src/db/supabase.ts +158 -0
  97. package/packages/shared/src/index.ts +117 -0
  98. package/packages/shared/src/payments/index.ts +4 -0
  99. package/packages/shared/src/payments/interface.ts +11 -0
  100. package/packages/shared/src/payments/localStorage.ts +81 -0
  101. package/packages/shared/src/payments/stripe.ts +177 -0
  102. package/packages/shared/src/storage/convex.ts +113 -0
  103. package/packages/shared/src/storage/index.ts +14 -0
  104. package/packages/shared/src/storage/interface.ts +11 -0
  105. package/packages/shared/src/storage/localStorage.ts +95 -0
  106. package/packages/shared/src/storage/minio.ts +47 -0
  107. package/packages/shared/src/storage/r2.ts +123 -0
  108. package/packages/shared/src/storage/s3.ts +128 -0
  109. package/packages/shared/src/storage/supabase-storage.ts +116 -0
  110. package/packages/shared/src/storage/uploadthing.ts +126 -0
  111. package/packages/shared/src/styles/adapters.css +494 -0
  112. package/packages/shared/src/tier-gate.ts +119 -0
  113. package/packages/shared/src/types.ts +162 -0
  114. package/packages/shared/tsconfig.json +18 -0
  115. package/packages/shared/tsup.config.ts +9 -0
  116. package/packages/shared/vitest.config.ts +14 -0
  117. package/packages/solidjs/README.md +1 -0
  118. package/packages/solidjs/package.json +44 -0
  119. package/packages/solidjs/src/components/AdapterCard.tsx +24 -0
  120. package/packages/solidjs/src/components/AdapterConfigForm.tsx +54 -0
  121. package/packages/solidjs/src/components/AdapterList.tsx +28 -0
  122. package/packages/solidjs/src/components/AdapterStatusBadge.tsx +20 -0
  123. package/packages/solidjs/src/components/index.ts +4 -0
  124. package/packages/solidjs/src/index.tsx +17 -0
  125. package/packages/solidjs/src/pages/AdapterDetailPage.tsx +38 -0
  126. package/packages/solidjs/src/pages/AdaptersPage.tsx +39 -0
  127. package/packages/solidjs/src/pages/index.ts +2 -0
  128. package/packages/solidjs/src/primitives/index.ts +78 -0
  129. package/packages/solidjs/src/provider/AdapterProvider.tsx +62 -0
  130. package/packages/solidjs/src/provider/index.ts +2 -0
  131. package/packages/solidjs/tsconfig.json +20 -0
  132. package/packages/solidjs/tsup.config.ts +10 -0
  133. package/packages/solidjs-css/README.md +1 -0
  134. package/packages/solidjs-css/package.json +43 -0
  135. package/packages/solidjs-css/src/adapters.css +1576 -0
  136. package/packages/solidjs-css/src/components/AdapterCard.tsx +43 -0
  137. package/packages/solidjs-css/src/components/AdapterConfigForm.tsx +119 -0
  138. package/packages/solidjs-css/src/components/AdapterList.tsx +68 -0
  139. package/packages/solidjs-css/src/components/AdapterStatusBadge.tsx +24 -0
  140. package/packages/solidjs-css/src/components/index.ts +8 -0
  141. package/packages/solidjs-css/src/index.tsx +30 -0
  142. package/packages/solidjs-css/src/pages/AdapterDetailPage.tsx +107 -0
  143. package/packages/solidjs-css/src/pages/AdaptersPage.tsx +94 -0
  144. package/packages/solidjs-css/src/pages/index.ts +4 -0
  145. package/packages/solidjs-css/src/primitives/index.ts +1 -0
  146. package/packages/solidjs-css/src/provider/AdapterProvider.tsx +61 -0
  147. package/packages/solidjs-css/src/provider/index.ts +2 -0
  148. package/packages/solidjs-css/tsconfig.json +20 -0
  149. package/packages/solidjs-css/tsup.config.ts +2 -0
  150. package/pnpm-workspace.yaml +2 -0
  151. package/tsconfig.json +17 -0
@@ -0,0 +1,11 @@
1
+ {
2
+ "$schema": "https://unpkg.com/@changesets/config@3.1.1/schema.json",
3
+ "changelog": "@changesets/cli/changelog",
4
+ "commit": false,
5
+ "fixed": [],
6
+ "linked": [],
7
+ "access": "public",
8
+ "baseBranch": "main",
9
+ "updateInternalDependencies": "patch",
10
+ "ignore": []
11
+ }
@@ -0,0 +1 @@
1
+ * @mxn2020
@@ -0,0 +1,16 @@
1
+ ---
2
+ name: Bug Report
3
+ about: Report a bug
4
+ labels: bug
5
+ ---
6
+
7
+ ## Describe the bug
8
+
9
+ ## Steps to reproduce
10
+
11
+ ## Expected behavior
12
+
13
+ ## Environment
14
+ - Package version:
15
+ - Node version:
16
+ - OS:
@@ -0,0 +1,11 @@
1
+ ---
2
+ name: Feature Request
3
+ about: Suggest a new feature
4
+ labels: enhancement
5
+ ---
6
+
7
+ ## Problem
8
+
9
+ ## Proposed solution
10
+
11
+ ## Alternatives considered
@@ -0,0 +1,10 @@
1
+ ## What
2
+
3
+ ## Why
4
+
5
+ ## How
6
+
7
+ ## Checklist
8
+ - [ ] Tests added/updated
9
+ - [ ] `pnpm changeset` run (if applicable)
10
+ - [ ] Documentation updated
@@ -0,0 +1,11 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: "npm"
4
+ directory: "/"
5
+ schedule:
6
+ interval: "weekly"
7
+ open-pull-requests-limit: 10
8
+ - package-ecosystem: "github-actions"
9
+ directory: "/"
10
+ schedule:
11
+ interval: "weekly"
@@ -0,0 +1,23 @@
1
+ name: CI
2
+ on:
3
+ pull_request:
4
+ branches: [main]
5
+ push:
6
+ branches: [main]
7
+
8
+ jobs:
9
+ check:
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - uses: actions/checkout@v4
13
+ - uses: pnpm/action-setup@v4
14
+ with:
15
+ version: 10
16
+ - uses: actions/setup-node@v4
17
+ with:
18
+ node-version-file: '.nvmrc'
19
+ cache: 'pnpm'
20
+ - run: pnpm install --frozen-lockfile
21
+ - run: pnpm build
22
+ - run: pnpm lint
23
+ - run: pnpm test
@@ -0,0 +1,29 @@
1
+ name: Release
2
+ on:
3
+ push:
4
+ branches: [main]
5
+
6
+ concurrency: ${{ github.workflow }}-${{ github.ref }}
7
+
8
+ jobs:
9
+ release:
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - uses: actions/checkout@v4
13
+ - uses: pnpm/action-setup@v4
14
+ with:
15
+ version: 10
16
+ - uses: actions/setup-node@v4
17
+ with:
18
+ node-version-file: '.nvmrc'
19
+ cache: 'pnpm'
20
+ registry-url: 'https://registry.npmjs.org'
21
+ - run: pnpm install --frozen-lockfile
22
+ - run: pnpm build
23
+ - uses: changesets/action@v1
24
+ with:
25
+ publish: pnpm changeset publish
26
+ version: pnpm changeset version
27
+ env:
28
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
29
+ NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
package/.nvmrc ADDED
@@ -0,0 +1 @@
1
+ 22
@@ -0,0 +1,4 @@
1
+ owner: Mehdi Nabhani
2
+ email: mehdi@geenius.app
3
+ github: mxn2020
4
+ organization: geenius
@@ -0,0 +1,7 @@
1
+ ideas:
2
+ - title: "CLI scaffolding"
3
+ description: "Add a create command to geenius-cli for this package"
4
+ priority: medium
5
+ - title: "Vue adapter"
6
+ description: "Add Vue 3 support alongside React and SolidJS"
7
+ priority: low
@@ -0,0 +1,11 @@
1
+ name: geenius-adapters
2
+ description: "Geenius Adapters — Backend adapter abstraction layer for auth, db, payments, AI, and storage"
3
+ category: library
4
+ priority: high
5
+ tags:
6
+ - geenius
7
+ - npm-package
8
+ - react
9
+ - solidjs
10
+ deploy_url: null
11
+ npm_scope: "@geenius-adapters"
@@ -0,0 +1,15 @@
1
+ version: "0.1"
2
+ milestones:
3
+ - name: "v0.1.0 — Initial Release"
4
+ status: in-progress
5
+ items:
6
+ - "Core shared types and logic"
7
+ - "React hooks and components"
8
+ - "SolidJS primitives"
9
+ - "npm publishing via Changesets"
10
+ - name: "v0.2.0 — Stability"
11
+ status: planned
12
+ items:
13
+ - "Test coverage ≥ 50%"
14
+ - "API documentation"
15
+ - "Convex adapter"
package/CHANGELOG.md ADDED
@@ -0,0 +1,11 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [0.1.0] - 2026-03-21
9
+
10
+ ### Added
11
+ - Initial release
@@ -0,0 +1,16 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our
6
+ community a harassment-free experience for everyone, regardless of age, body
7
+ size, disability, ethnicity, gender identity and expression, level of experience,
8
+ education, socio-economic status, nationality, personal appearance, race,
9
+ religion, or sexual identity and orientation.
10
+
11
+ ## Enforcement
12
+
13
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
14
+ reported to the project team at conduct@geenius.app.
15
+
16
+ This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org), version 2.1.
@@ -0,0 +1,26 @@
1
+ # Contributing to @geenius-adapters
2
+
3
+ Thank you for your interest in contributing!
4
+
5
+ ## Development Setup
6
+
7
+ ```bash
8
+ git clone https://github.com/mxn2020/geenius-adapters.git
9
+ cd geenius-adapters
10
+ pnpm install
11
+ pnpm build
12
+ pnpm test
13
+ ```
14
+
15
+ ## Pull Request Process
16
+
17
+ 1. Fork the repo and create a feature branch from `main`
18
+ 2. Add or update tests as appropriate
19
+ 3. Run `pnpm changeset` to describe your changes for the changelog
20
+ 4. Open a PR against `main`
21
+
22
+ ## Code Style
23
+
24
+ - TypeScript strict mode
25
+ - ESLint + Prettier formatting
26
+ - Conventional commits preferred
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Mehdi Nabhani
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,202 @@
1
+ # `@geenius/adapters`
2
+
3
+ > The architectural lynchpin of the Geenius ecosystem — a unified adapter layer that makes backend services interchangeable with a one-file swap.
4
+
5
+ ---
6
+
7
+ ## Overview
8
+
9
+ `@geenius/adapters` defines **standard interfaces** for six infrastructure domains and provides concrete implementations for each. Any frontend component talks exclusively to an adapter interface — never to a database or service directly.
10
+
11
+ This is what makes "swap Convex for Supabase" a single-file change instead of a months-long rewrite.
12
+
13
+ ### Adapter Domains
14
+
15
+ | Domain | Interface | Providers |
16
+ |--------|-----------|-----------|
17
+ | **DB** | `DbAdapter` | `localStorage`, Convex, Supabase, Neon, MongoDB |
18
+ | **Auth** | `AuthAdapter` | `localStorage`, Better Auth, Convex Auth, Clerk, Supabase Auth |
19
+ | **Payments** | `PaymentsAdapter` | `localStorage`, Stripe, noop |
20
+ | **AI** | `AiAdapter` | `localStorage`, OpenAI, Anthropic, Gemini, Ollama, CF AI Gateway, Vercel AI SDK |
21
+ | **File Storage** | `FileStorageAdapter` | `localStorage`, R2, S3, Uploadthing, Supabase Storage, Convex Storage, Minio |
22
+ | **Admin** | `AdminAdapter` | `localStorage` |
23
+
24
+ ---
25
+
26
+ ## Installation
27
+
28
+ ```bash
29
+ pnpm add @geenius/adapters
30
+ ```
31
+
32
+ ## Sub-package Exports
33
+
34
+ ```typescript
35
+ import { configureAdapters, createConvexDbAdapter } from '@geenius/adapters' // shared (default)
36
+ import { AdapterProvider, useDb, useAuth, useAi } from '@geenius/adapters/react' // React hooks
37
+ import { AdapterProvider, createDb, createAuth } from '@geenius/adapters/solidjs' // SolidJS primitives
38
+ import { adapterTables } from '@geenius/adapters/convex' // Convex schema
39
+ import { AdaptersPage, AdapterCard } from '@geenius/adapters/react-css' // Styled React components
40
+ import { AdaptersPage, AdapterCard } from '@geenius/adapters/solidjs-css' // Styled SolidJS components
41
+ ```
42
+
43
+ ---
44
+
45
+ ## Quick Start
46
+
47
+ ### 1. Configure adapters at app startup
48
+
49
+ ```typescript
50
+ import { configureAdapters } from '@geenius/adapters'
51
+ import { createConvexDbAdapter } from '@geenius/adapters'
52
+
53
+ // Call once before rendering
54
+ configureAdapters({
55
+ db: { provider: 'convex' },
56
+ auth: { provider: 'better-auth' },
57
+ ai: { provider: 'openai', apiKey: process.env.OPENAI_API_KEY },
58
+ storage: { provider: 'r2' },
59
+ payments: { provider: 'stripe' },
60
+ })
61
+ ```
62
+
63
+ ### 2. Wrap your app with AdapterProvider (React)
64
+
65
+ ```tsx
66
+ import { AdapterProvider } from '@geenius/adapters/react'
67
+ import { createBetterAuthAdapter } from '@geenius/adapters'
68
+ import { createConvexDbAdapter } from '@geenius/adapters'
69
+
70
+ export function App() {
71
+ return (
72
+ <AdapterProvider
73
+ adapters={{
74
+ db: createConvexDbAdapter({ client: convex, functions: myFns }),
75
+ auth: createBetterAuthAdapter({ client: authClient }),
76
+ ai: createOpenAiAdapter({ apiKey: process.env.OPENAI_API_KEY }),
77
+ }}
78
+ healthCheck
79
+ >
80
+ <Router />
81
+ </AdapterProvider>
82
+ )
83
+ }
84
+ ```
85
+
86
+ ### 3. Use adapters in components
87
+
88
+ ```tsx
89
+ import { useAuth, useDb, useAi } from '@geenius/adapters/react'
90
+
91
+ export function Dashboard() {
92
+ const auth = useAuth()
93
+ const db = useDb()
94
+ const ai = useAi()
95
+
96
+ async function handleSignIn() {
97
+ await auth.signIn('user@example.com', 'password')
98
+ }
99
+
100
+ async function handleOAuth() {
101
+ const { url } = await auth.signInWithOAuth('google', { redirectUrl: '/dashboard' })
102
+ window.location.href = url
103
+ }
104
+
105
+ async function handleChat() {
106
+ const response = await ai.chat([{ role: 'user', content: 'Hello!' }])
107
+ console.log(response.content)
108
+ }
109
+ }
110
+ ```
111
+
112
+ ---
113
+
114
+ ## Prototyping with localStorage (Pronto tier)
115
+
116
+ Every domain ships a `localStorage` implementation for zero-config prototyping:
117
+
118
+ ```typescript
119
+ import {
120
+ createLocalStorageAuthAdapter,
121
+ createLocalStorageDbAdapter,
122
+ createLocalStorageAiAdapter,
123
+ createLocalStorageFileAdapter,
124
+ createLocalStoragePaymentsAdapter,
125
+ createLocalStorageAdminAdapter,
126
+ createNoopPaymentsAdapter,
127
+ } from '@geenius/adapters'
128
+ ```
129
+
130
+ These adapters persist data in the browser's localStorage with no external dependencies. Upgrade to real adapters by replacing a single file.
131
+
132
+ ---
133
+
134
+ ## Tier Gating
135
+
136
+ ```typescript
137
+ import { isFeatureAvailable, isPackageAvailable, getUpgradeFeatures } from '@geenius/adapters'
138
+
139
+ isFeatureAvailable('admin', 'pronto') // → false
140
+ isFeatureAvailable('admin', 'lancio') // → true
141
+ isFeatureAvailable('ai-magic', 'studio') // → true
142
+
143
+ getUpgradeFeatures('pronto', 'lancio')
144
+ // → ['admin', 'payments', 'blog', 'file-storage', 'ai-workflow', 'ai-embeddings']
145
+ ```
146
+
147
+ ---
148
+
149
+ ## Provider Registry
150
+
151
+ ```typescript
152
+ import { PROVIDER_REGISTRY, getProvidersForDomain, getProviderMeta } from '@geenius/adapters'
153
+
154
+ getProvidersForDomain('ai')
155
+ // → [{ id: 'localStorage', tier: 'pronto' }, { id: 'openai', tier: 'lancio' }, ...]
156
+
157
+ getProviderMeta('payments', 'stripe')
158
+ // → { id: 'stripe', name: 'Stripe', domain: 'payments', tier: 'lancio', ... }
159
+ ```
160
+
161
+ ---
162
+
163
+ ## Adapter Interface Contracts
164
+
165
+ All interfaces are **async (Promise-based)**, generic, and framework-agnostic. Swapping a provider only requires replacing the adapter factory call — no changes to consumers.
166
+
167
+ ```typescript
168
+ // AuthAdapter — all providers
169
+ interface AuthAdapter {
170
+ signIn(email: string, password: string): Promise<AuthSession>
171
+ signUp(email: string, password: string, name?: string): Promise<AuthSession>
172
+ signInWithOAuth(provider: OAuthProvider, options?: { redirectUrl?: string }): Promise<{ url: string }>
173
+ signOut(): Promise<void>
174
+ getSession(): Promise<AuthSession | null>
175
+ getUser(): Promise<AuthUser | null>
176
+ updateUser(updates: Partial<Pick<AuthUser, 'name' | 'image'>>): Promise<AuthUser | null>
177
+ }
178
+
179
+ // AiAdapter — all providers (stream is optional, falls back to chat)
180
+ interface AiAdapter {
181
+ chat(messages: ChatMessage[], options?: AiOptions): Promise<ChatResponse>
182
+ complete(prompt: string, options?: AiOptions): Promise<string>
183
+ embed(text: string | string[]): Promise<number[][]>
184
+ stream?(messages: ChatMessage[], options?: AiOptions): AsyncIterable<string>
185
+ }
186
+ ```
187
+
188
+ ---
189
+
190
+ ## Tier Availability
191
+
192
+ | Tier | Description |
193
+ |------|-------------|
194
+ | **Pronto** | Prototype-ready. localStorage only. Zero external deps. |
195
+ | **Lancio** | Production-ready. Real backends: Convex, Stripe, Better Auth, R2. |
196
+ | **Studio** | Full ecosystem. All Lancio providers + AI Magic, Analytics, Teams, and more. |
197
+
198
+ ---
199
+
200
+ ## License
201
+
202
+ MIT — © Antigravity HQ
package/SECURITY.md ADDED
@@ -0,0 +1,15 @@
1
+ # Security Policy
2
+
3
+ ## Supported Versions
4
+
5
+ | Version | Supported |
6
+ | ------- | --------- |
7
+ | 0.x.x | ✅ |
8
+
9
+ ## Reporting a Vulnerability
10
+
11
+ Please report security vulnerabilities by emailing **security@geenius.app**.
12
+
13
+ Do **not** open a public GitHub issue for security vulnerabilities.
14
+
15
+ We will acknowledge receipt within 48 hours and provide a detailed response within 5 business days.
package/SUPPORT.md ADDED
@@ -0,0 +1,8 @@
1
+ # Support
2
+
3
+ ## Getting Help
4
+
5
+ - 📖 [Documentation](https://docs.geenius.app)
6
+ - 🐛 [Bug Reports](https://github.com/mxn2020/geenius-adapters/issues/new?template=bug_report.md)
7
+ - 💡 [Feature Requests](https://github.com/mxn2020/geenius-adapters/issues/new?template=feature_request.md)
8
+ - 📧 Email: support@geenius.app
package/package.json ADDED
@@ -0,0 +1,51 @@
1
+ {
2
+ "name": "@geenius/adapters",
3
+ "version": "0.1.0",
4
+ "type": "module",
5
+ "scripts": {
6
+ "build": "pnpm -r build",
7
+ "lint": "pnpm -r lint",
8
+ "test": "pnpm -r test",
9
+ "clean": "pnpm -r clean"
10
+ },
11
+ "devDependencies": {
12
+ "typescript": "~6.0.2"
13
+ },
14
+ "author": "Antigravity HQ",
15
+ "license": "MIT",
16
+ "engines": {
17
+ "node": ">=20.0.0"
18
+ },
19
+ "exports": {
20
+ ".": {
21
+ "types": "./packages/shared/dist/index.d.ts",
22
+ "import": "./packages/shared/dist/index.js"
23
+ },
24
+ "./shared": {
25
+ "types": "./packages/shared/dist/index.d.ts",
26
+ "import": "./packages/shared/dist/index.js"
27
+ },
28
+ "./convex": {
29
+ "types": "./packages/convex/dist/index.d.ts",
30
+ "import": "./packages/convex/dist/index.js"
31
+ },
32
+ "./react": {
33
+ "types": "./packages/react/dist/index.d.ts",
34
+ "import": "./packages/react/dist/index.js"
35
+ },
36
+ "./react-css": {
37
+ "types": "./packages/react-css/dist/index.d.ts",
38
+ "import": "./packages/react-css/dist/index.js"
39
+ },
40
+ "./solidjs": {
41
+ "types": "./packages/solidjs/dist/index.d.ts",
42
+ "import": "./packages/solidjs/dist/index.js"
43
+ },
44
+ "./solidjs-css": {
45
+ "types": "./packages/solidjs-css/dist/index.d.ts",
46
+ "import": "./packages/solidjs-css/dist/index.js"
47
+ }
48
+ },
49
+ "main": "./packages/shared/dist/index.js",
50
+ "types": "./packages/shared/dist/index.d.ts"
51
+ }
@@ -0,0 +1,64 @@
1
+ # `@geenius-adapters/convex`
2
+
3
+ > Convex backend integration for `@geenius/adapters` — registry, health logs, and adapter lifecycle management.
4
+
5
+ ---
6
+
7
+ ## Overview
8
+
9
+ This sub-package provides the Convex schema, mutations, and queries needed to persist adapter registry state in a Convex backend. It tracks which adapters are registered, their current status, and health check history.
10
+
11
+ ## Installation
12
+
13
+ This package is a private workspace dependency used by the `@geenius/adapters` root package. It is consumed via the `/convex` export:
14
+
15
+ ```typescript
16
+ import { schema, registerAdapter, listAdapters } from '@geenius/adapters/convex'
17
+ ```
18
+
19
+ ## Schema
20
+
21
+ ### `adapter_registry`
22
+
23
+ Stores the active adapter configuration per domain.
24
+
25
+ | Field | Type | Description |
26
+ |-------|------|-------------|
27
+ | `domain` | string | Adapter domain (`db`, `auth`, `ai`, etc.) |
28
+ | `provider` | string | Provider name (e.g., `convex`, `openai`) |
29
+ | `status` | string | `active` \| `inactive` \| `error` |
30
+ | `config` | any | Provider-specific configuration |
31
+
32
+ ### `adapter_health_logs`
33
+
34
+ Tracks adapter health check results over time.
35
+
36
+ | Field | Type | Description |
37
+ |-------|------|-------------|
38
+ | `adapterId` | Id | Reference to `adapter_registry` |
39
+ | `domain` | string | Adapter domain |
40
+ | `status` | string | Check result (`healthy` \| `unhealthy`) |
41
+ | `latencyMs` | number | Check response time in ms |
42
+ | `timestamp` | number | Unix timestamp |
43
+
44
+ ## API
45
+
46
+ ### Mutations
47
+
48
+ - `registerAdapter(domain, provider, config?)` — Register or update an adapter for a domain
49
+ - `updateAdapterStatus(id, status)` — Update the status of a registered adapter
50
+ - `updateAdapter(id, updates)` — Update adapter configuration
51
+ - `removeAdapter(id)` — Remove adapter and all associated health logs
52
+
53
+ ### Queries
54
+
55
+ - `listAdapters()` — List all registered adapters
56
+ - `listAdaptersByDomain(domain)` — List adapters for a specific domain
57
+ - `getAdapter(id)` — Get a single adapter by ID
58
+ - `getActiveAdapter(domain)` — Get the currently active adapter for a domain
59
+ - `getAdapterStatusSummary()` — Aggregate status counts across all domains
60
+ - `getAdapterHealthLogs(adapterId, limit?)` — Get recent health logs for an adapter
61
+
62
+ ---
63
+
64
+ *Part of the [Geenius Boilerplate Ecosystem](https://github.com/AntigravityHQ/geenius) by Antigravity HQ*
@@ -0,0 +1,42 @@
1
+ {
2
+ "name": "@geenius-adapters/convex",
3
+ "version": "0.1.0",
4
+ "private": false,
5
+ "type": "module",
6
+ "description": "Convex adapter factory and configuration for database integration",
7
+ "author": "Antigravity HQ",
8
+ "license": "MIT",
9
+ "publishConfig": {
10
+ "access": "public"
11
+ },
12
+ "main": "./dist/index.js",
13
+ "module": "./dist/index.js",
14
+ "types": "./dist/index.d.ts",
15
+ "exports": {
16
+ ".": {
17
+ "types": "./dist/index.d.ts",
18
+ "import": "./dist/index.js"
19
+ }
20
+ },
21
+ "files": [
22
+ "dist",
23
+ "src"
24
+ ],
25
+ "scripts": {
26
+ "build": "tsup",
27
+ "clean": "rm -rf dist",
28
+ "type-check": "tsc --noEmit",
29
+ "prepublishOnly": "pnpm clean && pnpm build"
30
+ },
31
+ "peerDependencies": {
32
+ "convex": "^1.34.0"
33
+ },
34
+ "devDependencies": {
35
+ "convex": "^1.34.0",
36
+ "tsup": "^8.5.1",
37
+ "typescript": "~6.0.2"
38
+ },
39
+ "engines": {
40
+ "node": ">=20.0.0"
41
+ }
42
+ }
@@ -0,0 +1,39 @@
1
+ import type { ConvexAdapterConfig, ConvexDbAdapter } from './types'
2
+
3
+ /**
4
+ * Factory function to create a Convex database adapter
5
+ */
6
+ export function createConvexAdapter(
7
+ config: ConvexAdapterConfig,
8
+ ): ConvexDbAdapter {
9
+ let isConnected = false
10
+
11
+ return {
12
+ query: async (queryFn: string, args?: Record<string, unknown>) => {
13
+ if (!isConnected) {
14
+ throw new Error('Convex adapter not initialized')
15
+ }
16
+ // Placeholder: would execute query through Convex client
17
+ return null
18
+ },
19
+
20
+ mutation: async (
21
+ mutationFn: string,
22
+ args?: Record<string, unknown>,
23
+ ) => {
24
+ if (!isConnected) {
25
+ throw new Error('Convex adapter not initialized')
26
+ }
27
+ // Placeholder: would execute mutation through Convex client
28
+ return null
29
+ },
30
+
31
+ isReady: () => {
32
+ return isConnected
33
+ },
34
+
35
+ disconnect: async () => {
36
+ isConnected = false
37
+ },
38
+ }
39
+ }