@rebasepro/cli 0.0.1-canary.f81da60 → 0.0.1-canary.fc811d7

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 (72) hide show
  1. package/LICENSE +17 -196
  2. package/README.md +57 -33
  3. package/dist/commands/api-keys.d.ts +1 -0
  4. package/dist/commands/build.d.ts +1 -0
  5. package/dist/commands/cloud/auth.d.ts +3 -0
  6. package/dist/commands/cloud/context.d.ts +61 -0
  7. package/dist/commands/cloud/databases.d.ts +1 -0
  8. package/dist/commands/cloud/deploy.d.ts +2 -0
  9. package/dist/commands/cloud/index.d.ts +1 -0
  10. package/dist/commands/cloud/link.d.ts +5 -0
  11. package/dist/commands/cloud/orgs.d.ts +1 -0
  12. package/dist/commands/cloud/projects.d.ts +13 -0
  13. package/dist/commands/cloud/resources.d.ts +6 -0
  14. package/dist/commands/generate_sdk.d.ts +1 -1
  15. package/dist/commands/init.d.ts +37 -1
  16. package/dist/commands/skills.d.ts +1 -0
  17. package/dist/commands/start.d.ts +1 -0
  18. package/dist/index.d.ts +6 -1
  19. package/dist/index.es.js +3781 -1089
  20. package/dist/index.es.js.map +1 -1
  21. package/dist/utils/package-manager.d.ts +33 -0
  22. package/dist/utils/project.d.ts +16 -1
  23. package/package.json +26 -22
  24. package/templates/overlays/baas/README.md +37 -0
  25. package/templates/overlays/baas/backend/package.json +31 -0
  26. package/templates/overlays/baas/backend/src/index.ts +172 -0
  27. package/templates/overlays/baas/backend/tsconfig.json +18 -0
  28. package/templates/overlays/baas/package.json +42 -0
  29. package/templates/overlays/baas/pnpm-workspace.yaml +9 -0
  30. package/templates/template/.cursorrules +2 -0
  31. package/templates/template/.env.example +25 -1
  32. package/templates/template/.github/copilot-instructions.md +2 -0
  33. package/templates/template/.windsurfrules +2 -0
  34. package/templates/template/AGENTS.md +2 -0
  35. package/templates/template/CLAUDE.md +2 -0
  36. package/templates/template/README.md +6 -6
  37. package/templates/template/ai-instructions.md +17 -0
  38. package/templates/template/backend/Dockerfile +5 -4
  39. package/templates/template/backend/functions/hello.ts +36 -32
  40. package/templates/template/backend/package.json +9 -9
  41. package/templates/template/backend/src/env.ts +13 -42
  42. package/templates/template/backend/src/index.ts +54 -28
  43. package/templates/template/config/collections/authors.ts +2 -2
  44. package/templates/template/config/collections/index.ts +25 -4
  45. package/templates/template/config/collections/posts.ts +12 -32
  46. package/templates/template/config/collections/presets/blank/index.ts +3 -0
  47. package/templates/template/config/collections/presets/ecommerce/categories.ts +40 -0
  48. package/templates/template/config/collections/presets/ecommerce/index.ts +6 -0
  49. package/templates/template/config/collections/presets/ecommerce/orders.ts +66 -0
  50. package/templates/template/config/collections/presets/ecommerce/products.ts +64 -0
  51. package/templates/template/config/collections/tags.ts +3 -5
  52. package/templates/template/config/collections/users.ts +142 -0
  53. package/templates/template/config/index.ts +1 -1
  54. package/templates/template/docker-compose.yml +4 -4
  55. package/templates/template/frontend/Dockerfile +5 -3
  56. package/templates/template/frontend/package.json +8 -7
  57. package/templates/template/frontend/src/App.tsx +22 -22
  58. package/templates/template/frontend/src/main.tsx +4 -0
  59. package/templates/template/frontend/src/virtual.d.ts +6 -0
  60. package/templates/template/frontend/tsconfig.json +3 -2
  61. package/templates/template/frontend/vite.config.ts +16 -3
  62. package/templates/template/package.json +18 -5
  63. package/templates/template/pnpm-workspace.yaml +9 -0
  64. package/templates/template/scripts/example.ts +5 -2
  65. package/dist/auth.d.ts +0 -5
  66. package/dist/commands/cli.test.d.ts +0 -1
  67. package/dist/commands/dev.test.d.ts +0 -1
  68. package/dist/commands/init.test.d.ts +0 -1
  69. package/dist/index.cjs +0 -1306
  70. package/dist/index.cjs.map +0 -1
  71. package/dist/utils/project.test.d.ts +0 -1
  72. package/templates/template/backend/drizzle.config.ts +0 -42
