@rebasepro/cli 0.0.1-canary.0 → 0.0.1-canary.000dc36
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.
- package/dist/commands/auth.d.ts +1 -0
- package/dist/commands/cli.test.d.ts +1 -0
- package/dist/commands/db.d.ts +1 -0
- package/dist/commands/dev.d.ts +1 -0
- package/dist/commands/dev.test.d.ts +1 -0
- package/dist/commands/doctor.d.ts +1 -0
- package/dist/commands/generate_sdk.d.ts +18 -0
- package/dist/commands/init.d.ts +4 -0
- package/dist/commands/init.test.d.ts +1 -0
- package/dist/commands/schema.d.ts +1 -0
- package/dist/index.cjs +1064 -35
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +5 -0
- package/dist/index.es.js +1066 -34
- package/dist/index.es.js.map +1 -1
- package/dist/utils/project.d.ts +45 -0
- package/dist/utils/project.test.d.ts +1 -0
- package/package.json +19 -11
- package/templates/template/.dockerignore +28 -0
- package/templates/template/.env.example +96 -0
- package/templates/template/README.md +84 -17
- package/templates/template/backend/Dockerfile +55 -10
- package/templates/template/backend/drizzle.config.ts +24 -4
- package/templates/template/backend/functions/hello.ts +52 -0
- package/templates/template/backend/package.json +30 -34
- package/templates/template/backend/src/env.ts +52 -0
- package/templates/template/backend/src/index.ts +113 -99
- package/templates/template/backend/tsconfig.json +1 -1
- package/templates/template/config/collections/authors.ts +45 -0
- package/templates/template/config/collections/index.ts +5 -0
- package/templates/template/config/collections/posts.ts +91 -0
- package/templates/template/config/collections/tags.ts +27 -0
- package/templates/template/config/package.json +28 -0
- package/templates/template/docker-compose.yml +50 -14
- package/templates/template/frontend/Dockerfile +36 -14
- package/templates/template/frontend/nginx.conf +40 -0
- package/templates/template/frontend/package.json +9 -10
- package/templates/template/frontend/src/App.tsx +24 -110
- package/templates/template/frontend/src/index.css +15 -1
- package/templates/template/frontend/src/main.tsx +2 -2
- package/templates/template/frontend/vite.config.ts +33 -3
- package/templates/template/package.json +12 -16
- package/templates/template/pnpm-workspace.yaml +4 -0
- package/templates/template/scripts/example.ts +91 -0
- package/templates/template/.env.template +0 -31
- package/templates/template/backend/scripts/db-generate.ts +0 -60
- package/templates/template/shared/collections/index.ts +0 -3
- package/templates/template/shared/collections/posts.ts +0 -53
- package/templates/template/shared/package.json +0 -28
- /package/templates/template/{shared → config}/index.ts +0 -0
- /package/templates/template/{shared → config}/tsconfig.json +0 -0
|
@@ -4,17 +4,16 @@
|
|
|
4
4
|
"private": true,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@rebasepro/auth": "
|
|
8
|
-
"@rebasepro/core": "
|
|
9
|
-
"@rebasepro/
|
|
10
|
-
"@rebasepro/
|
|
11
|
-
"@rebasepro/
|
|
12
|
-
"@rebasepro/
|
|
13
|
-
"@rebasepro/
|
|
14
|
-
"@rebasepro/
|
|
15
|
-
"@rebasepro/ui": "^4.0.0",
|
|
7
|
+
"@rebasepro/auth": "workspace:*",
|
|
8
|
+
"@rebasepro/core": "workspace:*",
|
|
9
|
+
"@rebasepro/plugin-data-enhancement": "workspace:*",
|
|
10
|
+
"@rebasepro/client": "workspace:*",
|
|
11
|
+
"@rebasepro/admin": "workspace:*",
|
|
12
|
+
"@rebasepro/studio": "workspace:*",
|
|
13
|
+
"@rebasepro/types": "workspace:*",
|
|
14
|
+
"@rebasepro/ui": "workspace:*",
|
|
16
15
|
"@fontsource/jetbrains-mono": "^5.2.5",
|
|
17
|
-
"{{PROJECT_NAME}}-
|
|
16
|
+
"{{PROJECT_NAME}}-config": "workspace:*",
|
|
18
17
|
"react": "^19.0.0",
|
|
19
18
|
"react-dom": "^19.0.0",
|
|
20
19
|
"react-router": "^7.0.0",
|
|
@@ -1,132 +1,46 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from "react";
|
|
2
2
|
|
|
3
3
|
import "@fontsource/jetbrains-mono";
|
|
4
4
|
import "typeface-rubik";
|
|
5
5
|
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
} from "@rebasepro/
|
|
11
|
-
import {
|
|
12
|
-
AppBar,
|
|
13
|
-
CircularProgressCenter,
|
|
14
|
-
Drawer,
|
|
15
|
-
Rebase,
|
|
16
|
-
RebaseRoute,
|
|
17
|
-
ModeControllerProvider,
|
|
18
|
-
NotFoundPage,
|
|
19
|
-
Scaffold,
|
|
20
|
-
SideDialogs,
|
|
21
|
-
RebaseRoutes,
|
|
22
|
-
SnackbarProvider,
|
|
23
|
-
ContentHomePage,
|
|
24
|
-
useBackendStorageSource,
|
|
25
|
-
useBuildCMSUrlController,
|
|
26
|
-
useBuildCollectionRegistryController,
|
|
27
|
-
useBuildLocalConfigurationPersistence,
|
|
28
|
-
useBuildModeController,
|
|
29
|
-
useBuildNavigationStateController
|
|
30
|
-
} from "@rebasepro/core";
|
|
31
|
-
import { usePostgresClientDataSource } from "@rebasepro/postgresql";
|
|
6
|
+
import { useRebaseAuthController, useBackendUserManagement, RebaseAuth } from "@rebasepro/auth";
|
|
7
|
+
import { Rebase } from "@rebasepro/core";
|
|
8
|
+
import { RebaseCMS, RebaseShell } from "@rebasepro/admin";
|
|
9
|
+
import { RebaseStudio } from "@rebasepro/studio";
|
|
10
|
+
import { createRebaseClient } from "@rebasepro/client";
|
|
32
11
|
import { collections } from "virtual:rebase-collections";
|
|
33
|
-
import { Route, Outlet } from "react-router-dom";
|
|
34
12
|
|
|
35
13
|
// Configuration from environment
|
|
36
|
-
const API_URL = import.meta.env.VITE_API_URL || "http://localhost:3001";
|
|
14
|
+
const API_URL = import.meta.env.VITE_API_URL || (import.meta.env.DEV ? "http://localhost:3001" : undefined);
|
|
37
15
|
const GOOGLE_CLIENT_ID = import.meta.env.VITE_GOOGLE_CLIENT_ID;
|
|
38
16
|
|
|
39
17
|
export function App() {
|
|
40
|
-
const
|
|
41
|
-
|
|
18
|
+
const rebaseClient = React.useMemo(() => createRebaseClient({
|
|
19
|
+
baseUrl: API_URL
|
|
20
|
+
}), []);
|
|
42
21
|
|
|
43
22
|
const authController = useRebaseAuthController({
|
|
44
|
-
|
|
23
|
+
client: rebaseClient,
|
|
45
24
|
googleClientId: GOOGLE_CLIENT_ID
|
|
46
25
|
});
|
|
47
26
|
|
|
48
|
-
const storageSource = useBackendStorageSource({
|
|
49
|
-
apiUrl: API_URL,
|
|
50
|
-
getAuthToken: authController.getAuthToken
|
|
51
|
-
});
|
|
52
|
-
|
|
53
27
|
const userManagement = useBackendUserManagement({
|
|
54
|
-
|
|
55
|
-
getAuthToken: authController.getAuthToken,
|
|
28
|
+
client: rebaseClient,
|
|
56
29
|
currentUser: authController.user
|
|
57
30
|
});
|
|
58
31
|
|
|
59
|
-
const postgresDelegate = usePostgresClientDataSource({
|
|
60
|
-
websocketUrl: API_URL.replace(/^http/, "ws"),
|
|
61
|
-
getAuthToken: authController.initialLoading ? undefined : authController.getAuthToken
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
const collectionsBuilder = useCallback(() => {
|
|
65
|
-
return [...collections];
|
|
66
|
-
}, []);
|
|
67
|
-
|
|
68
|
-
const collectionRegistryController = useBuildCollectionRegistryController({ userConfigPersistence });
|
|
69
|
-
const cmsUrlController = useBuildCMSUrlController({
|
|
70
|
-
basePath: "/",
|
|
71
|
-
baseCollectionPath: "/c",
|
|
72
|
-
collectionRegistryController
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
const navigationStateController = useBuildNavigationStateController({
|
|
76
|
-
collections: collectionsBuilder,
|
|
77
|
-
authController,
|
|
78
|
-
dataSource: postgresDelegate,
|
|
79
|
-
collectionRegistryController,
|
|
80
|
-
cmsUrlController,
|
|
81
|
-
userManagement
|
|
82
|
-
});
|
|
83
|
-
|
|
84
32
|
return (
|
|
85
|
-
<
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
if (loading || authController.initialLoading) {
|
|
98
|
-
return <CircularProgressCenter />;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
if (!authController.user) {
|
|
102
|
-
return (
|
|
103
|
-
<RebaseLoginView
|
|
104
|
-
authController={authController}
|
|
105
|
-
googleEnabled={!!GOOGLE_CLIENT_ID}
|
|
106
|
-
googleClientId={GOOGLE_CLIENT_ID}
|
|
107
|
-
/>
|
|
108
|
-
);
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
return (
|
|
112
|
-
<RebaseRoutes>
|
|
113
|
-
<Route element={
|
|
114
|
-
<Scaffold autoOpenDrawer={false}>
|
|
115
|
-
<AppBar />
|
|
116
|
-
<Drawer />
|
|
117
|
-
<Outlet />
|
|
118
|
-
<SideDialogs />
|
|
119
|
-
</Scaffold>
|
|
120
|
-
}>
|
|
121
|
-
<Route path={"/"} element={<ContentHomePage />} />
|
|
122
|
-
<Route path={"/c/*"} element={<RebaseRoute />} />
|
|
123
|
-
<Route path={"*"} element={<NotFoundPage />} />
|
|
124
|
-
</Route>
|
|
125
|
-
</RebaseRoutes>
|
|
126
|
-
);
|
|
127
|
-
}}
|
|
128
|
-
</Rebase>
|
|
129
|
-
</ModeControllerProvider>
|
|
130
|
-
</SnackbarProvider>
|
|
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>
|
|
131
45
|
);
|
|
132
46
|
}
|
|
@@ -1,2 +1,16 @@
|
|
|
1
1
|
@import "tailwindcss";
|
|
2
|
-
@import "@rebasepro/ui/index.css";
|
|
2
|
+
@import "@rebasepro/ui/index.css" layer(base);
|
|
3
|
+
|
|
4
|
+
@source "../node_modules/@rebasepro";
|
|
5
|
+
|
|
6
|
+
@custom-variant dark (&:where(.dark, .dark *));
|
|
7
|
+
|
|
8
|
+
@layer utilities {
|
|
9
|
+
body {
|
|
10
|
+
@apply w-full min-h-screen bg-surface-50 dark:bg-surface-900 flex flex-col items-center justify-center;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
a {
|
|
14
|
+
@apply text-primary dark:text-primary;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -7,12 +7,12 @@ import "./index.css";
|
|
|
7
7
|
const router = createBrowserRouter([
|
|
8
8
|
{
|
|
9
9
|
path: "/*",
|
|
10
|
-
element: <App
|
|
10
|
+
element: <App/>
|
|
11
11
|
}
|
|
12
12
|
]);
|
|
13
13
|
|
|
14
14
|
ReactDOM.createRoot(document.getElementById("root") as HTMLElement).render(
|
|
15
15
|
<React.StrictMode>
|
|
16
|
-
<RouterProvider router={router}
|
|
16
|
+
<RouterProvider router={router}/>
|
|
17
17
|
</React.StrictMode>
|
|
18
18
|
);
|
|
@@ -7,20 +7,50 @@ import tailwindcss from "@tailwindcss/vite";
|
|
|
7
7
|
import { rebaseCollectionsPlugin } from "@rebasepro/core/vitePlugin";
|
|
8
8
|
|
|
9
9
|
export default defineConfig({
|
|
10
|
+
envDir: path.resolve(__dirname, ".."),
|
|
10
11
|
esbuild: {
|
|
11
12
|
logOverride: { "this-is-undefined-in-esm": "silent" }
|
|
12
13
|
},
|
|
13
14
|
build: {
|
|
14
15
|
minify: true,
|
|
15
|
-
outDir: "./
|
|
16
|
+
outDir: "./dist",
|
|
16
17
|
target: "ESNEXT",
|
|
17
|
-
sourcemap: true
|
|
18
|
+
sourcemap: true,
|
|
19
|
+
rollupOptions: {
|
|
20
|
+
output: {
|
|
21
|
+
manualChunks(id) {
|
|
22
|
+
// Heavy vendor libraries — split into individually cached chunks
|
|
23
|
+
if (id.includes("xlsx")) return "vendor-xlsx";
|
|
24
|
+
if (id.includes("prosemirror")) return "vendor-prosemirror";
|
|
25
|
+
if (id.includes("monaco-editor") || id.includes("@monaco-editor")) return "vendor-monaco";
|
|
26
|
+
if (id.includes("@xyflow") || id.includes("dagre")) return "vendor-xyflow";
|
|
27
|
+
if (id.includes("@dnd-kit")) return "vendor-dnd";
|
|
28
|
+
if (id.includes("prism-react-renderer")) return "vendor-prism";
|
|
29
|
+
if (id.includes("markdown-it")) return "vendor-markdown";
|
|
30
|
+
if (id.includes("react-dropzone")) return "vendor-dropzone";
|
|
31
|
+
if (id.includes("date-fns")) return "vendor-datefns";
|
|
32
|
+
if (id.includes("fuse.js")) return "vendor-fuse";
|
|
33
|
+
if (id.includes("node_modules/react-dom/")) return "vendor-react-dom";
|
|
34
|
+
if (id.includes("node_modules/react-router") || id.includes("node_modules/@remix-run")) return "vendor-react-router";
|
|
35
|
+
if (id.includes("node_modules/@radix-ui/")) return "vendor-radix";
|
|
36
|
+
if (id.includes("node_modules/framer-motion/")) return "vendor-framer-motion";
|
|
37
|
+
if (id.includes("node_modules/zod/")) return "vendor-zod";
|
|
38
|
+
if (id.includes("node_modules/i18next") || id.includes("node_modules/react-i18next")) return "vendor-i18next";
|
|
39
|
+
if (id.includes("node_modules/@floating-ui/")) return "vendor-floating-ui";
|
|
40
|
+
if (id.includes("node_modules/tailwind-merge/")) return "vendor-tailwind-merge";
|
|
41
|
+
if (id.includes("node_modules/notistack/")) return "vendor-notistack";
|
|
42
|
+
if (id.includes("node_modules/lucide-react/")) return "vendor-lucide-react";
|
|
43
|
+
|
|
44
|
+
return undefined;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
18
48
|
},
|
|
19
49
|
optimizeDeps: { include: ["react/jsx-runtime"] },
|
|
20
50
|
plugins: [
|
|
21
51
|
svgr(),
|
|
22
52
|
react({}),
|
|
23
53
|
tailwindcss(),
|
|
24
|
-
rebaseCollectionsPlugin({ collectionsDir: "../
|
|
54
|
+
rebaseCollectionsPlugin({ collectionsDir: "../config/collections" })
|
|
25
55
|
]
|
|
26
56
|
});
|
|
@@ -4,25 +4,21 @@
|
|
|
4
4
|
"description": "Rebase application with PostgreSQL backend",
|
|
5
5
|
"private": true,
|
|
6
6
|
"type": "module",
|
|
7
|
-
"workspaces": [
|
|
8
|
-
"frontend",
|
|
9
|
-
"backend",
|
|
10
|
-
"shared"
|
|
11
|
-
],
|
|
12
7
|
"scripts": {
|
|
13
|
-
"dev": "
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"
|
|
8
|
+
"dev": "rebase dev",
|
|
9
|
+
"build": "pnpm -r run build",
|
|
10
|
+
"start": "pnpm --filter \"*-backend\" start",
|
|
11
|
+
"db:generate": "rebase db generate --collections ../config/collections",
|
|
12
|
+
"db:migrate": "rebase db migrate",
|
|
13
|
+
"db:pull": "rebase db pull",
|
|
14
|
+
"db:push": "rebase db push --collections ../config/collections",
|
|
15
|
+
"db:studio": "rebase db studio",
|
|
16
|
+
"schema:generate": "rebase schema generate --collections ../config/collections",
|
|
17
|
+
"generate:sdk": "rebase generate-sdk",
|
|
18
|
+
"deploy": "pnpm run build && pnpm run start"
|
|
24
19
|
},
|
|
25
20
|
"devDependencies": {
|
|
21
|
+
"@rebasepro/cli": "workspace:*",
|
|
26
22
|
"concurrently": "^8.2.2",
|
|
27
23
|
"typescript": "^5.9.2"
|
|
28
24
|
},
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Example Rebase Script
|
|
3
|
+
*
|
|
4
|
+
* Scripts run OUTSIDE the server and need explicit authentication.
|
|
5
|
+
* Use a Service Key (set in .env as REBASE_SERVICE_KEY) to get admin
|
|
6
|
+
* access — similar to a Firebase Service Account credential.
|
|
7
|
+
*
|
|
8
|
+
* Usage:
|
|
9
|
+
* # With local dev server running (`pnpm dev` in another terminal):
|
|
10
|
+
* npx tsx scripts/example.ts
|
|
11
|
+
*
|
|
12
|
+
* # With remote backend:
|
|
13
|
+
* REBASE_URL=https://api.yourdomain.com npx tsx scripts/example.ts
|
|
14
|
+
*
|
|
15
|
+
* # Service key can also be passed as env var:
|
|
16
|
+
* REBASE_SERVICE_KEY=<key> REBASE_URL=https://api.yourdomain.com npx tsx scripts/example.ts
|
|
17
|
+
*
|
|
18
|
+
* Generate a service key:
|
|
19
|
+
* node -e "console.log(require('crypto').randomBytes(48).toString('base64'))"
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
import fs from "node:fs";
|
|
23
|
+
import path from "node:path";
|
|
24
|
+
import * as dotenv from "dotenv";
|
|
25
|
+
import { createRebaseClient } from "@rebasepro/client";
|
|
26
|
+
// import type { Database } from "../config/database.types"; // Optional: For fully typed collections
|
|
27
|
+
|
|
28
|
+
// Load .env from project root (same file the backend uses)
|
|
29
|
+
dotenv.config({ path: path.resolve(process.cwd(), ".env") });
|
|
30
|
+
|
|
31
|
+
// ─── Resolve Backend URL ─────────────────────────────────────────────
|
|
32
|
+
let baseUrl = process.env.REBASE_URL;
|
|
33
|
+
|
|
34
|
+
if (!baseUrl) {
|
|
35
|
+
try {
|
|
36
|
+
// Try to read the URL from the local dev server
|
|
37
|
+
const urlFile = path.join(process.cwd(), ".rebase-dev-url");
|
|
38
|
+
if (fs.existsSync(urlFile)) {
|
|
39
|
+
baseUrl = fs.readFileSync(urlFile, "utf-8").trim();
|
|
40
|
+
console.log(`Found local dev server running at: ${baseUrl}`);
|
|
41
|
+
}
|
|
42
|
+
} catch (e) {
|
|
43
|
+
// Ignore errors reading the file
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
if (!baseUrl) {
|
|
48
|
+
console.error("❌ No backend URL found!");
|
|
49
|
+
console.error("");
|
|
50
|
+
console.error("Please make sure you have either:");
|
|
51
|
+
console.error("1. Started the local dev server in another terminal (`pnpm dev`)");
|
|
52
|
+
console.error("2. Set the REBASE_URL environment variable (e.g. `REBASE_URL=https://api.yourdomain.com npx tsx scripts/example.ts`)");
|
|
53
|
+
process.exit(1);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// ─── Resolve Service Key ─────────────────────────────────────────────
|
|
57
|
+
const serviceKey = process.env.REBASE_SERVICE_KEY;
|
|
58
|
+
|
|
59
|
+
if (!serviceKey) {
|
|
60
|
+
console.warn("⚠️ No REBASE_SERVICE_KEY found — requests will be unauthenticated.");
|
|
61
|
+
console.warn(" Set REBASE_SERVICE_KEY in your .env to get admin access.");
|
|
62
|
+
console.warn(" Generate one with: node -e \"console.log(require('crypto').randomBytes(48).toString('base64'))\"");
|
|
63
|
+
console.warn("");
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// ─── Initialize the SDK client ───────────────────────────────────────
|
|
67
|
+
const rebase = createRebaseClient({
|
|
68
|
+
baseUrl,
|
|
69
|
+
// The service key is sent as a Bearer token for admin access
|
|
70
|
+
token: serviceKey
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
async function run() {
|
|
74
|
+
console.log("🚀 Starting script...");
|
|
75
|
+
|
|
76
|
+
try {
|
|
77
|
+
// Example: Check backend health
|
|
78
|
+
const health = await fetch(`${baseUrl}/api/health`).then(res => res.json());
|
|
79
|
+
console.log("✅ Backend health:", health);
|
|
80
|
+
|
|
81
|
+
// Example: Fetch some data (requires auth if backend is secure-by-default)
|
|
82
|
+
// const items = await rebase.data.collection("users").find({ limit: 5 });
|
|
83
|
+
// console.log("Items:", items);
|
|
84
|
+
|
|
85
|
+
console.log("✨ Script finished successfully.");
|
|
86
|
+
} catch (error) {
|
|
87
|
+
console.error("❌ Script failed:", error);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
run();
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
# Database Configuration
|
|
2
|
-
DATABASE_URL=postgresql://postgres:password@localhost:5432/rebase
|
|
3
|
-
|
|
4
|
-
# Server Configuration
|
|
5
|
-
PORT=3001
|
|
6
|
-
NODE_ENV=development
|
|
7
|
-
|
|
8
|
-
# JWT Authentication
|
|
9
|
-
JWT_SECRET=change-this-to-a-secure-random-string
|
|
10
|
-
JWT_ACCESS_EXPIRES_IN=1h
|
|
11
|
-
JWT_REFRESH_EXPIRES_IN=30d
|
|
12
|
-
|
|
13
|
-
# Allow new user registration
|
|
14
|
-
ALLOW_REGISTRATION=true
|
|
15
|
-
|
|
16
|
-
# Frontend API URL
|
|
17
|
-
VITE_API_URL=http://localhost:3001
|
|
18
|
-
|
|
19
|
-
# Google OAuth (optional — uncomment to enable)
|
|
20
|
-
# GOOGLE_CLIENT_ID=your-google-client-id
|
|
21
|
-
# VITE_GOOGLE_CLIENT_ID=your-google-client-id
|
|
22
|
-
|
|
23
|
-
# Email (optional — uncomment to enable password reset emails)
|
|
24
|
-
# SMTP_HOST=smtp.example.com
|
|
25
|
-
# SMTP_PORT=587
|
|
26
|
-
# SMTP_SECURE=false
|
|
27
|
-
# SMTP_USER=your-smtp-username
|
|
28
|
-
# SMTP_PASS=your-smtp-password
|
|
29
|
-
# SMTP_FROM=noreply@yourapp.com
|
|
30
|
-
# APP_NAME=My Rebase App
|
|
31
|
-
# FRONTEND_URL=http://localhost:5173
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { spawn } from "child_process";
|
|
3
|
-
|
|
4
|
-
// --- Helper Functions ---
|
|
5
|
-
const formatTerminalText = (text: string, options: {
|
|
6
|
-
bold?: boolean;
|
|
7
|
-
backgroundColor?: "blue" | "green" | "red" | "yellow" | "cyan" | "magenta";
|
|
8
|
-
textColor?: "white" | "black" | "red" | "green" | "yellow" | "blue" | "magenta" | "cyan";
|
|
9
|
-
} = {}): string => {
|
|
10
|
-
let codes = "";
|
|
11
|
-
if (options.bold) codes += "\x1b[1m";
|
|
12
|
-
if (options.backgroundColor) {
|
|
13
|
-
const bgColors = {
|
|
14
|
-
blue: "\x1b[44m",
|
|
15
|
-
green: "\x1b[42m",
|
|
16
|
-
red: "\x1b[41m",
|
|
17
|
-
yellow: "\x1b[43m",
|
|
18
|
-
cyan: "\x1b[46m",
|
|
19
|
-
magenta: "\x1b[45m"
|
|
20
|
-
} as const;
|
|
21
|
-
codes += bgColors[options.backgroundColor];
|
|
22
|
-
}
|
|
23
|
-
if (options.textColor) {
|
|
24
|
-
const textColors = {
|
|
25
|
-
white: "\x1b[37m",
|
|
26
|
-
black: "\x1b[30m",
|
|
27
|
-
red: "\x1b[31m",
|
|
28
|
-
green: "\x1b[32m",
|
|
29
|
-
yellow: "\x1b[33m",
|
|
30
|
-
blue: "\x1b[34m",
|
|
31
|
-
magenta: "\x1b[35m",
|
|
32
|
-
cyan: "\x1b[36m"
|
|
33
|
-
} as const;
|
|
34
|
-
codes += textColors[options.textColor];
|
|
35
|
-
}
|
|
36
|
-
return `${codes}${text}\x1b[0m`;
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
// Run drizzle-kit generate with the correct env path
|
|
40
|
-
const child = spawn("npx", ["drizzle-kit", "generate"], {
|
|
41
|
-
stdio: "inherit",
|
|
42
|
-
env: {
|
|
43
|
-
...process.env,
|
|
44
|
-
DOTENV_CONFIG_PATH: "../.env"
|
|
45
|
-
},
|
|
46
|
-
shell: true
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
child.on("close", (code) => {
|
|
50
|
-
if (code === 0) {
|
|
51
|
-
console.log("");
|
|
52
|
-
console.log(`You can now run ${formatTerminalText("pnpm db:migrate", {
|
|
53
|
-
bold: true,
|
|
54
|
-
backgroundColor: "green",
|
|
55
|
-
textColor: "black"
|
|
56
|
-
})} to apply the migrations to your database.`);
|
|
57
|
-
console.log("");
|
|
58
|
-
}
|
|
59
|
-
process.exit(code ?? 0);
|
|
60
|
-
});
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { EntityCollection } from "@rebasepro/types";
|
|
2
|
-
|
|
3
|
-
const postsCollection: EntityCollection = {
|
|
4
|
-
name: "Posts",
|
|
5
|
-
singularName: "Post",
|
|
6
|
-
slug: "posts",
|
|
7
|
-
dbPath: "posts",
|
|
8
|
-
icon: "Article",
|
|
9
|
-
properties: {
|
|
10
|
-
id: {
|
|
11
|
-
name: "ID",
|
|
12
|
-
type: "number",
|
|
13
|
-
validation: {
|
|
14
|
-
required: true
|
|
15
|
-
}
|
|
16
|
-
},
|
|
17
|
-
title: {
|
|
18
|
-
name: "Title",
|
|
19
|
-
type: "string",
|
|
20
|
-
validation: {
|
|
21
|
-
required: true
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
|
-
content: {
|
|
25
|
-
name: "Content",
|
|
26
|
-
type: "string",
|
|
27
|
-
multiline: true
|
|
28
|
-
},
|
|
29
|
-
status: {
|
|
30
|
-
name: "Status",
|
|
31
|
-
type: "string",
|
|
32
|
-
enum: [
|
|
33
|
-
{
|
|
34
|
-
id: "draft",
|
|
35
|
-
label: "Draft",
|
|
36
|
-
color: "grayLight"
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
id: "review",
|
|
40
|
-
label: "In Review",
|
|
41
|
-
color: "orangeLight"
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
id: "published",
|
|
45
|
-
label: "Published",
|
|
46
|
-
color: "greenLight"
|
|
47
|
-
}
|
|
48
|
-
]
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
export default postsCollection;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "{{PROJECT_NAME}}-shared",
|
|
3
|
-
"version": "1.0.0",
|
|
4
|
-
"description": "Shared collections for frontend and backend",
|
|
5
|
-
"main": "dist/index.js",
|
|
6
|
-
"types": "dist/index.d.ts",
|
|
7
|
-
"type": "module",
|
|
8
|
-
"private": true,
|
|
9
|
-
"scripts": {
|
|
10
|
-
"build": "tsc",
|
|
11
|
-
"dev": "tsc --watch",
|
|
12
|
-
"clean": "rm -rf dist"
|
|
13
|
-
},
|
|
14
|
-
"dependencies": {
|
|
15
|
-
"@rebasepro/types": "^4.0.0"
|
|
16
|
-
},
|
|
17
|
-
"devDependencies": {
|
|
18
|
-
"typescript": "^5.9.2"
|
|
19
|
-
},
|
|
20
|
-
"exports": {
|
|
21
|
-
".": {
|
|
22
|
-
"import": "./dist/index.js",
|
|
23
|
-
"types": "./dist/index.d.ts",
|
|
24
|
-
"default": "./dist/index.js"
|
|
25
|
-
},
|
|
26
|
-
"./package.json": "./package.json"
|
|
27
|
-
}
|
|
28
|
-
}
|
|
File without changes
|
|
File without changes
|