@codaijs/keel 0.2.3 → 0.2.4

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 (80) hide show
  1. package/dist/__tests__/sail-installer.test.js +25 -25
  2. package/dist/sail-installer.js +174 -174
  3. package/dist/scaffold.js +68 -68
  4. package/package.json +58 -58
  5. package/sails/_template/addon.json +20 -20
  6. package/sails/_template/install.ts +402 -402
  7. package/sails/admin-dashboard/README.md +117 -117
  8. package/sails/admin-dashboard/addon.json +28 -28
  9. package/sails/admin-dashboard/files/backend/middleware/admin.ts +34 -34
  10. package/sails/admin-dashboard/files/backend/routes/admin.ts +243 -243
  11. package/sails/admin-dashboard/files/frontend/components/admin/StatsCard.tsx +40 -40
  12. package/sails/admin-dashboard/files/frontend/components/admin/UsersTable.tsx +240 -240
  13. package/sails/admin-dashboard/files/frontend/hooks/useAdmin.ts +149 -149
  14. package/sails/admin-dashboard/files/frontend/pages/admin/Dashboard.tsx +173 -173
  15. package/sails/admin-dashboard/files/frontend/pages/admin/UserDetail.tsx +203 -203
  16. package/sails/admin-dashboard/install.ts +305 -305
  17. package/sails/analytics/README.md +178 -178
  18. package/sails/analytics/addon.json +27 -27
  19. package/sails/analytics/files/frontend/components/AnalyticsProvider.tsx +58 -58
  20. package/sails/analytics/files/frontend/hooks/useAnalytics.ts +64 -64
  21. package/sails/analytics/files/frontend/lib/analytics.ts +103 -103
  22. package/sails/analytics/install.ts +297 -297
  23. package/sails/file-uploads/addon.json +30 -30
  24. package/sails/file-uploads/files/backend/routes/files.ts +198 -198
  25. package/sails/file-uploads/files/backend/schema/files.ts +36 -36
  26. package/sails/file-uploads/files/backend/services/file-storage.ts +128 -128
  27. package/sails/file-uploads/files/frontend/components/FileList.tsx +248 -248
  28. package/sails/file-uploads/files/frontend/components/FileUploadButton.tsx +147 -147
  29. package/sails/file-uploads/files/frontend/hooks/useFileUpload.ts +106 -106
  30. package/sails/file-uploads/files/frontend/hooks/useFiles.ts +118 -118
  31. package/sails/file-uploads/files/frontend/pages/Files.tsx +37 -37
  32. package/sails/file-uploads/install.ts +466 -466
  33. package/sails/gdpr/README.md +174 -174
  34. package/sails/gdpr/addon.json +27 -27
  35. package/sails/gdpr/files/backend/routes/gdpr.ts +140 -140
  36. package/sails/gdpr/files/backend/services/gdpr.ts +293 -293
  37. package/sails/gdpr/files/frontend/components/auth/ConsentCheckboxes.tsx +97 -97
  38. package/sails/gdpr/files/frontend/components/gdpr/AccountDeletionRequest.tsx +192 -192
  39. package/sails/gdpr/files/frontend/components/gdpr/DataExportButton.tsx +75 -75
  40. package/sails/gdpr/files/frontend/pages/PrivacyPolicy.tsx +186 -186
  41. package/sails/gdpr/install.ts +756 -756
  42. package/sails/google-oauth/README.md +121 -121
  43. package/sails/google-oauth/addon.json +22 -22
  44. package/sails/google-oauth/files/GoogleButton.tsx +50 -50
  45. package/sails/google-oauth/install.ts +252 -252
  46. package/sails/i18n/README.md +193 -193
  47. package/sails/i18n/addon.json +30 -30
  48. package/sails/i18n/files/frontend/components/LanguageSwitcher.tsx +108 -108
  49. package/sails/i18n/files/frontend/hooks/useLanguage.ts +31 -31
  50. package/sails/i18n/files/frontend/lib/i18n.ts +32 -32
  51. package/sails/i18n/files/frontend/locales/de/common.json +44 -44
  52. package/sails/i18n/files/frontend/locales/en/common.json +44 -44
  53. package/sails/i18n/install.ts +407 -407
  54. package/sails/push-notifications/README.md +163 -163
  55. package/sails/push-notifications/addon.json +31 -31
  56. package/sails/push-notifications/files/backend/routes/notifications.ts +153 -153
  57. package/sails/push-notifications/files/backend/schema/notifications.ts +31 -31
  58. package/sails/push-notifications/files/backend/services/notifications.ts +117 -117
  59. package/sails/push-notifications/files/frontend/components/PushNotificationInit.tsx +12 -12
  60. package/sails/push-notifications/files/frontend/hooks/usePushNotifications.ts +154 -154
  61. package/sails/push-notifications/install.ts +384 -384
  62. package/sails/r2-storage/addon.json +29 -29
  63. package/sails/r2-storage/files/backend/services/storage.ts +71 -71
  64. package/sails/r2-storage/files/frontend/components/ProfilePictureUpload.tsx +167 -167
  65. package/sails/r2-storage/install.ts +412 -412
  66. package/sails/rate-limiting/addon.json +20 -20
  67. package/sails/rate-limiting/files/backend/middleware/rate-limit-store.ts +104 -104
  68. package/sails/rate-limiting/files/backend/middleware/rate-limit.ts +137 -137
  69. package/sails/rate-limiting/install.ts +300 -300
  70. package/sails/registry.json +107 -107
  71. package/sails/stripe/README.md +214 -214
  72. package/sails/stripe/addon.json +24 -24
  73. package/sails/stripe/files/backend/routes/stripe.ts +154 -154
  74. package/sails/stripe/files/backend/schema/stripe.ts +74 -74
  75. package/sails/stripe/files/backend/services/stripe.ts +224 -224
  76. package/sails/stripe/files/frontend/components/SubscriptionStatus.tsx +135 -135
  77. package/sails/stripe/files/frontend/hooks/useSubscription.ts +86 -86
  78. package/sails/stripe/files/frontend/pages/Checkout.tsx +116 -116
  79. package/sails/stripe/files/frontend/pages/Pricing.tsx +226 -226
  80. package/sails/stripe/install.ts +378 -378