@@ -0,0 +1,142 @@
1
+ import type { CollectionConfig } from "@rebasepro/types";
2
+
3
+ const usersCollection: CollectionConfig = {
4
+ name: "Users",
5
+ singularName: "User",
6
+ slug: "users",
7
+ auth: { enabled: true },
8
+ table: "users",
9
+ schema: "rebase",
10
+ icon: "Users",
11
+ group: "Settings",
12
+ openEntityMode: "dialog",
13
+ disableDefaultActions: ["copy"],
14
+ securityRules: [
15
+ { operation: "select",
16
+ roles: ["admin"] },
17
+ { operations: ["insert", "update", "delete"],
18
+ roles: ["admin"] }
19
+ ],
20
+ sort: ["createdAt", "desc"],
21
+ properties: {
22
+ id: {
23
+ name: "ID",
24
+ type: "string",
25
+ isId: "uuid",
26
+ ui: {
27
+ readOnly: true
28
+ }
29
+ },
30
+ email: {
31
+ name: "Email",
32
+ type: "string",
33
+ validation: {
34
+ required: true,
35
+ unique: true
36
+ }
37
+ },
38
+ displayName: {
39
+ name: "Name",
40
+ type: "string",
41
+ columnName: "display_name"
42
+ },
43
+ photoURL: {
44
+ name: "Photo URL",
45
+ type: "string",
46
+ columnName: "photo_url",
47
+ ui: {
48
+ url: "image"
49
+ }
50
+ },
51
+ roles: {
52
+ name: "Roles",
53
+ type: "array",
54
+ columnType: "text[]",
55
+ of: {
56
+ name: "Role",
57
+ type: "string",
58
+ enum: {
59
+ admin: "Admin",
60
+ editor: "Editor",
61
+ viewer: "Viewer"
62
+ }
63
+ }
64
+ },
65
+ passwordHash: {
66
+ name: "Password Hash",
67
+ type: "string",
68
+ columnName: "password_hash",
69
+ ui: {
70
+ hideFromCollection: true,
71
+ disabled: { hidden: true }
72
+ }
73
+ },
74
+ emailVerified: {
75
+ name: "Email Verified",
76
+ type: "boolean",
77
+ columnName: "email_verified",
78
+ defaultValue: false,
79
+ ui: {
80
+ hideFromCollection: true,
81
+ disabled: { hidden: true }
82
+ }
83
+ },
84
+ emailVerificationToken: {
85
+ name: "Email Verification Token",
86
+ type: "string",
87
+ columnName: "email_verification_token",
88
+ ui: {
89
+ hideFromCollection: true,
90
+ disabled: { hidden: true }
91
+ }
92
+ },
93
+ emailVerificationSentAt: {
94
+ name: "Email Verification Sent At",
95
+ type: "date",
96
+ columnName: "email_verification_sent_at",
97
+ ui: {
98
+ hideFromCollection: true,
99
+ disabled: { hidden: true }
100
+ }
101
+ },
102
+ metadata: {
103
+ name: "Metadata",
104
+ type: "map",
105
+ keyValue: true,
106
+ properties: {},
107
+ defaultValue: {},
108
+ ui: {
109
+ hideFromCollection: true,
110
+ disabled: { hidden: true }
111
+ }
112
+ },
113
+ createdAt: {
114
+ name: "Created At",
115
+ type: "date",
116
+ columnName: "created_at",
117
+ autoValue: "on_create",
118
+ ui: {
119
+ readOnly: true
120
+ }
121
+ },
122
+ updatedAt: {
123
+ name: "Updated At",
124
+ type: "date",
125
+ columnName: "updated_at",
126
+ autoValue: "on_update",
127
+ ui: {
128
+ hideFromCollection: true,
129
+ disabled: { hidden: true }
130
+ }
131
+ }
132
+ },
133
+ propertiesOrder: [
134
+ "id",
135
+ "email",
136
+ "displayName",
137
+ "roles",
138
+ "createdAt"
139
+ ]
140
+ };
141
+
142
+ export default usersCollection;
@@ -3,4 +3,4 @@
3
3
  * Collections defined here are used by both the frontend and backend
