shipd 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 (145) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +205 -0
  3. package/dist/index.d.ts +1 -0
  4. package/dist/index.js +1366 -0
  5. package/docs-template/README.md +255 -0
  6. package/docs-template/[slug]/[subslug]/page.tsx +1242 -0
  7. package/docs-template/[slug]/page.tsx +422 -0
  8. package/docs-template/api/page.tsx +47 -0
  9. package/docs-template/components/docs/docs-category-page.tsx +162 -0
  10. package/docs-template/components/docs/docs-code-card.tsx +135 -0
  11. package/docs-template/components/docs/docs-header.tsx +69 -0
  12. package/docs-template/components/docs/docs-nav.ts +95 -0
  13. package/docs-template/components/docs/docs-sidebar.tsx +112 -0
  14. package/docs-template/components/docs/docs-toc.tsx +38 -0
  15. package/docs-template/components/ui/badge.tsx +47 -0
  16. package/docs-template/components/ui/button.tsx +60 -0
  17. package/docs-template/components/ui/card.tsx +93 -0
  18. package/docs-template/components/ui/sheet.tsx +140 -0
  19. package/docs-template/documentation/page.tsx +80 -0
  20. package/docs-template/layout.tsx +27 -0
  21. package/docs-template/lib/utils.ts +7 -0
  22. package/docs-template/page.tsx +360 -0
  23. package/package.json +66 -0
  24. package/template/.env.example +45 -0
  25. package/template/README.md +239 -0
  26. package/template/app/api/auth/[...all]/route.ts +4 -0
  27. package/template/app/api/chat/route.ts +16 -0
  28. package/template/app/api/subscription/route.ts +25 -0
  29. package/template/app/api/upload-image/route.ts +64 -0
  30. package/template/app/blog/[slug]/page.tsx +314 -0
  31. package/template/app/blog/page.tsx +107 -0
  32. package/template/app/dashboard/_components/chart-interactive.tsx +289 -0
  33. package/template/app/dashboard/_components/chatbot.tsx +39 -0
  34. package/template/app/dashboard/_components/mode-toggle.tsx +46 -0
  35. package/template/app/dashboard/_components/navbar.tsx +84 -0
  36. package/template/app/dashboard/_components/section-cards.tsx +102 -0
  37. package/template/app/dashboard/_components/sidebar.tsx +90 -0
  38. package/template/app/dashboard/_components/subscribe-button.tsx +49 -0
  39. package/template/app/dashboard/billing/page.tsx +277 -0
  40. package/template/app/dashboard/chat/page.tsx +73 -0
  41. package/template/app/dashboard/cli/page.tsx +260 -0
  42. package/template/app/dashboard/layout.tsx +24 -0
  43. package/template/app/dashboard/page.tsx +216 -0
  44. package/template/app/dashboard/payment/_components/manage-subscription.tsx +22 -0
  45. package/template/app/dashboard/payment/page.tsx +126 -0
  46. package/template/app/dashboard/settings/page.tsx +613 -0
  47. package/template/app/dashboard/upload/page.tsx +324 -0
  48. package/template/app/error.tsx +78 -0
  49. package/template/app/favicon.ico +0 -0
  50. package/template/app/globals.css +126 -0
  51. package/template/app/layout.tsx +135 -0
  52. package/template/app/not-found.tsx +45 -0
  53. package/template/app/page.tsx +28 -0
  54. package/template/app/pricing/_component/pricing-table.tsx +276 -0
  55. package/template/app/pricing/page.tsx +23 -0
  56. package/template/app/privacy-policy/page.tsx +280 -0
  57. package/template/app/robots.txt +12 -0
  58. package/template/app/sign-in/page.tsx +228 -0
  59. package/template/app/sign-up/page.tsx +243 -0
  60. package/template/app/sitemap.ts +62 -0
  61. package/template/app/success/page.tsx +123 -0
  62. package/template/app/terms-of-service/page.tsx +212 -0
  63. package/template/auth-schema.ts +47 -0
  64. package/template/components/homepage/cli-workflow-section.tsx +138 -0
  65. package/template/components/homepage/features-section.tsx +150 -0
  66. package/template/components/homepage/footer.tsx +53 -0
  67. package/template/components/homepage/hero-section.tsx +112 -0
  68. package/template/components/homepage/integrations.tsx +124 -0
  69. package/template/components/homepage/navigation.tsx +116 -0
  70. package/template/components/homepage/news-section.tsx +82 -0
  71. package/template/components/homepage/testimonials-section.tsx +34 -0
  72. package/template/components/logos/BetterAuth.tsx +21 -0
  73. package/template/components/logos/NeonPostgres.tsx +41 -0
  74. package/template/components/logos/Nextjs.tsx +72 -0
  75. package/template/components/logos/Polar.tsx +7 -0
  76. package/template/components/logos/TailwindCSS.tsx +27 -0
  77. package/template/components/logos/index.ts +6 -0
  78. package/template/components/logos/shadcnui.tsx +8 -0
  79. package/template/components/provider.tsx +8 -0
  80. package/template/components/ui/avatar.tsx +53 -0
  81. package/template/components/ui/badge.tsx +46 -0
  82. package/template/components/ui/button.tsx +59 -0
  83. package/template/components/ui/card.tsx +92 -0
  84. package/template/components/ui/chart.tsx +353 -0
  85. package/template/components/ui/checkbox.tsx +32 -0
  86. package/template/components/ui/dialog.tsx +135 -0
  87. package/template/components/ui/dropdown-menu.tsx +257 -0
  88. package/template/components/ui/form.tsx +167 -0
  89. package/template/components/ui/input.tsx +21 -0
  90. package/template/components/ui/label.tsx +24 -0
  91. package/template/components/ui/progress.tsx +31 -0
  92. package/template/components/ui/resizable.tsx +56 -0
  93. package/template/components/ui/select.tsx +185 -0
  94. package/template/components/ui/separator.tsx +28 -0
  95. package/template/components/ui/sheet.tsx +139 -0
  96. package/template/components/ui/skeleton.tsx +13 -0
  97. package/template/components/ui/sonner.tsx +25 -0
  98. package/template/components/ui/switch.tsx +31 -0
  99. package/template/components/ui/tabs.tsx +66 -0
  100. package/template/components/ui/textarea.tsx +18 -0
  101. package/template/components/ui/toggle-group.tsx +73 -0
  102. package/template/components/ui/toggle.tsx +47 -0
  103. package/template/components/ui/tooltip.tsx +61 -0
  104. package/template/components/user-profile.tsx +139 -0
  105. package/template/components.json +21 -0
  106. package/template/db/drizzle.ts +14 -0
  107. package/template/db/migrations/0000_worried_rawhide_kid.sql +77 -0
  108. package/template/db/migrations/meta/0000_snapshot.json +494 -0
  109. package/template/db/migrations/meta/_journal.json +13 -0
  110. package/template/db/schema.ts +85 -0
  111. package/template/drizzle.config.ts +13 -0
  112. package/template/emails/components/layout.tsx +181 -0
  113. package/template/emails/password-reset.tsx +67 -0
  114. package/template/emails/payment-failed.tsx +167 -0
  115. package/template/emails/subscription-confirmation.tsx +129 -0
  116. package/template/emails/welcome.tsx +100 -0
  117. package/template/eslint.config.mjs +16 -0
  118. package/template/hooks/use-mobile.ts +21 -0
  119. package/template/lib/auth-client.ts +8 -0
  120. package/template/lib/auth.ts +276 -0
  121. package/template/lib/email.ts +118 -0
  122. package/template/lib/polar-products.ts +49 -0
  123. package/template/lib/subscription.ts +148 -0
  124. package/template/lib/upload-image.ts +28 -0
  125. package/template/lib/utils.ts +6 -0
  126. package/template/middleware.ts +30 -0
  127. package/template/next-env.d.ts +5 -0
  128. package/template/next.config.ts +27 -0
  129. package/template/package.json +99 -0
  130. package/template/postcss.config.mjs +5 -0
  131. package/template/public/add.png +0 -0
  132. package/template/public/favicon.svg +4 -0
  133. package/template/public/file.svg +1 -0
  134. package/template/public/globe.svg +1 -0
  135. package/template/public/iphone.png +0 -0
  136. package/template/public/logo.png +0 -0
  137. package/template/public/next.svg +1 -0
  138. package/template/public/polar-sh.svg +1 -0
  139. package/template/public/shadcn-ui.svg +1 -0
  140. package/template/public/site.webmanifest +21 -0
  141. package/template/public/vercel.svg +1 -0
  142. package/template/public/window.svg +1 -0
  143. package/template/tailwind.config.ts +89 -0
  144. package/template/template.config.json +138 -0
  145. package/template/tsconfig.json +27 -0
