@dimah-s3/cli 0.5.0 → 0.6.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 (63) hide show
  1. package/README.md +11 -7
  2. package/dist/index.js +80 -5
  3. package/dist/index.js.map +1 -1
  4. package/dist/snapshot/transform.js +0 -1
  5. package/dist/snapshot/transform.js.map +1 -1
  6. package/dist/templates/catalog.json +12 -1
  7. package/dist/templates/hono/.env.example +5 -0
  8. package/dist/templates/hono/README.md +33 -0
  9. package/dist/templates/hono/_gitignore +26 -0
  10. package/dist/templates/hono/components.json +27 -0
  11. package/dist/templates/hono/index.html +18 -0
  12. package/dist/templates/hono/package.json +44 -0
  13. package/dist/templates/hono/pnpm-workspace.yaml +10 -0
  14. package/dist/templates/hono/postcss.config.mjs +7 -0
  15. package/dist/templates/hono/src/App.tsx +27 -0
  16. package/dist/templates/hono/src/components/s3-provider.tsx +7 -0
  17. package/dist/templates/hono/src/components/theme-provider.tsx +9 -0
  18. package/dist/templates/hono/src/index.css +132 -0
  19. package/dist/templates/hono/src/lib/s3.ts +11 -0
  20. package/dist/templates/hono/src/main.tsx +23 -0
  21. package/dist/templates/hono/src/server.ts +27 -0
  22. package/dist/templates/hono/src/vite-env.d.ts +1 -0
  23. package/dist/templates/hono/tsconfig.json +23 -0
  24. package/dist/templates/hono/vite.config.ts +21 -0
  25. package/dist/templates/nextjs/README.md +8 -8
  26. package/dist/templates/nextjs/_gitignore +5 -0
  27. package/dist/templates/nextjs/components.json +1 -1
  28. package/dist/templates/nextjs/package.json +4 -4
  29. package/dist/templates/nextjs/pnpm-workspace.yaml +11 -0
  30. package/dist/templates/nextjs/{app → src/app}/page.tsx +2 -3
  31. package/dist/templates/nextjs/src/lib/s3-client.ts +12 -0
  32. package/dist/templates/nextjs/src/lib/utils.ts +1 -0
  33. package/dist/templates/nextjs/tsconfig.json +1 -1
  34. package/dist/templates/vite/.env.example +5 -0
  35. package/dist/templates/vite/README.md +33 -0
  36. package/dist/templates/vite/_gitignore +27 -0
  37. package/dist/templates/vite/components.json +27 -0
  38. package/dist/templates/vite/index.html +18 -0
  39. package/dist/templates/vite/package.json +45 -0
  40. package/dist/templates/vite/pnpm-workspace.yaml +10 -0
  41. package/dist/templates/vite/postcss.config.mjs +7 -0
  42. package/dist/templates/vite/server/index.ts +14 -0
  43. package/dist/templates/vite/server/s3-client.ts +12 -0
  44. package/dist/templates/vite/server/s3.ts +11 -0
  45. package/dist/templates/vite/src/App.tsx +27 -0
  46. package/dist/templates/vite/src/components/s3-provider.tsx +7 -0
  47. package/dist/templates/vite/src/components/theme-provider.tsx +9 -0
  48. package/dist/templates/vite/src/index.css +132 -0
  49. package/dist/templates/vite/src/lib/utils.ts +1 -0
  50. package/dist/templates/vite/src/main.tsx +23 -0
  51. package/dist/templates/vite/src/vite-env.d.ts +1 -0
  52. package/dist/templates/vite/tsconfig.json +22 -0
  53. package/dist/templates/vite/tsconfig.server.json +17 -0
  54. package/dist/templates/vite/vite.config.ts +21 -0
  55. package/package.json +4 -2
  56. /package/dist/templates/{nextjs → hono/src}/lib/s3-client.ts +0 -0
  57. /package/dist/templates/{nextjs → hono/src}/lib/utils.ts +0 -0
  58. /package/dist/templates/nextjs/{app → src/app}/api/s3/[...s3]/route.ts +0 -0
  59. /package/dist/templates/nextjs/{app → src/app}/globals.css +0 -0
  60. /package/dist/templates/nextjs/{app → src/app}/layout.tsx +0 -0
  61. /package/dist/templates/nextjs/{components → src/components}/s3-provider.tsx +0 -0
  62. /package/dist/templates/nextjs/{components → src/components}/theme-provider.tsx +0 -0
  63. /package/dist/templates/nextjs/{lib → src/lib}/s3.ts +0 -0