4
4
  */
5
5
 
6
- export { collections } from "./collections";
6
+ export { collections } from "./collections/index.js";
@@ -9,7 +9,7 @@
9
9
  # 2. Backend (Node.js / Hono) with health checks
10
10
  # 3. Frontend (nginx) serving the Vite build
11
11
  #
12
- # For development, use `pnpm dev` instead.
12
+ # For development, use `rebase dev` instead.
13
13
  # ─────────────────────────────────────────────────────────────────────
14
14
 
15
15
  services:
@@ -24,7 +24,7 @@ services:
24
24
  ports:
25
25
  - "5432:5432"
26
26
  volumes:
27
- - postgres_data:/var/lib/postgresql/data
27
+ - postgres_data:/var/lib/postgresql
28
28
  healthcheck:
29
29
  test: ["CMD-SHELL", "pg_isready -U rebase -d rebase"]
30
30
  interval: 5s
@@ -56,8 +56,8 @@ services:
56
56
  env_file: .env
57
57
  environment:
58
58
  # Override DATABASE_URL to point to the Docker network service
59
- DATABASE_URL: postgresql://rebase:${DATABASE_PASSWORD:-changeme}@db:5432/rebase
60
- ADMIN_CONNECTION_STRING: postgresql://rebase:${DATABASE_PASSWORD:-changeme}@db:5432/rebase
59
+ DATABASE_URL: postgresql://rebase:${DATABASE_PASSWORD:-changeme}@db:5432/rebase?options=-c%20search_path=public
60
+ ADMIN_CONNECTION_STRING: postgresql://rebase:${DATABASE_PASSWORD:-changeme}@db:5432/rebase?options=-c%20search_path=public
61
61
  NODE_ENV: production
62
62
  PORT: "3001"
63
63
  depends_on:
@@ -17,14 +17,16 @@ RUN apk add --no-cache python3 make g++
17
17
  WORKDIR /app
18
18
 
19
19
  # Copy workspace root files
20
- COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./
20
+ COPY package.json pnpm-lock.yaml pnpm-workspace.yaml .npmrc ./
21
21
 
22
22
  # Copy workspace packages
23
23
  COPY frontend ./frontend
24
24
  COPY config ./config
25
25
 
26
- # Install dependencies
27
- RUN pnpm install --frozen-lockfile
26
+ # Install dependencies (skip scripts to avoid @ariga/atlas binary download,
27
+ # which is a backend-only dependency that may fail on certain platforms)
28
+ RUN pnpm install --frozen-lockfile --ignore-scripts
29
+ RUN pnpm rebuild esbuild
28
30
 
29
31
  # Build config first, then frontend
30
32
  RUN pnpm --filter "*-config" run build