@@ -0,0 +1,139 @@
1
+ import {
2
+ DropdownMenu,
3
+ DropdownMenuContent,
4
+ DropdownMenuGroup,
5
+ DropdownMenuItem,
6
+ DropdownMenuLabel,
7
+ DropdownMenuSeparator,
8
+ DropdownMenuShortcut,
9
+ DropdownMenuTrigger,
10
+ } from "@/components/ui/dropdown-menu";
11
+ import { authClient } from "@/lib/auth-client";
12
+ import { Loader2 } from "lucide-react";
13
+ import Link from "next/link";
14
+ import { useRouter } from "next/navigation";
15
+ import { useEffect, useState, useCallback } from "react";
16
+ import { Avatar, AvatarFallback, AvatarImage } from "./ui/avatar";
17
+
18
+ interface UserInfo {
19
+ id: string;
20
+ name: string;
21
+ image?: string | null | undefined;
22
+ email: string;
23
+ emailVerified: boolean;
24
+ createdAt: Date;
25
+ updatedAt: Date;
26
+ }
27
+
28
+ export default function UserProfile({ mini }: { mini?: boolean }) {
29
+ const [userInfo, setUserInfo] = useState<UserInfo | null>(null);
30
+ const [loading, setLoading] = useState(true);
31
+ const [error, setError] = useState<string | null>(null);
32
+ const router = useRouter();
33
+
34
+ const fetchUserData = useCallback(async () => {
35
+ setLoading(true);
36
+ setError(null);
37
+
38
+ try {
39
+ const result = await authClient.getSession();
40
+
41
+ if (!result.data?.user) {
42
+ router.push("/sign-in");
43
+ return;
44
+ }
45
+
46
+ setUserInfo(result.data?.user);
47
+ } catch (error) {
48
+ console.error("Error fetching user data:", error);
49
+ setError("Failed to load user profile. Please try refreshing the page.");
50
+ } finally {
51
+ setLoading(false);
52
+ }
53
+ }, [router]);
54
+
55
+ useEffect(() => {
56
+ fetchUserData();
57
+ }, [fetchUserData]);
58
+
59
+ const handleSignOut = async () => {
60
+ await authClient.signOut({
61
+ fetchOptions: {
62
+ onSuccess: () => {
63
+ router.push("/sign-in"); // redirect to login page
64
+ },
65
+ },
66
+ });
67
+ };
68
+
69
+ if (error) {
70
+ return (
71
+ <div
72
+ className={`flex gap-2 justify-start items-center w-full rounded ${mini ? "" : "px-4 pt-2 pb-3"}`}
73
+ >
74
+ <div className="text-red-500 text-sm flex-1">
75
+ {mini ? "Error" : error}
76
+ </div>
77
+ </div>
78
+ );
79
+ }
80
+
81
+ return (
82
+ <DropdownMenu>
83
+ <DropdownMenuTrigger asChild>
84
+ <div
85
+ className={`flex gap-2 justify-start items-center w-full rounded ${mini ? "" : "px-4 pt-2 pb-3"}`}
86
+ >
87
+ <Avatar>
88
+ {loading ? (
89
+ <div className="flex items-center justify-center w-full h-full">
90
+ <Loader2 className="h-4 w-4 animate-spin" />
91
+ </div>
92
+ ) : (
93
+ <>
94
+ {userInfo?.image ? (
95
+ <AvatarImage src={userInfo?.image} alt="User Avatar" />
96
+ ) : (
97
+ <AvatarFallback>
98
+ {userInfo?.name && userInfo.name.charAt(0).toUpperCase()}
99
+ </AvatarFallback>
100
+ )}
101
+ </>
102
+ )}
103
+ </Avatar>
104
+ {mini ? null : (
105
+ <div className="flex items-center gap-2">
106
+ <p className="font-medium text-md">
107
+ {loading ? "Loading..." : userInfo?.name || "User"}
108
+ </p>
109
+ {loading && <Loader2 className="h-3 w-3 animate-spin" />}
110
+ </div>
111
+ )}
112
+ </div>
113
+ </DropdownMenuTrigger>
114
+ <DropdownMenuContent className="w-56">
115
+ <DropdownMenuLabel>My Account</DropdownMenuLabel>
116
+ <DropdownMenuSeparator />
117
+ <DropdownMenuGroup>
118
+ <Link href="/dashboard/settings?tab=profile">
119
+ <DropdownMenuItem>
120
+ Profile
121
+ <DropdownMenuShortcut>⇧⌘P</DropdownMenuShortcut>
122
+ </DropdownMenuItem>
123
+ </Link>
124
+ <Link href="/dashboard/settings?tab=billing">
125
+ <DropdownMenuItem>
126
+ Billing
127
+ <DropdownMenuShortcut>⌘B</DropdownMenuShortcut>
128
+ </DropdownMenuItem>
129
+ </Link>
130
+ </DropdownMenuGroup>
131
+ <DropdownMenuSeparator />
132
+ <DropdownMenuItem onClick={handleSignOut}>
133
+ Log out
134
+ <DropdownMenuShortcut>⇧⌘Q</DropdownMenuShortcut>
135
+ </DropdownMenuItem>
136
+ </DropdownMenuContent>
137
+ </DropdownMenu>
138
+ );
139
+ }
@@ -0,0 +1,21 @@
1
+ {
2
+ "$schema": "https://ui.shadcn.com/schema.json",
3
+ "style": "new-york",
4
+ "rsc": true,
5
+ "tsx": true,
6
+ "tailwind": {
7
+ "config": "",
8
+ "css": "app/globals.css",
9
+ "baseColor": "neutral",
10
+ "cssVariables": true,
11
+ "prefix": ""
12
+ },
13
+ "aliases": {
14
+ "components": "@/components",
15
+ "utils": "@/lib/utils",
16
+ "ui": "@/components/ui",
17
+ "lib": "@/lib",
18
+ "hooks": "@/hooks"
19
+ },
20
+ "iconLibrary": "lucide"
21
+ }
@@ -0,0 +1,14 @@
1
+ import postgres from "postgres";
2
+ import { drizzle } from "drizzle-orm/postgres-js";
3
+
4
+ const connectionString = process.env.DATABASE_URL;
5
+ if (!connectionString) {
6
+ throw new Error(
7
+ "Missing DATABASE_URL. Add it to your .env.local (or hosting provider env vars). " +
8
+ "You can use a Neon Postgres URL, Supabase, or any Postgres connection string."
9
+ );
10
+ }
11
+
12
+ // Disable prepared statements for Supabase compatibility
13
+ const client = postgres(connectionString, { prepare: false });
14
+ export const db = drizzle(client);
@@ -0,0 +1,77 @@
1
+ CREATE TABLE "account" (
2
+ "id" text PRIMARY KEY NOT NULL,
3
+ "accountId" text NOT NULL,
4
+ "providerId" text NOT NULL,
5
+ "userId" text NOT NULL,
6
+ "accessToken" text,
7
+ "refreshToken" text,
8
+ "idToken" text,
9
+ "accessTokenExpiresAt" timestamp,
10
+ "refreshTokenExpiresAt" timestamp,
11
+ "scope" text,
12
+ "password" text,
13
+ "createdAt" timestamp DEFAULT now() NOT NULL,
14
+ "updatedAt" timestamp DEFAULT now() NOT NULL
15
+ );
16
+ --> statement-breakpoint
17
+ CREATE TABLE "session" (
18
+ "id" text PRIMARY KEY NOT NULL,
19
+ "expiresAt" timestamp NOT NULL,
20
+ "token" text NOT NULL,
21
+ "createdAt" timestamp DEFAULT now() NOT NULL,
22
+ "updatedAt" timestamp DEFAULT now() NOT NULL,
23
+ "ipAddress" text,
24
+ "userAgent" text,
25
+ "userId" text NOT NULL,
26
+ CONSTRAINT "session_token_unique" UNIQUE("token")
27
+ );
28
+ --> statement-breakpoint
29
+ CREATE TABLE "subscription" (
30
+ "id" text PRIMARY KEY NOT NULL,
31
+ "createdAt" timestamp NOT NULL,
32
+ "modifiedAt" timestamp,
33
+ "amount" integer NOT NULL,
34
+ "currency" text NOT NULL,
35
+ "recurringInterval" text NOT NULL,
36
+ "status" text NOT NULL,
37
+ "currentPeriodStart" timestamp NOT NULL,
38
+ "currentPeriodEnd" timestamp NOT NULL,
39
+ "cancelAtPeriodEnd" boolean DEFAULT false NOT NULL,
40
+ "canceledAt" timestamp,
41
+ "startedAt" timestamp NOT NULL,
42
+ "endsAt" timestamp,
43
+ "endedAt" timestamp,
44
+ "customerId" text NOT NULL,
45
+ "productId" text NOT NULL,
46
+ "discountId" text,
47
+ "checkoutId" text NOT NULL,
48
+ "customerCancellationReason" text,
49
+ "customerCancellationComment" text,
50
+ "metadata" text,
51
+ "customFieldData" text,
52
+ "userId" text
53
+ );
54
+ --> statement-breakpoint
55
+ CREATE TABLE "user" (
56
+ "id" text PRIMARY KEY NOT NULL,
57
+ "name" text NOT NULL,
58
+ "email" text NOT NULL,
59
+ "emailVerified" boolean DEFAULT false NOT NULL,
60
+ "image" text,
61
+ "createdAt" timestamp DEFAULT now() NOT NULL,
62
+ "updatedAt" timestamp DEFAULT now() NOT NULL,
63
+ CONSTRAINT "user_email_unique" UNIQUE("email")
64
+ );
65
+ --> statement-breakpoint
66
+ CREATE TABLE "verification" (
67
+ "id" text PRIMARY KEY NOT NULL,
68
+ "identifier" text NOT NULL,
69
+ "value" text NOT NULL,
70
+ "expiresAt" timestamp NOT NULL,
71
+ "createdAt" timestamp DEFAULT now() NOT NULL,
72
+ "updatedAt" timestamp DEFAULT now() NOT NULL
73
+ );
74
+ --> statement-breakpoint
75
+ ALTER TABLE "account" ADD CONSTRAINT "account_userId_user_id_fk" FOREIGN KEY ("userId") REFERENCES "public"."user"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
76
+ ALTER TABLE "session" ADD CONSTRAINT "session_userId_user_id_fk" FOREIGN KEY ("userId") REFERENCES "public"."user"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
77
+ ALTER TABLE "subscription" ADD CONSTRAINT "subscription_userId_user_id_fk" FOREIGN KEY ("userId") REFERENCES "public"."user"("id") ON DELETE no action ON UPDATE no action;