@@ -0,0 +1,27 @@
1
+ {
2
+ "$schema": "https://ui.shadcn.com/schema.json",
3
+ "style": "base-mira",
4
+ "rsc": false,
5
+ "tsx": true,
6
+ "tailwind": {
7
+ "config": "",
8
+ "css": "src/index.css",
9
+ "baseColor": "neutral",
10
+ "cssVariables": true,
11
+ "prefix": ""
12
+ },
13
+ "iconLibrary": "lucide",
14
+ "rtl": true,
15
+ "aliases": {
16
+ "components": "@/components",
17
+ "utils": "@/lib/utils",
18
+ "ui": "@/components/ui",
19
+ "lib": "@/lib",
20
+ "hooks": "@/hooks"
21
+ },
22
+ "menuColor": "default",
23
+ "menuAccent": "subtle",
24
+ "registries": {
25
+ "@dimah-s3": "https://dimah-s3.vercel.app/r/{name}.json"
26
+ }
27
+ }
@@ -0,0 +1,18 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <title>dimah-s3 — Hono</title>
7
+ <link rel="preconnect" href="https://fonts.googleapis.com" />
8
+ <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
9
+ <link
10
+ href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap"
11
+ rel="stylesheet"
12
+ />
13
+ </head>
14
+ <body>
15
+ <div id="root"></div>
16
+ <script type="module" src="/src/main.tsx"></script>
17
+ </body>
18
+ </html>
@@ -0,0 +1,44 @@
1
+ {
2
+ "name": "dimah-s3-hono",
3
+ "version": "0.0.1",
4
+ "private": true,
5
+ "type": "module",
6
+ "scripts": {
7
+ "dev": "concurrently -k -n web,api -c green,blue \"npm:dev:web\" \"npm:dev:api\"",
8
+ "dev:api": "tsx watch --env-file=.env src/server.ts",
9
+ "dev:web": "vite",
10
+ "build": "vite build",
11
+ "start": "tsx --env-file=.env src/server.ts",
12
+ "check-types": "tsc --noEmit"
13
+ },
14
+ "dependencies": {
15
+ "@aws-sdk/client-s3": "^3.1105.0",
16
+ "@base-ui/react": "^1.7.0",
17
+ "@dimah-s3/react": "^0.6.0",
18
+ "@dimah-s3/server": "^0.6.0",
19
+ "@dimah-s3/ui": "^0.6.0",
20
+ "@fuma-translate/react": "^1.0.2",
21
+ "@hono/node-server": "^2.1.0",
22
+ "class-variance-authority": "^0.7.1",
23
+ "cnfast": "^0.1.0",
24
+ "hono": "^4.13.0",
25
+ "lucide-react": "^1.29.0",
26
+ "next-themes": "^0.4.6",
27
+ "react": "^19.2.8",
28
+ "react-dom": "^19.2.8",
29
+ "tw-animate-css": "^1.4.0"
30
+ },
31
+ "devDependencies": {
32
+ "@tailwindcss/postcss": "^4.3.3",
33
+ "@types/node": "^26.1.2",
34
+ "@types/react": "^19.2.18",
35
+ "@types/react-dom": "^19.2.4",
36
+ "@vitejs/plugin-react": "^6.0.5",
37
+ "concurrently": "^10.0.4",
38
+ "shadcn": "^4.16.2",
39
+ "tailwindcss": "^4.3.3",
40
+ "tsx": "^4.23.10",
41
+ "typescript": "^7.0.2",
42
+ "vite": "^8.2.1"
43
+ }
44
+ }
@@ -0,0 +1,10 @@
1
+ # Standalone starter (not part of the dimah-s3 monorepo).
2
+ # pnpm 11+ requires allowBuilds for packages with install scripts.
3
+ allowBuilds:
4
+ esbuild: true
5
+ # Fresh @dimah-s3 publishes are expected from the CLI sync bump.
6
+ minimumReleaseAgeExclude:
7
+ - "@dimah-s3/core"
8
+ - "@dimah-s3/react"
9
+ - "@dimah-s3/server"
10
+ - "@dimah-s3/ui"
@@ -0,0 +1,7 @@
1
+ const config = {
2
+ plugins: {
3
+ "@tailwindcss/postcss": {},
4
+ },
5
+ };
6
+
7
+ export default config;
@@ -0,0 +1,27 @@
1
+ import { UploadButton } from "@dimah-s3/ui";
2
+
3
+ export function App() {
4
+ return (
5
+ <main className="flex min-h-full flex-1 flex-col items-center justify-center gap-8 p-8">
6
+ <div className="text-center">
7
+ <h1 className="text-3xl font-bold tracking-tight">dimah-s3</h1>
8
+ <p className="mt-2 text-muted-foreground">
9
+ Hono starter — pick a file to upload to your bucket
10
+ </p>
11
+ </div>
12
+
13
+ <UploadButton
14
+ objectKey={(file) => `uploads/${Date.now()}-${file.name}`}
15
+ accept={["image/*", ".pdf"]}
16
+ maxFileSize={10 * 1024 * 1024}
17
+ label="Upload file"
18
+ />
19
+
20
+ <p className="max-w-sm text-center text-xs text-muted-foreground">
21
+ Fill the <code className="rounded bg-muted px-1 py-0.5">S3_*</code>{" "}
22
+ values in <code className="rounded bg-muted px-1 py-0.5">.env</code>.
23
+ Browser uploads need bucket CORS.
24
+ </p>
25
+ </main>
26
+ );
27
+ }
@@ -0,0 +1,7 @@
1
+ import { createS3Client } from "@dimah-s3/react";
2
+
3
+ export const { api, S3Provider, useApi } = createS3Client();
4
+
5
+ export function S3ClientProvider({ children }: { children: React.ReactNode }) {
6
+ return <S3Provider>{children}</S3Provider>;
7
+ }
@@ -0,0 +1,9 @@
1
+ import * as React from "react";
2
+ import { ThemeProvider as NextThemesProvider } from "next-themes";
3
+
4
+ export function ThemeProvider({
5
+ children,
6
+ ...props
7
+ }: React.ComponentProps<typeof NextThemesProvider>) {
8
+ return <NextThemesProvider {...props}>{children}</NextThemesProvider>;
9
+ }
@@ -0,0 +1,132 @@
1
+ @import "tailwindcss";
2
+ @import "tw-animate-css";
3
+ @import "shadcn/tailwind.css";
4
+ @import "@dimah-s3/ui/styles.css";
5
+
6
+ @custom-variant dark (&:is(.dark *));
7
+
8
+ @theme inline {
9
+ --font-heading: var(--font-sans);
10
+ --font-sans: "Inter", ui-sans-serif, system-ui, sans-serif;
11
+ --color-sidebar-ring: var(--sidebar-ring);
12
+ --color-sidebar-border: var(--sidebar-border);
13
+ --color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
14
+ --color-sidebar-accent: var(--sidebar-accent);
15
+ --color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
16
+ --color-sidebar-primary: var(--sidebar-primary);
17
+ --color-sidebar-foreground: var(--sidebar-foreground);
18
+ --color-sidebar: var(--sidebar);
19
+ --color-chart-5: var(--chart-5);
20
+ --color-chart-4: var(--chart-4);
21
+ --color-chart-3: var(--chart-3);
22
+ --color-chart-2: var(--chart-2);
23
+ --color-chart-1: var(--chart-1);
24
+ --color-ring: var(--ring);
25
+ --color-input: var(--input);
26
+ --color-border: var(--border);
27
+ --color-destructive: var(--destructive);
28
+ --color-accent-foreground: var(--accent-foreground);
29
+ --color-accent: var(--accent);
30
+ --color-muted-foreground: var(--muted-foreground);
31
+ --color-muted: var(--muted);
32
+ --color-secondary-foreground: var(--secondary-foreground);
33
+ --color-secondary: var(--secondary);
34
+ --color-primary-foreground: var(--primary-foreground);
35
+ --color-primary: var(--primary);
36
+ --color-popover-foreground: var(--popover-foreground);
37
+ --color-popover: var(--popover);
38
+ --color-card-foreground: var(--card-foreground);
39
+ --color-card: var(--card);
40
+ --color-foreground: var(--foreground);
41
+ --color-background: var(--background);
42
+ --radius-sm: calc(var(--radius) * 0.6);
43
+ --radius-md: calc(var(--radius) * 0.8);
44
+ --radius-lg: var(--radius);
45
+ --radius-xl: calc(var(--radius) * 1.4);
46
+ --radius-2xl: calc(var(--radius) * 1.8);
47
+ --radius-3xl: calc(var(--radius) * 2.2);
48
+ --radius-4xl: calc(var(--radius) * 2.6);
49
+ }
50
+
51
+ :root {
52
+ --card: oklch(1 0 0);
53
+ --card-foreground: oklch(0.145 0 0);
54
+ --popover: oklch(1 0 0);
55
+ --popover-foreground: oklch(0.145 0 0);
56
+ --primary: oklch(0.205 0 0);
57
+ --primary-foreground: oklch(0.985 0 0);
58
+ --secondary: oklch(0.97 0 0);
59
+ --secondary-foreground: oklch(0.205 0 0);
60
+ --muted: oklch(0.97 0 0);
61
+ --muted-foreground: oklch(0.556 0 0);
62
+ --accent: oklch(0.97 0 0);
63
+ --accent-foreground: oklch(0.205 0 0);
64
+ --destructive: oklch(0.577 0.245 27.325);
65
+ --border: oklch(0.922 0 0);
66
+ --input: oklch(0.922 0 0);
67
+ --ring: oklch(0.708 0 0);
68
+ --chart-1: oklch(0.87 0 0);
69
+ --chart-2: oklch(0.556 0 0);
70
+ --chart-3: oklch(0.439 0 0);
71
+ --chart-4: oklch(0.371 0 0);
72
+ --chart-5: oklch(0.269 0 0);
73
+ --radius: 0.45rem;
74
+ --sidebar: oklch(0.985 0 0);
75
+ --sidebar-foreground: oklch(0.145 0 0);
76
+ --sidebar-primary: oklch(0.205 0 0);
77
+ --sidebar-primary-foreground: oklch(0.985 0 0);
78
+ --sidebar-accent: oklch(0.97 0 0);
79
+ --sidebar-accent-foreground: oklch(0.205 0 0);
80
+ --sidebar-border: oklch(0.922 0 0);
81
+ --sidebar-ring: oklch(0.708 0 0);
82
+ --background: oklch(1 0 0);
83
+ --foreground: oklch(0.145 0 0);
84
+ }
85
+
86
+ .dark {
87
+ --background: oklch(0.145 0 0);
88
+ --foreground: oklch(0.985 0 0);
89
+ --card: oklch(0.205 0 0);
90
+ --card-foreground: oklch(0.985 0 0);
91
+ --popover: oklch(0.205 0 0);
92
+ --popover-foreground: oklch(0.985 0 0);
93
+ --primary: oklch(0.922 0 0);
94
+ --primary-foreground: oklch(0.205 0 0);
95
+ --secondary: oklch(0.269 0 0);
96
+ --secondary-foreground: oklch(0.985 0 0);
97
+ --muted: oklch(0.269 0 0);
98
+ --muted-foreground: oklch(0.708 0 0);
99
+ --accent: oklch(0.269 0 0);
100
+ --accent-foreground: oklch(0.985 0 0);
101
+ --destructive: oklch(0.704 0.191 22.216);
102
+ --border: oklch(1 0 0 / 10%);
103
+ --input: oklch(1 0 0 / 15%);
104
+ --ring: oklch(0.556 0 0);
105
+ --chart-1: oklch(0.87 0 0);
106
+ --chart-2: oklch(0.556 0 0);
107
+ --chart-3: oklch(0.439 0 0);
108
+ --chart-4: oklch(0.371 0 0);
109
+ --chart-5: oklch(0.269 0 0);
110
+ --sidebar: oklch(0.205 0 0);
111
+ --sidebar-foreground: oklch(0.985 0 0);
112
+ --sidebar-primary: oklch(0.488 0.243 264.376);
113
+ --sidebar-primary-foreground: oklch(0.985 0 0);
114
+ --sidebar-accent: oklch(0.269 0 0);
115
+ --sidebar-accent-foreground: oklch(0.985 0 0);
116
+ --sidebar-border: oklch(1 0 0 / 10%);
117
+ --sidebar-ring: oklch(0.556 0 0);
118
+ }
119
+
120
+ @layer base {
121
+ * {
122
+ @apply border-border outline-ring/50;
123
+ }
124
+ html,
125
+ body,
126
+ #root {
127
+ @apply h-full;
128
+ }
129
+ body {
130
+ @apply bg-background text-foreground font-sans antialiased;
131
+ }
132
+ }
@@ -0,0 +1,11 @@
1
+ import { dimahS3 } from "@dimah-s3/server";
2
+ import { s3Client, defaultBucket } from "./s3-client";
3
+
4
+ export const s3 = dimahS3({
5
+ s3: s3Client,
6
+ defaultBucket,
7
+ upload: { enabled: true },
8
+ download: { enabled: false },
9
+ delete: { enabled: false },
10
+ multipart: { enabled: false },
11
+ });
@@ -0,0 +1,23 @@
1
+ import { StrictMode } from "react";
2
+ import { createRoot } from "react-dom/client";
3
+ import { Toaster } from "@dimah-s3/ui";
4
+ import { ThemeProvider } from "@/components/theme-provider";
5
+ import { S3ClientProvider } from "@/components/s3-provider";
6
+ import { App } from "./App";
7
+ import "./index.css";
8
+
9
+ createRoot(document.getElementById("root")!).render(
10
+ <StrictMode>
11
+ <ThemeProvider
12
+ attribute="class"
13
+ defaultTheme="system"
14
+ enableSystem
15
+ disableTransitionOnChange
16
+ >
17
+ <S3ClientProvider>
18
+ <App />
19
+ <Toaster />
20
+ </S3ClientProvider>
21
+ </ThemeProvider>
22
+ </StrictMode>,
23
+ );
@@ -0,0 +1,27 @@
1
+ import { existsSync } from "node:fs";
2
+ import { serve } from "@hono/node-server";
3
+ import { serveStatic } from "@hono/node-server/serve-static";
4
+ import { Hono } from "hono";
5
+ import { toHonoHandler } from "@dimah-s3/server/hono";
6
+ import { s3 } from "./lib/s3";
7
+
8
+ const port = Number(process.env.PORT ?? 3000);
9
+ const hasClientBuild = existsSync(
10
+ new URL("../dist/index.html", import.meta.url),
11
+ );
12
+
13
+ const app = new Hono();
14
+
15
+ app.on(["GET", "POST", "DELETE"], "/api/s3/*", toHonoHandler(s3));
16
+
17
+ if (hasClientBuild) {
18
+ app.use("/*", serveStatic({ root: "./dist" }));
19
+ app.get("*", serveStatic({ path: "./dist/index.html" }));
20
+ }
21
+
22
+ serve({ fetch: app.fetch, port }, () => {
23
+ console.log(`dimah-s3 Hono listening on http://127.0.0.1:${port}`);
24
+ if (!hasClientBuild) {
25
+ console.log("Dev API ready — open the Vite URL (proxies /api here).");
26
+ }
27
+ });
@@ -0,0 +1 @@
1
+ /// <reference types="vite/client" />
@@ -0,0 +1,23 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/tsconfig",
3
+ "compilerOptions": {
4
+ "target": "ES2022",
5
+ "lib": ["ES2022", "DOM", "DOM.Iterable"],
6
+ "module": "ESNext",
7
+ "moduleResolution": "Bundler",
8
+ "jsx": "react-jsx",
9
+ "strict": true,
10
+ "noEmit": true,
11
+ "esModuleInterop": true,
12
+ "isolatedModules": true,
13
+ "moduleDetection": "force",
14
+ "resolveJsonModule": true,
15
+ "skipLibCheck": true,
16
+ "types": ["node"],
17
+ "paths": {
18
+ "@/*": ["./src/*"]
19
+ }
20
+ },
21
+ "include": ["src", "vite.config.ts"],
22
+ "exclude": ["node_modules", "dist"]
23
+ }
@@ -0,0 +1,21 @@
1
+ import { defineConfig } from "vite";
2
+ import react from "@vitejs/plugin-react";
3
+ import { resolve } from "node:path";
4
+
5
+ export default defineConfig({
6
+ plugins: [react()],
7
+ resolve: {
8
+ alias: {
9
+ "@": resolve("./src"),
10
+ },
11
+ },
12
+ server: {
13
+ port: 5173,
14
+ proxy: {
15
+ "/api": {
16
+ target: "http://127.0.0.1:3000",
17
+ changeOrigin: true,
18
+ },
19
+ },
20
+ },
21
+ });
@@ -8,17 +8,17 @@ Minimal [Next.js](https://nextjs.org) App Router starter with [dimah-s3](https:/
8
8
  npx @dimah-s3/cli@latest create my-app
9
9
  ```
10
10
 
11
- Fill `S3_*` in `.env`. For browser uploads, configure bucket CORS — see [Providers](https://dimah-s3.vercel.app/docs/providers).
11
+ `cd my-app`, fill `S3_*` in `.env`. For browser uploads, configure bucket CORS — see [Providers](https://dimah-s3.vercel.app/docs/providers).
12
12
 
13
13
  ## What’s included
14
14
 
15
- | Path | Role |
16
- | ----------------------------- | ----------------------------------- |
17
- | `lib/s3-client.ts` | AWS SDK `S3Client` + default bucket |
18
- | `lib/s3.ts` | `dimahS3()` server config |
19
- | `app/api/s3/[...s3]/route.ts` | Next.js route adapter |
20
- | `components/s3-provider.tsx` | Client `createS3Client` + provider |
21
- | `app/page.tsx` | Sample `UploadButton` |
15
+ | Path | Role |
16
+ | --------------------------------- | ----------------------------------- |
17
+ | `src/lib/s3-client.ts` | AWS SDK `S3Client` + default bucket |
18
+ | `src/lib/s3.ts` | `dimahS3()` server config |
19
+ | `src/app/api/s3/[...s3]/route.ts` | Next.js route adapter |
20
+ | `src/components/s3-provider.tsx` | Client `createS3Client` + provider |
21
+ | `src/app/page.tsx` | Sample `UploadButton` |
22
22
 
23
23
  ## Docs
24
24
 
@@ -8,6 +8,11 @@
8
8
  # production
9
9
  /build
10
10
 
11
+ # package manager
12
+ pnpm-lock.yaml
13
+ package-lock.json
14
+ yarn.lock
15
+
11
16
  # env files
12
17
  .env*
13
18
  !.env.example
@@ -5,7 +5,7 @@
5
5
  "tsx": true,
6
6
  "tailwind": {
7
7
  "config": "",
8
- "css": "app/globals.css",
8
+ "css": "src/app/globals.css",
9
9
  "baseColor": "neutral",
10
10
  "cssVariables": true,
11
11
  "prefix": ""
@@ -13,9 +13,9 @@
13
13
  "dependencies": {
14
14
  "@aws-sdk/client-s3": "^3.1105.0",
15
15
  "@base-ui/react": "^1.7.0",
16
- "@dimah-s3/react": "^0.5.0",
17
- "@dimah-s3/server": "^0.5.0",
18
- "@dimah-s3/ui": "^0.5.0",
16
+ "@dimah-s3/react": "^0.6.0",
17
+ "@dimah-s3/server": "^0.6.0",
18
+ "@dimah-s3/ui": "^0.6.0",
19
19
  "@fuma-translate/react": "^1.0.2",
20
20
  "class-variance-authority": "^0.7.1",
21
21
  "cnfast": "^0.1.0",
@@ -24,7 +24,6 @@
24
24
  "next-themes": "^0.4.6",
25
25
  "react": "^19.2.8",
26
26
  "react-dom": "^19.2.8",
27
- "shadcn": "^4.16.2",
28
27
  "tw-animate-css": "^1.4.0"
29
28
  },
30
29
  "devDependencies": {
@@ -34,6 +33,7 @@
34
33
  "@types/react-dom": "^19.2.4",
35
34
  "eslint": "^10.8.0",
36
35
  "eslint-config-next": "^16.3.0",
36
+ "shadcn": "^4.16.2",
37
37
  "tailwindcss": "^4.3.3",
38
38
  "typescript": "^7.0.2"
39
39
  }
@@ -0,0 +1,11 @@
1
+ # Standalone starter (not part of the dimah-s3 monorepo).
2
+ # pnpm 11+ requires allowBuilds for packages with install scripts.
3
+ allowBuilds:
4
+ unrs-resolver: true
5
+ sharp: true
6
+ # Fresh @dimah-s3 publishes are expected from the CLI sync bump.
7
+ minimumReleaseAgeExclude:
8
+ - "@dimah-s3/core"
9
+ - "@dimah-s3/react"
10
+ - "@dimah-s3/server"
11
+ - "@dimah-s3/ui"
@@ -20,9 +20,8 @@ export default function Home() {
20
20
  />
21
21
 
22
22
  <p className="max-w-sm text-center text-xs text-muted-foreground">
23
- Copy <code className="rounded bg-muted px-1 py-0.5">.env.example</code>{" "}
24
- to <code className="rounded bg-muted px-1 py-0.5">.env</code> and set
25
- your <code className="rounded bg-muted px-1 py-0.5">S3_*</code> values.
23
+ Fill the <code className="rounded bg-muted px-1 py-0.5">S3_*</code>{" "}
24
+ values in <code className="rounded bg-muted px-1 py-0.5">.env</code>.
26
25
  Browser uploads need bucket CORS.
27
26
  </p>
28
27
  </main>
@@ -0,0 +1,12 @@
1
+ import { S3Client } from "@aws-sdk/client-s3";
2
+
3
+ export const s3Client = new S3Client({
4
+ region: process.env.S3_REGION,
5
+ endpoint: process.env.S3_ENDPOINT,
6
+ credentials: {
7
+ accessKeyId: process.env.S3_ACCESS_KEY_ID!,
8
+ secretAccessKey: process.env.S3_SECRET_ACCESS_KEY!,
9
+ },
10
+ });
11
+
12
+ export const defaultBucket = process.env.S3_DEFAULT_BUCKET!;
@@ -0,0 +1 @@
1
+ export { cn } from "cnfast";
@@ -17,7 +17,7 @@
17
17
  "incremental": true,
18
18
  "plugins": [{ "name": "next" }],
19
19
  "paths": {
20
- "@/*": ["./*"]
20
+ "@/*": ["./src/*"]
21
21
  }
22
22
  },
23
23
  "include": [
@@ -0,0 +1,5 @@
1
+ S3_ENDPOINT="https://your-endpoint.example.com"
2
+ S3_REGION="auto"
3
+ S3_ACCESS_KEY_ID="your-access-key-id"
4
+ S3_SECRET_ACCESS_KEY="your-secret-access-key"
5
+ S3_DEFAULT_BUCKET="your-bucket-name"
@@ -0,0 +1,33 @@
1
+ # dimah-s3 — Vite template
2
+
3
+ Minimal [Vite](https://vitejs.dev) + React starter with [dimah-s3](https://dimah-s3.vercel.app): Hono presign API, `S3Provider`, and an upload button.
4
+
5
+ ## Create
6
+
7
+ ```bash
8
+ npx @dimah-s3/cli@latest create my-app --template vite
9
+ ```
10
+
11
+ `cd my-app`, fill `S3_*` in `.env`. For browser uploads, configure bucket CORS — see [Providers](https://dimah-s3.vercel.app/docs/providers).
12
+
13
+ `npm run dev` starts the Hono API (`:8787`) and Vite (`:5173`). Open the Vite URL; `/api` is proxied to the API.
14
+
15
+ ## What’s included
16
+
17
+ | Path | Role |
18
+ | -------------------------------- | ----------------------------------- |
19
+ | `server/s3-client.ts` | AWS SDK `S3Client` + default bucket |
20
+ | `server/s3.ts` | `dimahS3()` server config |
21
+ | `server/index.ts` | Hono API (`toHonoHandler`) |
22
+ | `src/components/s3-provider.tsx` | Client `createS3Client` + provider |
23
+ | `src/App.tsx` | Sample `UploadButton` |
24
+
25
+ ## Docs
26
+
27
+ - [Quickstart](https://dimah-s3.vercel.app/docs/quickstart)
28
+ - [Server setup](https://dimah-s3.vercel.app/docs/server/setup)
29
+ - [Client setup](https://dimah-s3.vercel.app/docs/react/setup)
30
+
31
+ ## License
32
+
33
+ MIT
@@ -0,0 +1,27 @@
1
+ # dependencies
2
+ /node_modules
3
+
4
+ # build
5
+ /dist
6
+ /dist-server
7
+
8
+ # package manager
9
+ pnpm-lock.yaml
10
+ package-lock.json
11
+ yarn.lock
12
+
13
+ # env files
14
+ .env*
15
+ !.env.example
16
+
17
+ # typescript
18
+ *.tsbuildinfo
19
+
20
+ # debug
21
+ npm-debug.log*
22
+ yarn-debug.log*
23
+ yarn-error.log*
24
+ .pnpm-debug.log*
25
+
26
+ # misc
27
+ .DS_Store
@@ -0,0 +1,27 @@
1
+ {
2
+ "$schema": "https://ui.shadcn.com/schema.json",
3
+ "style": "base-mira",
4
+ "rsc": false,
5
+ "tsx": true,
6
+ "tailwind": {
7
+ "config": "",
8
+ "css": "src/index.css",
9
+ "baseColor": "neutral",
10
+ "cssVariables": true,
11
+ "prefix": ""
12
+ },
13
+ "iconLibrary": "lucide",
14
+ "rtl": true,
15
+ "aliases": {
16
+ "components": "@/components",
17
+ "utils": "@/lib/utils",
18
+ "ui": "@/components/ui",
19
+ "lib": "@/lib",
20
+ "hooks": "@/hooks"
21
+ },
22
+ "menuColor": "default",
23
+ "menuAccent": "subtle",
24
+ "registries": {
25
+ "@dimah-s3": "https://dimah-s3.vercel.app/r/{name}.json"
26
+ }
27
+ }
@@ -0,0 +1,18 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <title>dimah-s3 — Vite</title>
7
+ <link rel="preconnect" href="https://fonts.googleapis.com" />
8
+ <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
9
+ <link
10
+ href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap"
11
+ rel="stylesheet"
12
+ />
13
+ </head>
14
+ <body>
15
+ <div id="root"></div>
16
+ <script type="module" src="/src/main.tsx"></script>
17
+ </body>
18
+ </html>