create-stackforge 0.0.1
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/README.md +125 -0
- package/bin/cli.js +2 -0
- package/dist/cli.js +3148 -0
- package/dist/cli.js.map +1 -0
- package/dist/npm-registry-F7EVX3RR.js +18 -0
- package/dist/npm-registry-F7EVX3RR.js.map +1 -0
- package/package.json +74 -0
- package/templates/api/graphql/client-usage.jsx +14 -0
- package/templates/api/graphql/client-usage.tsx +14 -0
- package/templates/api/graphql/client.js +12 -0
- package/templates/api/graphql/client.ts +12 -0
- package/templates/api/graphql/route.js +32 -0
- package/templates/api/graphql/route.ts +23 -0
- package/templates/api/graphql/schema.graphql +13 -0
- package/templates/api/graphql/vite-server.js +27 -0
- package/templates/api/graphql/vite-server.ts +27 -0
- package/templates/api/rest/client-usage.jsx +14 -0
- package/templates/api/rest/client-usage.tsx +14 -0
- package/templates/api/rest/client.js +4 -0
- package/templates/api/rest/client.ts +4 -0
- package/templates/api/rest/route.js +3 -0
- package/templates/api/rest/route.ts +3 -0
- package/templates/api/rest/users-route.js +11 -0
- package/templates/api/rest/users-route.ts +11 -0
- package/templates/api/rest/vite-server.js +15 -0
- package/templates/api/rest/vite-server.ts +15 -0
- package/templates/api/trpc/client-usage.jsx +26 -0
- package/templates/api/trpc/client-usage.tsx +26 -0
- package/templates/api/trpc/client-vite.js +15 -0
- package/templates/api/trpc/client-vite.ts +16 -0
- package/templates/api/trpc/client.js +13 -0
- package/templates/api/trpc/client.ts +14 -0
- package/templates/api/trpc/root.ts +11 -0
- package/templates/api/trpc/route.js +12 -0
- package/templates/api/trpc/route.ts +12 -0
- package/templates/api/trpc/trpc.ts +6 -0
- package/templates/api/trpc/vite-server.js +9 -0
- package/templates/api/trpc/vite-server.ts +9 -0
- package/templates/auth/clerk-protected-page.jsx +11 -0
- package/templates/auth/clerk-protected-page.tsx +11 -0
- package/templates/auth/clerk-protected.jsx +11 -0
- package/templates/auth/clerk-protected.tsx +11 -0
- package/templates/auth/clerk-signin.jsx +11 -0
- package/templates/auth/clerk-signin.tsx +11 -0
- package/templates/auth/clerk.README.md +8 -0
- package/templates/auth/nextauth-options.js +3 -0
- package/templates/auth/nextauth-options.ts +5 -0
- package/templates/auth/nextauth-protected-page.jsx +12 -0
- package/templates/auth/nextauth-protected-page.tsx +12 -0
- package/templates/auth/nextauth-protected.jsx +12 -0
- package/templates/auth/nextauth-protected.tsx +12 -0
- package/templates/auth/nextauth-route.ts +6 -0
- package/templates/auth/nextauth-signin.jsx +15 -0
- package/templates/auth/nextauth-signin.tsx +15 -0
- package/templates/auth/nextauth.README.md +10 -0
- package/templates/auth/supabase-protected-page.jsx +13 -0
- package/templates/auth/supabase-protected-page.tsx +13 -0
- package/templates/auth/supabase-protected.jsx +13 -0
- package/templates/auth/supabase-protected.tsx +13 -0
- package/templates/auth/supabase-signin.jsx +25 -0
- package/templates/auth/supabase-signin.tsx +25 -0
- package/templates/auth/supabase-vite-signin.jsx +20 -0
- package/templates/auth/supabase-vite-signin.tsx +20 -0
- package/templates/auth/supabase.README.md +9 -0
- package/templates/database/drizzle/client.js +8 -0
- package/templates/database/drizzle/client.ts +8 -0
- package/templates/database/drizzle/drizzle.config.ts +6 -0
- package/templates/database/drizzle/example.js +6 -0
- package/templates/database/drizzle/example.ts +6 -0
- package/templates/database/drizzle/schema.ts +6 -0
- package/templates/database/mongoose/connection.js +13 -0
- package/templates/database/mongoose/connection.ts +13 -0
- package/templates/database/mongoose/model.js +7 -0
- package/templates/database/mongoose/model.ts +7 -0
- package/templates/database/prisma/client.js +3 -0
- package/templates/database/prisma/client.ts +3 -0
- package/templates/database/prisma/example.js +5 -0
- package/templates/database/prisma/example.ts +7 -0
- package/templates/database/prisma/schema.prisma +13 -0
- package/templates/database/providers/neon.README.md +9 -0
- package/templates/database/providers/supabase.README.md +9 -0
- package/templates/database/typeorm/data-source.js +15 -0
- package/templates/database/typeorm/data-source.ts +15 -0
- package/templates/database/typeorm/entity.js +10 -0
- package/templates/database/typeorm/entity.ts +10 -0
- package/templates/database/typeorm/migrations/README.md +5 -0
- package/templates/database/usage/drizzle-users.js +6 -0
- package/templates/database/usage/drizzle-users.ts +6 -0
- package/templates/database/usage/mongoose-users.js +5 -0
- package/templates/database/usage/mongoose-users.ts +5 -0
- package/templates/database/usage/prisma-users.js +5 -0
- package/templates/database/usage/prisma-users.ts +5 -0
- package/templates/database/usage/typeorm-users.js +9 -0
- package/templates/database/usage/typeorm-users.ts +9 -0
- package/templates/features/analytics/README.md +9 -0
- package/templates/features/analytics/posthog.js +7 -0
- package/templates/features/analytics/posthog.ts +9 -0
- package/templates/features/email/README.md +17 -0
- package/templates/features/email/resend.js +3 -0
- package/templates/features/email/resend.ts +3 -0
- package/templates/features/error-tracking/README.md +9 -0
- package/templates/features/error-tracking/sentry.js +7 -0
- package/templates/features/error-tracking/sentry.ts +7 -0
- package/templates/features/payments/README.md +17 -0
- package/templates/features/payments/stripe.js +5 -0
- package/templates/features/payments/stripe.ts +5 -0
- package/templates/features/storage/README.md +12 -0
- package/templates/features/storage/storage.js +5 -0
- package/templates/features/storage/storage.ts +5 -0
- package/templates/nextjs/app/actions.js +6 -0
- package/templates/nextjs/app/actions.ts +6 -0
- package/templates/nextjs/app/examples-page.jsx +16 -0
- package/templates/nextjs/app/examples-page.tsx +16 -0
- package/templates/nextjs/app/layout.jsx +7 -0
- package/templates/nextjs/app/layout.tsx +7 -0
- package/templates/nextjs/app/page.jsx +12 -0
- package/templates/nextjs/app/page.tsx +12 -0
- package/templates/nextjs/next.config.js +4 -0
- package/templates/nextjs/next.config.ts +7 -0
- package/templates/shared/.editorconfig +8 -0
- package/templates/ui/antd.README.md +7 -0
- package/templates/ui/antd.theme.js +5 -0
- package/templates/ui/antd.theme.ts +7 -0
- package/templates/ui/button.jsx +13 -0
- package/templates/ui/button.tsx +13 -0
- package/templates/ui/chakra.README.md +7 -0
- package/templates/ui/chakra.theme.js +8 -0
- package/templates/ui/chakra.theme.ts +8 -0
- package/templates/ui/components.json +14 -0
- package/templates/ui/demo-antd.jsx +5 -0
- package/templates/ui/demo-antd.tsx +5 -0
- package/templates/ui/demo-chakra.jsx +5 -0
- package/templates/ui/demo-chakra.tsx +5 -0
- package/templates/ui/demo-mantine.jsx +5 -0
- package/templates/ui/demo-mantine.tsx +5 -0
- package/templates/ui/demo-mui.jsx +5 -0
- package/templates/ui/demo-mui.tsx +5 -0
- package/templates/ui/demo-nextui.jsx +5 -0
- package/templates/ui/demo-nextui.tsx +5 -0
- package/templates/ui/demo-shadcn.jsx +5 -0
- package/templates/ui/demo-shadcn.tsx +5 -0
- package/templates/ui/demo-tailwind.jsx +3 -0
- package/templates/ui/demo-tailwind.tsx +3 -0
- package/templates/ui/mantine.README.md +7 -0
- package/templates/ui/mantine.theme.js +3 -0
- package/templates/ui/mantine.theme.ts +3 -0
- package/templates/ui/mui.README.md +7 -0
- package/templates/ui/mui.theme.js +7 -0
- package/templates/ui/mui.theme.ts +7 -0
- package/templates/ui/nextui.README.md +7 -0
- package/templates/ui/nextui.theme.js +1 -0
- package/templates/ui/nextui.theme.ts +1 -0
- package/templates/ui/postcss.config.js +1 -0
- package/templates/ui/shadcn.README.md +1 -0
- package/templates/ui/styles.css +3 -0
- package/templates/ui/tailwind.config.js +6 -0
- package/templates/ui/utils.js +3 -0
- package/templates/ui/utils.ts +3 -0
- package/templates/vite/App.jsx +12 -0
- package/templates/vite/App.tsx +12 -0
- package/templates/vite/index.html +12 -0
- package/templates/vite/main.jsx +12 -0
- package/templates/vite/main.tsx +12 -0
- package/templates/vite/vite-env.d.ts +1 -0
- package/templates/vite/vite.config.ts +12 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { getServerSession } from 'next-auth';
|
|
2
|
+
import { authOptions } from '../../../auth/auth-options';
|
|
3
|
+
|
|
4
|
+
export default async function ProtectedPage() {
|
|
5
|
+
const session = await getServerSession(authOptions);
|
|
6
|
+
return (
|
|
7
|
+
<div>
|
|
8
|
+
<h1>Protected</h1>
|
|
9
|
+
<pre>{JSON.stringify(session, null, 2)}</pre>
|
|
10
|
+
</div>
|
|
11
|
+
);
|
|
12
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { getServerSession } from 'next-auth';
|
|
2
|
+
import { authOptions } from '../../../auth/auth-options';
|
|
3
|
+
|
|
4
|
+
export default async function ProtectedPage() {
|
|
5
|
+
const session = await getServerSession(authOptions);
|
|
6
|
+
return (
|
|
7
|
+
<div>
|
|
8
|
+
<h1>Protected</h1>
|
|
9
|
+
<pre>{JSON.stringify(session, null, 2)}</pre>
|
|
10
|
+
</div>
|
|
11
|
+
);
|
|
12
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { getServerSession } from 'next-auth';
|
|
2
|
+
import { authOptions } from './auth-options';
|
|
3
|
+
|
|
4
|
+
export default async function ProtectedPage() {
|
|
5
|
+
const session = await getServerSession(authOptions);
|
|
6
|
+
return (
|
|
7
|
+
<div>
|
|
8
|
+
<h1>Protected</h1>
|
|
9
|
+
<pre>{JSON.stringify(session, null, 2)}</pre>
|
|
10
|
+
</div>
|
|
11
|
+
);
|
|
12
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { getServerSession } from 'next-auth';
|
|
2
|
+
import { authOptions } from './auth-options';
|
|
3
|
+
|
|
4
|
+
export default async function ProtectedPage() {
|
|
5
|
+
const session = await getServerSession(authOptions);
|
|
6
|
+
return (
|
|
7
|
+
<div>
|
|
8
|
+
<h1>Protected</h1>
|
|
9
|
+
<pre>{JSON.stringify(session, null, 2)}</pre>
|
|
10
|
+
</div>
|
|
11
|
+
);
|
|
12
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export default function SignInPage() {
|
|
2
|
+
return (
|
|
3
|
+
<main>
|
|
4
|
+
<h1>Sign in</h1>
|
|
5
|
+
<p>
|
|
6
|
+
Use the default NextAuth sign-in:
|
|
7
|
+
<a href="/api/auth/signin"> /api/auth/signin</a>
|
|
8
|
+
</p>
|
|
9
|
+
<p>
|
|
10
|
+
Sign out:
|
|
11
|
+
<a href="/api/auth/signout"> /api/auth/signout</a>
|
|
12
|
+
</p>
|
|
13
|
+
</main>
|
|
14
|
+
);
|
|
15
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export default function SignInPage() {
|
|
2
|
+
return (
|
|
3
|
+
<main>
|
|
4
|
+
<h1>Sign in</h1>
|
|
5
|
+
<p>
|
|
6
|
+
Use the default NextAuth sign-in:
|
|
7
|
+
<a href="/api/auth/signin"> /api/auth/signin</a>
|
|
8
|
+
</p>
|
|
9
|
+
<p>
|
|
10
|
+
Sign out:
|
|
11
|
+
<a href="/api/auth/signout"> /api/auth/signout</a>
|
|
12
|
+
</p>
|
|
13
|
+
</main>
|
|
14
|
+
);
|
|
15
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# NextAuth
|
|
2
|
+
|
|
3
|
+
Files:
|
|
4
|
+
- `auth/auth-options.*` base config
|
|
5
|
+
- `app/api/auth/[...nextauth]/route.*` API route
|
|
6
|
+
- `auth/protected.*` example server component
|
|
7
|
+
|
|
8
|
+
Next steps:
|
|
9
|
+
- Add providers to `auth/auth-options.*`
|
|
10
|
+
- Set `NEXTAUTH_SECRET` and `NEXTAUTH_URL` in `.env`
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { createSupabaseServerClient } from '../../../src/lib/supabase-server';
|
|
2
|
+
|
|
3
|
+
export default async function ProtectedPage() {
|
|
4
|
+
const supabase = createSupabaseServerClient();
|
|
5
|
+
const { data } = await supabase.auth.getUser();
|
|
6
|
+
|
|
7
|
+
return (
|
|
8
|
+
<div>
|
|
9
|
+
<h1>Protected</h1>
|
|
10
|
+
<pre>{JSON.stringify(data, null, 2)}</pre>
|
|
11
|
+
</div>
|
|
12
|
+
);
|
|
13
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { createSupabaseServerClient } from '../../../src/lib/supabase-server';
|
|
2
|
+
|
|
3
|
+
export default async function ProtectedPage() {
|
|
4
|
+
const supabase = createSupabaseServerClient();
|
|
5
|
+
const { data } = await supabase.auth.getUser();
|
|
6
|
+
|
|
7
|
+
return (
|
|
8
|
+
<div>
|
|
9
|
+
<h1>Protected</h1>
|
|
10
|
+
<pre>{JSON.stringify(data, null, 2)}</pre>
|
|
11
|
+
</div>
|
|
12
|
+
);
|
|
13
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { createSupabaseServerClient } from '../src/lib/supabase-server';
|
|
2
|
+
|
|
3
|
+
export default async function ProtectedPage() {
|
|
4
|
+
const supabase = createSupabaseServerClient();
|
|
5
|
+
const { data } = await supabase.auth.getUser();
|
|
6
|
+
|
|
7
|
+
return (
|
|
8
|
+
<div>
|
|
9
|
+
<h1>Protected</h1>
|
|
10
|
+
<pre>{JSON.stringify(data, null, 2)}</pre>
|
|
11
|
+
</div>
|
|
12
|
+
);
|
|
13
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { createSupabaseServerClient } from '../src/lib/supabase-server';
|
|
2
|
+
|
|
3
|
+
export default async function ProtectedPage() {
|
|
4
|
+
const supabase = createSupabaseServerClient();
|
|
5
|
+
const { data } = await supabase.auth.getUser();
|
|
6
|
+
|
|
7
|
+
return (
|
|
8
|
+
<div>
|
|
9
|
+
<h1>Protected</h1>
|
|
10
|
+
<pre>{JSON.stringify(data, null, 2)}</pre>
|
|
11
|
+
</div>
|
|
12
|
+
);
|
|
13
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { useState } from 'react';
|
|
4
|
+
import { supabase } from '../../../src/lib/supabase';
|
|
5
|
+
|
|
6
|
+
export default function SignInPage() {
|
|
7
|
+
const [email, setEmail] = useState('');
|
|
8
|
+
const [password, setPassword] = useState('');
|
|
9
|
+
|
|
10
|
+
async function handleSubmit(e) {
|
|
11
|
+
e.preventDefault();
|
|
12
|
+
await supabase.auth.signInWithPassword({ email, password });
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<main>
|
|
17
|
+
<h1>Sign in</h1>
|
|
18
|
+
<form onSubmit={handleSubmit}>
|
|
19
|
+
<input value={email} onChange={(e) => setEmail(e.target.value)} placeholder="email" />
|
|
20
|
+
<input value={password} onChange={(e) => setPassword(e.target.value)} type="password" placeholder="password" />
|
|
21
|
+
<button type="submit">Sign in</button>
|
|
22
|
+
</form>
|
|
23
|
+
</main>
|
|
24
|
+
);
|
|
25
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { useState } from 'react';
|
|
4
|
+
import { supabase } from '../../../src/lib/supabase';
|
|
5
|
+
|
|
6
|
+
export default function SignInPage() {
|
|
7
|
+
const [email, setEmail] = useState('');
|
|
8
|
+
const [password, setPassword] = useState('');
|
|
9
|
+
|
|
10
|
+
async function handleSubmit(e: React.FormEvent) {
|
|
11
|
+
e.preventDefault();
|
|
12
|
+
await supabase.auth.signInWithPassword({ email, password });
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<main>
|
|
17
|
+
<h1>Sign in</h1>
|
|
18
|
+
<form onSubmit={handleSubmit}>
|
|
19
|
+
<input value={email} onChange={(e) => setEmail(e.target.value)} placeholder="email" />
|
|
20
|
+
<input value={password} onChange={(e) => setPassword(e.target.value)} type="password" placeholder="password" />
|
|
21
|
+
<button type="submit">Sign in</button>
|
|
22
|
+
</form>
|
|
23
|
+
</main>
|
|
24
|
+
);
|
|
25
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
import { supabase } from '../lib/supabase';
|
|
3
|
+
|
|
4
|
+
export function SupabaseSignIn() {
|
|
5
|
+
const [email, setEmail] = useState('');
|
|
6
|
+
const [password, setPassword] = useState('');
|
|
7
|
+
|
|
8
|
+
async function handleSubmit(e) {
|
|
9
|
+
e.preventDefault();
|
|
10
|
+
await supabase.auth.signInWithPassword({ email, password });
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
return (
|
|
14
|
+
<form onSubmit={handleSubmit}>
|
|
15
|
+
<input value={email} onChange={(e) => setEmail(e.target.value)} placeholder="email" />
|
|
16
|
+
<input value={password} onChange={(e) => setPassword(e.target.value)} type="password" placeholder="password" />
|
|
17
|
+
<button type="submit">Sign in</button>
|
|
18
|
+
</form>
|
|
19
|
+
);
|
|
20
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
import { supabase } from '../lib/supabase';
|
|
3
|
+
|
|
4
|
+
export function SupabaseSignIn() {
|
|
5
|
+
const [email, setEmail] = useState('');
|
|
6
|
+
const [password, setPassword] = useState('');
|
|
7
|
+
|
|
8
|
+
async function handleSubmit(e: React.FormEvent) {
|
|
9
|
+
e.preventDefault();
|
|
10
|
+
await supabase.auth.signInWithPassword({ email, password });
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
return (
|
|
14
|
+
<form onSubmit={handleSubmit}>
|
|
15
|
+
<input value={email} onChange={(e) => setEmail(e.target.value)} placeholder="email" />
|
|
16
|
+
<input value={password} onChange={(e) => setPassword(e.target.value)} type="password" placeholder="password" />
|
|
17
|
+
<button type="submit">Sign in</button>
|
|
18
|
+
</form>
|
|
19
|
+
);
|
|
20
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import mongoose from 'mongoose';
|
|
2
|
+
|
|
3
|
+
const MONGOOSE_URI = process.env.DATABASE_URL || '';
|
|
4
|
+
|
|
5
|
+
export async function connectMongoose() {
|
|
6
|
+
if (!MONGOOSE_URI) {
|
|
7
|
+
throw new Error('DATABASE_URL is not set');
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
if (mongoose.connection.readyState === 1) return;
|
|
11
|
+
|
|
12
|
+
await mongoose.connect(MONGOOSE_URI);
|
|
13
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import mongoose from 'mongoose';
|
|
2
|
+
|
|
3
|
+
const MONGOOSE_URI = process.env.DATABASE_URL || '';
|
|
4
|
+
|
|
5
|
+
export async function connectMongoose(): Promise<void> {
|
|
6
|
+
if (!MONGOOSE_URI) {
|
|
7
|
+
throw new Error('DATABASE_URL is not set');
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
if (mongoose.connection.readyState === 1) return;
|
|
11
|
+
|
|
12
|
+
await mongoose.connect(MONGOOSE_URI);
|
|
13
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import 'reflect-metadata';
|
|
2
|
+
import { DataSource } from 'typeorm';
|
|
3
|
+
import { User } from './entities/User';
|
|
4
|
+
|
|
5
|
+
const DATABASE_URL = process.env.DATABASE_URL || '';
|
|
6
|
+
|
|
7
|
+
export const AppDataSource = new DataSource({
|
|
8
|
+
type: '{{typeormType}}',
|
|
9
|
+
url: DATABASE_URL,
|
|
10
|
+
synchronize: false,
|
|
11
|
+
logging: false,
|
|
12
|
+
entities: [User],
|
|
13
|
+
migrations: ['{{migrationsPath}}'],
|
|
14
|
+
subscribers: []
|
|
15
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import 'reflect-metadata';
|
|
2
|
+
import { DataSource } from 'typeorm';
|
|
3
|
+
import { User } from './entities/User';
|
|
4
|
+
|
|
5
|
+
const DATABASE_URL = process.env.DATABASE_URL || '';
|
|
6
|
+
|
|
7
|
+
export const AppDataSource = new DataSource({
|
|
8
|
+
type: '{{typeormType}}',
|
|
9
|
+
url: DATABASE_URL,
|
|
10
|
+
synchronize: false,
|
|
11
|
+
logging: false,
|
|
12
|
+
entities: [User],
|
|
13
|
+
migrations: ['{{migrationsPath}}'],
|
|
14
|
+
subscribers: []
|
|
15
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import posthog from 'posthog-js';
|
|
2
|
+
|
|
3
|
+
export function initPosthog() {
|
|
4
|
+
if (typeof window === 'undefined') return;
|
|
5
|
+
const key = process.env.NEXT_PUBLIC_POSTHOG_KEY || '';
|
|
6
|
+
const host = process.env.NEXT_PUBLIC_POSTHOG_HOST || 'https://app.posthog.com';
|
|
7
|
+
if (!key) return;
|
|
8
|
+
posthog.init(key, { api_host: host });
|
|
9
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Email (Resend)
|
|
2
|
+
|
|
3
|
+
## Setup
|
|
4
|
+
1. Add RESEND_API_KEY to .env.
|
|
5
|
+
2. Client lives at src/lib/resend.ts.
|
|
6
|
+
|
|
7
|
+
## Example
|
|
8
|
+
```ts
|
|
9
|
+
import { resend } from '@/lib/resend';
|
|
10
|
+
|
|
11
|
+
await resend.emails.send({
|
|
12
|
+
from: 'you@example.com',
|
|
13
|
+
to: 'user@example.com',
|
|
14
|
+
subject: 'Welcome',
|
|
15
|
+
html: '<strong>Hello</strong>'
|
|
16
|
+
});
|
|
17
|
+
```
|