@@ -1,121 +1,121 @@
1
- # Google OAuth Sail
2
-
3
- Adds Google sign-in to your keel application using BetterAuth's social provider system.
4
-
5
- ## Prerequisites
6
-
7
- - A Google Cloud project
8
- - OAuth 2.0 credentials (Client ID and Client Secret)
9
-
10
- ## Installation
11
-
12
- ```bash
13
- npx tsx sails/google-oauth/install.ts
14
- ```
15
-
16
- The installer will prompt for your Google OAuth credentials and configure everything automatically.
17
-
18
- ## Manual Setup: Google Cloud Console
19
-
20
- ### 1. Create or Select a Project
21
-
22
- 1. Go to [Google Cloud Console](https://console.cloud.google.com/)
23
- 2. Click the project dropdown in the top bar
24
- 3. Click **New Project** or select an existing one
25
-
26
- ### 2. Enable the Google+ API (if not enabled)
27
-
28
- 1. Go to **APIs & Services** > **Library**
29
- 2. Search for "Google+ API" or "Google Identity"
30
- 3. Click **Enable**
31
-
32
- ### 3. Configure the OAuth Consent Screen
33
-
34
- 1. Go to **APIs & Services** > **OAuth consent screen**
35
- 2. Select **External** (or **Internal** for Google Workspace orgs)
36
- 3. Fill in the required fields:
37
- - **App name**: Your application name
38
- - **User support email**: Your email
39
- - **Developer contact information**: Your email
40
- 4. Add scopes: `email`, `profile`, `openid`
41
- 5. Add test users if in "Testing" mode
42
-
43
- ### 4. Create OAuth 2.0 Credentials
44
-
45
- 1. Go to **APIs & Services** > **Credentials**
46
- 2. Click **Create Credentials** > **OAuth client ID**
47
- 3. Select **Web application**
48
- 4. Set the name (e.g., "My App - Web")
49
- 5. Add **Authorized JavaScript origins**:
50
- - `http://localhost:5173` (Vite dev server)
51
- - `https://yourdomain.com` (production)
52
- 6. Add **Authorized redirect URIs**:
53
- - `http://localhost:3000/api/auth/callback/google` (development)
54
- - `https://yourdomain.com/api/auth/callback/google` (production)
55
- 7. Click **Create**
56
- 8. Copy the **Client ID** and **Client Secret**
57
-
58
- ### 5. Configure Environment Variables
59
-
60
- Add to your `.env` file:
61
-
62
- ```env
63
- GOOGLE_CLIENT_ID=your-client-id.apps.googleusercontent.com
64
- GOOGLE_CLIENT_SECRET=your-client-secret
65
- ```
66
-
67
- ## How It Works
68
-
69
- ### Authentication Flow
70
-
71
- 1. User clicks "Continue with Google" button
72
- 2. BetterAuth redirects to Google's OAuth consent screen
73
- 3. User authorizes the application
74
- 4. Google redirects back to `/api/auth/callback/google`
75
- 5. BetterAuth creates or links the user account
76
- 6. User is redirected to the dashboard
77
-
78
- ### Files Modified
79
-
80
- **Backend:**
81
- - `src/auth/index.ts` -- Google added as a social provider in BetterAuth config
82
- - `src/env.ts` -- Environment variable validation for Google credentials
83
-
84
- **Frontend:**
85
- - `src/components/auth/LoginForm.tsx` -- Google sign-in button added
86
- - `src/components/auth/SignupForm.tsx` -- Google sign-in button added
87
-
88
- ### Files Added
89
-
90
- **Frontend:**
91
- - `src/components/auth/GoogleButton.tsx` -- Styled Google sign-in button component
92
-
93
- ## Capacitor / Native Apps
94
-
95
- For native mobile apps using Capacitor, Google OAuth works through the system browser (in-app browser tab). The redirect URI remains the same since the native app loads the web app in a WebView.
96
-
97
- If you need native Google Sign-In (using the Google SDK directly), you will need to:
98
-
99
- 1. Create separate OAuth credentials for iOS and Android
100
- 2. Use `@capacitor/google-auth` plugin
101
- 3. Pass the token to BetterAuth for session creation
102
-
103
- ## Troubleshooting
104
-
105
- ### "redirect_uri_mismatch" Error
106
-
107
- Make sure your redirect URI in Google Cloud Console exactly matches:
108
- - Development: `http://localhost:3000/api/auth/callback/google`
109
- - Production: `https://yourdomain.com/api/auth/callback/google`
110
-
111
- The port must match your backend server port, and the path is determined by BetterAuth.
112
-
113
- ### "Access blocked: app has not completed verification"
114
-
115
- Your OAuth consent screen is in "Testing" mode. Either:
116
- - Add test users in the consent screen settings, or
117
- - Submit your app for verification (required for production)
118
-
119
- ### Users Not Being Linked
120
-
121
- If a user signs up with email/password and later tries Google OAuth with the same email, BetterAuth will attempt to link the accounts. Make sure `account linking` is enabled in your BetterAuth configuration.
1
+ # Google OAuth Sail
2
+
3
+ Adds Google sign-in to your keel application using BetterAuth's social provider system.
4
+
5
+ ## Prerequisites
6
+
7
+ - A Google Cloud project
8
+ - OAuth 2.0 credentials (Client ID and Client Secret)
9
+
10
+ ## Installation
11
+
12
+ ```bash
13
+ npx tsx sails/google-oauth/install.ts
14
+ ```
15
+
16
+ The installer will prompt for your Google OAuth credentials and configure everything automatically.
17
+
18
+ ## Manual Setup: Google Cloud Console
19
+
20
+ ### 1. Create or Select a Project
21
+
22
+ 1. Go to [Google Cloud Console](https://console.cloud.google.com/)
23
+ 2. Click the project dropdown in the top bar
24
+ 3. Click **New Project** or select an existing one
25
+
26
+ ### 2. Enable the Google+ API (if not enabled)
27
+
28
+ 1. Go to **APIs & Services** > **Library**
29
+ 2. Search for "Google+ API" or "Google Identity"
30
+ 3. Click **Enable**
31
+
32
+ ### 3. Configure the OAuth Consent Screen
33
+
34
+ 1. Go to **APIs & Services** > **OAuth consent screen**
35
+ 2. Select **External** (or **Internal** for Google Workspace orgs)
36
+ 3. Fill in the required fields:
37
+ - **App name**: Your application name
38
+ - **User support email**: Your email
39
+ - **Developer contact information**: Your email
40
+ 4. Add scopes: `email`, `profile`, `openid`
41
+ 5. Add test users if in "Testing" mode
42
+
43
+ ### 4. Create OAuth 2.0 Credentials
44
+
45
+ 1. Go to **APIs & Services** > **Credentials**
46
+ 2. Click **Create Credentials** > **OAuth client ID**
47
+ 3. Select **Web application**
48
+ 4. Set the name (e.g., "My App - Web")
49
+ 5. Add **Authorized JavaScript origins**:
50
+ - `http://localhost:5173` (Vite dev server)
51
+ - `https://yourdomain.com` (production)
52
+ 6. Add **Authorized redirect URIs**:
53
+ - `http://localhost:3000/api/auth/callback/google` (development)
54
+ - `https://yourdomain.com/api/auth/callback/google` (production)
55
+ 7. Click **Create**
56
+ 8. Copy the **Client ID** and **Client Secret**
57
+
58
+ ### 5. Configure Environment Variables
59
+
60
+ Add to your `.env` file:
61
+
62
+ ```env
63
+ GOOGLE_CLIENT_ID=your-client-id.apps.googleusercontent.com
64
+ GOOGLE_CLIENT_SECRET=your-client-secret
65
+ ```
66
+
67
+ ## How It Works
68
+
69
+ ### Authentication Flow
70
+
71
+ 1. User clicks "Continue with Google" button
72
+ 2. BetterAuth redirects to Google's OAuth consent screen
73
+ 3. User authorizes the application
74
+ 4. Google redirects back to `/api/auth/callback/google`
75
+ 5. BetterAuth creates or links the user account
76
+ 6. User is redirected to the dashboard
77
+
78
+ ### Files Modified
79
+
80
+ **Backend:**
81
+ - `src/auth/index.ts` -- Google added as a social provider in BetterAuth config
82
+ - `src/env.ts` -- Environment variable validation for Google credentials
83
+
84
+ **Frontend:**
85
+ - `src/components/auth/LoginForm.tsx` -- Google sign-in button added
86
+ - `src/components/auth/SignupForm.tsx` -- Google sign-in button added
87
+
88
+ ### Files Added
89
+
90
+ **Frontend:**
91
+ - `src/components/auth/GoogleButton.tsx` -- Styled Google sign-in button component
92
+
93
+ ## Capacitor / Native Apps
94
+
95
+ For native mobile apps using Capacitor, Google OAuth works through the system browser (in-app browser tab). The redirect URI remains the same since the native app loads the web app in a WebView.
96
+
97
+ If you need native Google Sign-In (using the Google SDK directly), you will need to:
98
+
99
+ 1. Create separate OAuth credentials for iOS and Android
100
+ 2. Use `@capacitor/google-auth` plugin
101
+ 3. Pass the token to BetterAuth for session creation
102
+
103
+ ## Troubleshooting
104
+
105
+ ### "redirect_uri_mismatch" Error
106
+
107
+ Make sure your redirect URI in Google Cloud Console exactly matches:
108
+ - Development: `http://localhost:3000/api/auth/callback/google`
109
+ - Production: `https://yourdomain.com/api/auth/callback/google`
110
+
111
+ The port must match your backend server port, and the path is determined by BetterAuth.
112
+
113
+ ### "Access blocked: app has not completed verification"
114
+
115
+ Your OAuth consent screen is in "Testing" mode. Either:
116
+ - Add test users in the consent screen settings, or
117
+ - Submit your app for verification (required for production)
118
+
119
+ ### Users Not Being Linked
120
+
121
+ If a user signs up with email/password and later tries Google OAuth with the same email, BetterAuth will attempt to link the accounts. Make sure `account linking` is enabled in your BetterAuth configuration.
@@ -1,22 +1,22 @@
1
- {
2
- "name": "google-oauth",
3
- "displayName": "Google OAuth",
4
- "description": "Adds Google OAuth sign-in via BetterAuth social provider",
5
- "version": "1.0.0",
6
- "compatibility": ">=1.0.0",
7
- "requiredEnvVars": [
8
- { "key": "GOOGLE_CLIENT_ID", "description": "Google OAuth Client ID from Google Cloud Console" },
9
- { "key": "GOOGLE_CLIENT_SECRET", "description": "Google OAuth Client Secret" }
10
- ],
11
- "dependencies": {
12
- "backend": {},
13
- "frontend": {}
14
- },
15
- "modifies": {
16
- "backend": ["src/auth/index.ts", "src/env.ts"],
17
- "frontend": ["src/components/auth/LoginForm.tsx", "src/components/auth/SignupForm.tsx"]
18
- },
19
- "adds": {
20
- "frontend": ["src/components/auth/GoogleButton.tsx"]
21
- }
22
- }
1
+ {
2
+ "name": "google-oauth",
3
+ "displayName": "Google OAuth",
4
+ "description": "Adds Google OAuth sign-in via BetterAuth social provider",
5
+ "version": "1.0.0",
6
+ "compatibility": ">=1.0.0",
7
+ "requiredEnvVars": [
8
+ { "key": "GOOGLE_CLIENT_ID", "description": "Google OAuth Client ID from Google Cloud Console" },
9
+ { "key": "GOOGLE_CLIENT_SECRET", "description": "Google OAuth Client Secret" }
10
+ ],
11
+ "dependencies": {
12
+ "backend": {},
13
+ "frontend": {}
14
+ },
15
+ "modifies": {
16
+ "backend": ["src/auth/index.ts", "src/env.ts"],
17
+ "frontend": ["src/components/auth/LoginForm.tsx", "src/components/auth/SignupForm.tsx"]
18
+ },
19
+ "adds": {
20
+ "frontend": ["src/components/auth/GoogleButton.tsx"]
21
+ }
22
+ }
@@ -1,50 +1,50 @@
1
- import { authClient } from "@/lib/auth-client";
2
-
3
- /**
4
- * Google sign-in button component.
5
- *
6
- * Uses BetterAuth's social sign-in to redirect the user to Google's OAuth
7
- * consent screen. After authorization, Google redirects back to the app and
8
- * BetterAuth completes the session creation automatically.
9
- */
10
- export function GoogleButton() {
11
- const handleGoogleSignIn = async () => {
12
- await authClient.signIn.social({
13
- provider: "google",
14
- callbackURL: "/dashboard",
15
- });
16
- };
17
-
18
- return (
19
- <button
20
- type="button"
21
- onClick={handleGoogleSignIn}
22
- className="flex w-full items-center justify-center gap-3 rounded-lg border border-gray-300 bg-white px-4 py-2.5 text-sm font-medium text-gray-700 shadow-sm transition-colors hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-200 dark:hover:bg-gray-700"
23
- >
24
- {/* Google "G" logo */}
25
- <svg
26
- className="h-5 w-5"
27
- viewBox="0 0 24 24"
28
- xmlns="http://www.w3.org/2000/svg"
29
- >
30
- <path
31
- d="M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92a5.06 5.06 0 0 1-2.2 3.32v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.1z"
32
- fill="#4285F4"
33
- />
34
- <path
35
- d="M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"
36
- fill="#34A853"
37
- />
38
- <path
39
- d="M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z"
40
- fill="#FBBC05"
41
- />
42
- <path
43
- d="M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z"
44
- fill="#EA4335"
45
- />
46
- </svg>
47
- Continue with Google
48
- </button>
49
- );
50
- }
1
+ import { authClient } from "@/lib/auth-client";
2
+
3
+ /**
4
+ * Google sign-in button component.
5
+ *
6
+ * Uses BetterAuth's social sign-in to redirect the user to Google's OAuth
7
+ * consent screen. After authorization, Google redirects back to the app and
8
+ * BetterAuth completes the session creation automatically.
9
+ */
10
+ export function GoogleButton() {
11
+ const handleGoogleSignIn = async () => {
12
+ await authClient.signIn.social({
13
+ provider: "google",
14
+ callbackURL: "/dashboard",
15
+ });
16
+ };
17
+
18
+ return (
19
+ <button
20
+ type="button"
21
+ onClick={handleGoogleSignIn}
22
+ className="flex w-full items-center justify-center gap-3 rounded-lg border border-gray-300 bg-white px-4 py-2.5 text-sm font-medium text-gray-700 shadow-sm transition-colors hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-200 dark:hover:bg-gray-700"
23
+ >
24
+ {/* Google "G" logo */}
25
+ <svg
26
+ className="h-5 w-5"
27
+ viewBox="0 0 24 24"
28
+ xmlns="http://www.w3.org/2000/svg"
29
+ >
30
+ <path
31
+ d="M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92a5.06 5.06 0 0 1-2.2 3.32v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.1z"
32
+ fill="#4285F4"
33
+ />
34
+ <path
35
+ d="M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"
36
+ fill="#34A853"
37
+ />
38
+ <path
39
+ d="M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z"
40
+ fill="#FBBC05"
41
+ />
42
+ <path
43
+ d="M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z"
44
+ fill="#EA4335"
45
+ />
46
+ </svg>
47
+ Continue with Google
48
+ </button>
49
+ );
50
+ }