@@ -4,21 +4,21 @@
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "dependencies": {
7
- "@rebasepro/auth": "workspace:*",
8
- "@rebasepro/core": "workspace:*",
9
- "@rebasepro/plugin-data-enhancement": "workspace:*",
7
+ "@rebasepro/app": "workspace:*",
8
+ "@rebasepro/plugin-ai": "workspace:*",
10
9
  "@rebasepro/client": "workspace:*",
11
10
  "@rebasepro/admin": "workspace:*",
12
11
  "@rebasepro/studio": "workspace:*",
13
12
  "@rebasepro/types": "workspace:*",
14
13
  "@rebasepro/ui": "workspace:*",
15
14
  "@fontsource/jetbrains-mono": "^5.2.5",
16
- "{{PROJECT_NAME}}-config": "workspace:*",
15
+ "{{PROJECT_NAME}}-config": "*",
17
16
  "react": "^19.0.0",
18
17
  "react-dom": "^19.0.0",
19
18
  "react-router": "^7.0.0",
20
19
  "react-router-dom": "^7.0.0",
21
- "typeface-rubik": "^1.1.13"
20
+ "react-compiler-runtime": "^1.0.0",
21
+ "@fontsource/rubik": "^5.2.5"
22
22
  },
23
23
  "scripts": {
24
24
  "dev": "vite --mode development",
@@ -40,12 +40,13 @@
40
40
  "devDependencies": {
41
41
  "@tailwindcss/typography": "^0.5.16",
42
42
  "@tailwindcss/vite": "^4.1.12",
43
+ "@types/node": "^20.19.41",
43
44
  "@types/react": "^19.0.8",
44
45
  "@types/react-dom": "^19.0.3",
45
- "@vitejs/plugin-react": "^4.3.4",
46
+ "@vitejs/plugin-react": "^4.4.1",
46
47
  "tailwindcss": "^4.1.3",
47
48
  "typescript": "^5.9.2",
48
- "vite": "^5.4.17",
49
+ "vite": "^6.4.3",
49
50
  "vite-plugin-svgr": "^4.3.0"
50
51
  }
51
52
  }
@@ -1,11 +1,12 @@
1
1
  import React from "react";
2
2
 
3
3
  import "@fontsource/jetbrains-mono";
4
- import "typeface-rubik";
4
+ import "@fontsource/rubik";
5
5
 
6
- import { useRebaseAuthController, useBackendUserManagement, RebaseAuth } from "@rebasepro/auth";
7
- import { Rebase } from "@rebasepro/core";
8
- import { RebaseCMS, RebaseShell } from "@rebasepro/admin";
6
+ import { useRebaseAuthController } from "@rebasepro/app";
7
+ import { Rebase, RebaseAuth } from "@rebasepro/app";
8
+ import { RebaseAdmin, RebaseShell } from "@rebasepro/admin";
9
+ import { ErrorBoundary } from "@rebasepro/ui";
9
10
  import { RebaseStudio } from "@rebasepro/studio";
10
11
  import { createRebaseClient } from "@rebasepro/client";
11
12
  import { collections } from "virtual:rebase-collections";
@@ -16,7 +17,10 @@ const GOOGLE_CLIENT_ID = import.meta.env.VITE_GOOGLE_CLIENT_ID;
16
17
 
17
18
  export function App() {
18
19
  const rebaseClient = React.useMemo(() => createRebaseClient({
19
- baseUrl: API_URL
20
+ baseUrl: API_URL,
21
+ // Store the refresh token in an httpOnly cookie (XSS-safe) rather than
22
+ // localStorage. The backend issues it via `auth.cookieAuth`.
23
+ auth: { authFlowMode: "cookie" }
20
24
  }), []);
21
25
 
22
26
  const authController = useRebaseAuthController({
@@ -24,23 +28,19 @@ export function App() {
24
28
  googleClientId: GOOGLE_CLIENT_ID
25
29
  });
26
30
 
27
- const userManagement = useBackendUserManagement({
28
- client: rebaseClient,
29
- currentUser: authController.user
30
- });
31
-
32
31
  return (
33
- <Rebase
34
- client={rebaseClient}
35
- authController={authController}
36
- userManagement={userManagement}
37
- >
38
- <RebaseAuth />
39
- <RebaseCMS
40
- collections={collections}
41
- />
42
- <RebaseStudio/>
43
- <RebaseShell title="Rebase"/>
44
- </Rebase>
32
+ <ErrorBoundary fullPage>
33
+ <Rebase
34
+ client={rebaseClient}
35
+ authController={authController}
36
+ >
37
+ <RebaseAuth />
38
+ <RebaseAdmin
39
+ collections={collections}
40
+ />
41
+ <RebaseStudio/>
42
+ <RebaseShell title="Rebase"/>
43
+ </Rebase>
44
+ </ErrorBoundary>
45
45
  );
46
46
  }
@@ -4,6 +4,10 @@ import { createBrowserRouter, RouterProvider } from "react-router-dom";
4
4
  import { App } from "./App";
5
5
  import "./index.css";
6
6
 
7
+ window.addEventListener("unhandledrejection", (event: PromiseRejectionEvent) => {
8
+ console.error("[Rebase] Unhandled promise rejection:", event.reason);
9
+ });
10
+
7
11
  const router = createBrowserRouter([
8
12
  {
9
13
  path: "/*",
@@ -0,0 +1,6 @@
1
+ /// <reference types="vite/client" />
2
+ /// <reference types="vite-plugin-svgr/client" />
3
+
4
+ declare module "virtual:rebase-collections" {
5
+ export const collections: any[];
6
+ }
@@ -14,7 +14,8 @@
14
14
  "resolveJsonModule": true,
15
15
  "isolatedModules": true,
16
16
  "noEmit": true,
17
- "jsx": "react-jsx"
17
+ "jsx": "react-jsx",
18
+ "types": ["vite/client", "node"]
18
19
  },
19
- "include": ["./src", "./vite.config.ts"]
20
+ "include": ["src/**/*", "vite.config.ts"]
20
21
  }
@@ -1,13 +1,26 @@
1
- // @ts-ignore
2
1
  import path from "path";
3
2
  import { defineConfig } from "vite";
4
3
  import react from "@vitejs/plugin-react";
5
4
  import svgr from "vite-plugin-svgr";
6
5
  import tailwindcss from "@tailwindcss/vite";
7
- import { rebaseCollectionsPlugin } from "@rebasepro/core/vitePlugin";
6
+ import { rebaseCollectionsPlugin } from "@rebasepro/app/vitePlugin";
8
7
 
9
8
  export default defineConfig({
10
9
  envDir: path.resolve(__dirname, ".."),
10
+ // Force a single copy of React and React Router across the app and all
11
+ // @rebasepro/* packages. Without this, a locally `link:`ed Rebase checkout
12
+ // resolves its own copies of react-router, producing "multiple copies of
13
+ // React" and "useBlocker must be used within a data router" errors in the
14
+ // admin. Safe to keep for npm-installed setups too.
15
+ resolve: {
16
+ dedupe: [
17
+ "react",
18
+ "react-dom",
19
+ "react-router",
20
+ "react-router-dom",
21
+ "@remix-run/router"
22
+ ]
23
+ },
11
24
  esbuild: {
12
25
  logOverride: { "this-is-undefined-in-esm": "silent" }
13
26
  },
@@ -20,7 +33,7 @@ export default defineConfig({
20
33
  output: {
21
34
  manualChunks(id) {
22
35
  // Heavy vendor libraries — split into individually cached chunks
23
- if (id.includes("xlsx")) return "vendor-xlsx";
36
+ if (id.includes("exceljs")) return "vendor-exceljs";
24
37
  if (id.includes("prosemirror")) return "vendor-prosemirror";
25
38
  if (id.includes("monaco-editor") || id.includes("@monaco-editor")) return "vendor-monaco";
26
39
  if (id.includes("@xyflow") || id.includes("dagre")) return "vendor-xyflow";
@@ -4,25 +4,38 @@
4
4
  "description": "Rebase application with PostgreSQL backend",
5
5
  "private": true,
6
6
  "type": "module",
7
+ "workspaces": [
8
+ "frontend",
9
+ "backend",
10
+ "config"
11
+ ],
7
12
  "scripts": {
8
13
  "dev": "rebase dev",
9
- "build": "pnpm -r run build",
10
- "start": "pnpm --filter \"*-backend\" start",
14
+ "build": "rebase build",
15
+ "start": "rebase start",
11
16
  "db:generate": "rebase db generate --collections ../config/collections",
12
17
  "db:migrate": "rebase db migrate",
13
- "db:pull": "rebase db pull",
18
+ "schema:introspect": "rebase schema introspect",
14
19
  "db:push": "rebase db push --collections ../config/collections",
15
- "db:studio": "rebase db studio",
16
20
  "schema:generate": "rebase schema generate --collections ../config/collections",
17
21
  "generate:sdk": "rebase generate-sdk",
18
- "deploy": "pnpm run build && pnpm run start"
22
+ "skills:install": "rebase skills install",
23
+ "deploy": "rebase build && rebase start"
19
24
  },
20
25
  "devDependencies": {
21
26
  "@rebasepro/cli": "workspace:*",
27
+ "@rebasepro/types": "workspace:*",
22
28
  "concurrently": "^8.2.2",
23
29
  "typescript": "^5.9.2"
24
30
  },
25
31
  "engines": {
26
32
  "node": ">=18.0.0"
33
+ },
34
+ "pnpm": {
35
+ "onlyBuiltDependencies": [
36
+ "esbuild",
37
+ "sharp",
38
+ "@ariga/atlas"
39
+ ]
27
40
  }
28
41
  }
@@ -2,3 +2,12 @@ packages:
2
2
  - "frontend"
3
3
  - "backend"
4
4
  - "config"
5
+ linkWorkspacePackages: true
6
+ blockExoticSubdeps: false
7
+ minimumReleaseAge: 0
8
+ allowBuilds:
9
+ esbuild: true
10
+ sharp: true
11
+ "@ariga/atlas": true
12
+ "{{PROJECT_NAME}}-config": true
13
+
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * Scripts run OUTSIDE the server and need explicit authentication.
5
5
  * Use a Service Key (set in .env as REBASE_SERVICE_KEY) to get admin
6
- * access — similar to a Firebase Service Account credential.
6
+ * access — similar to a Service Account credential.
7
7
  *
8
8
  * Usage:
9
9
  * # With local dev server running (`pnpm dev` in another terminal):
@@ -75,7 +75,10 @@ async function run() {
75
75
 
76
76
  try {
77
77
  // Example: Check backend health
78
- const health = await fetch(`${baseUrl}/api/health`).then(res => res.json());
78
+ const res = await fetch(`${baseUrl}/health`);
79
+ const health = res.headers.get("content-type")?.includes("application/json")
80
+ ? await res.json()
81
+ : { status: res.status, text: await res.text() };
79
82
  console.log("✅ Backend health:", health);
80
83
 
81
84
  // Example: Fetch some data (requires auth if backend is secure-by-default)
package/dist/auth.d.ts DELETED
@@ -1,5 +0,0 @@
1
- export declare function getTokens(env: "prod" | "dev", _debug?: boolean): Promise<object | null>;
2
- export declare function parseJwt(token: string): object;
3
- export declare function refreshCredentials(env: "dev" | "prod", credentials?: object | null, _onErr?: (e: unknown) => void): Promise<object | null>;
4
- export declare function login(env: "prod" | "dev", _debug?: boolean): Promise<void>;
5
- export declare function logout(env: "prod" | "dev", _debug?: boolean): Promise<void>;
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};