create-next-mdx-blog-app 2.1.7 â 2.1.9
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 +38 -2
- package/package.json +3 -1
package/README.md
CHANGED
|
@@ -61,7 +61,7 @@ npx create-next-mdx-blog-app .
|
|
|
61
61
|
### Package Information
|
|
62
62
|
|
|
63
63
|
- **Package Name**: `create-next-mdx-blog-app`
|
|
64
|
-
- **Version**: `2.1.
|
|
64
|
+
- **Version**: `2.1.9`
|
|
65
65
|
- **License**: MIT
|
|
66
66
|
- **Homepage**: [https://www.npmjs.com/package/create-next-mdx-blog-app](https://www.npmjs.com/package/create-next-mdx-blog-app/)
|
|
67
67
|
|
|
@@ -172,6 +172,9 @@ A thin green bar (`src/components/ReadingProgressBar.tsx`) is fixed to the top o
|
|
|
172
172
|
### Back to Top Button
|
|
173
173
|
A floating circular button (`src/components/BackToTopButton.tsx`) appears in the bottom-right corner of the screen once the reader has scrolled more than 400px down the page. Clicking it smoothly scrolls back to the top. The button is hidden when not needed and matches the green colour scheme of the rest of the UI.
|
|
174
174
|
|
|
175
|
+
### Light / Dark Mode Toggle
|
|
176
|
+
A theme toggle button (`src/components/ThemeToggle.tsx`) is rendered in the site header, allowing readers to switch between **dark** (default) and **light** modes. Theme state is managed by `next-themes` via the `ThemeProvider` wrapper (`src/components/ThemeProvider.tsx`) mounted in the root layout. The active theme is persisted to `localStorage` automatically. Toast notifications use `ThemedToaster` (`src/components/ThemedToaster.tsx`), a thin wrapper around `sonner` that picks the correct Sonner theme to match the active colour scheme.
|
|
177
|
+
|
|
175
178
|
### View Counter
|
|
176
179
|
Each article page displays a live view count stored in a dedicated `view_counts` Supabase table, incremented atomically via the `increment_view_count` RPC function. Dynamic pages increment server-side at render time; static pages use a `ViewCounter` client component that calls the `/api/views/[slug]` Route Handler after hydration.
|
|
177
180
|
|
|
@@ -216,6 +219,35 @@ The project includes an interactive AI-powered chatbot optimised for readers of
|
|
|
216
219
|
### API Route
|
|
217
220
|
`src/app/api/chat/route.ts` â Next.js edge route. Accepts the `UIMessages` array, converts it to `CoreMessages` via `convertToModelMessages`, streams a response using `streamText` with the three blog tools, and returns `result.toTextStreamResponse()`.
|
|
218
221
|
|
|
222
|
+
## đŦ Newsletter Subscription
|
|
223
|
+
The project ships with an integrated **newsletter signup form** powered by [Resend](https://resend.com). Visitors can subscribe from the home page or from the bottom of any article; new subscribers are added to a Resend **Audience** and immediately receive a welcome email.
|
|
224
|
+
|
|
225
|
+
### Components & Routes
|
|
226
|
+
- `src/components/NewsletterSignup.tsx` â reusable client component with `matrix` (article pages, glass-card + green) and `neutral` (home page, white/black/silver shadcn) visual variants.
|
|
227
|
+
- `src/app/api/newsletter/subscribe/route.ts` â Node-runtime POST handler; validates the email with Zod and forwards it to the Resend SDK.
|
|
228
|
+
- `src/utils/functions/newsletter/subscribeToNewsletter.ts` â server-side helper that adds the contact to your Resend Audience and triggers the welcome email.
|
|
229
|
+
- `src/utils/functions/newsletter/welcomeEmailTemplate.ts` â builds the subject + HTML/text bodies for the confirmation email.
|
|
230
|
+
- `src/utils/functions/resend_client/ResendClient.ts` â server-only Resend client factory.
|
|
231
|
+
|
|
232
|
+
### Setup Steps
|
|
233
|
+
1. Create a Resend account at [resend.com](https://resend.com).
|
|
234
|
+
2. **API Key** â go to **API Keys â Create API Key** and grant it access to **Sending** and **Audiences**. Copy the key into `RESEND_API_KEY` in `.env.local`.
|
|
235
|
+
3. **Audience** â go to **Audiences â Create Audience**, give it a name, and copy the generated UUID into `RESEND_AUDIENCE_ID` in `.env.local`.
|
|
236
|
+
4. Restart `npm run dev` after editing `.env.local` so Next.js picks up the new variables.
|
|
237
|
+
|
|
238
|
+
### Environment Variables
|
|
239
|
+
| Variable | Required for |
|
|
240
|
+
|---|---|
|
|
241
|
+
| `RESEND_API_KEY` | Authenticating with the Resend API |
|
|
242
|
+
| `RESEND_AUDIENCE_ID` | The Resend Audience that new subscribers are added to |
|
|
243
|
+
|
|
244
|
+
### â ī¸ ***Important: A verified sending domain on Resend is required for the email-sending feature to fully work.***
|
|
245
|
+
Out of the box the welcome email is sent from **`onboarding@resend.dev`**, which is Resend's sandbox sender. **`onboarding@resend.dev` is only allowed to deliver to the email address that owns your Resend account** â sending to any other recipient will be rejected by Resend.
|
|
246
|
+
|
|
247
|
+
> đ¨ ***You MUST set up and verify your own sending domain on Resend (Resend dashboard â Domains â Add Domain, then complete the SPF / DKIM DNS records) before the newsletter can deliver welcome emails to real subscribers.*** Once your domain is verified, update the `WELCOME_EMAIL_FROM` constant in `src/utils/functions/newsletter/subscribeToNewsletter.ts` to an address on that domain (for example `newsletter@yourdomain.com`).
|
|
248
|
+
|
|
249
|
+
If the domain step is skipped, the contact will still be added to your Resend Audience, but the welcome email will silently fail (the failure is logged to the server console as `[newsletter] Resend emails.send returned an error: ...`).
|
|
250
|
+
|
|
219
251
|
## đ§Š Constants, Functions, & Types
|
|
220
252
|
In this project, you will find custom constants, functions, and types in the `/src/utils/` directory. Certain constants serve as placeholders in this demo application.
|
|
221
253
|
|
|
@@ -241,6 +273,8 @@ cp .env.example .env.local
|
|
|
241
273
|
| `GITHUB_TOKEN` | GitHub API authentication for `<GitHubGist>` â optional but raises rate limit from 60 to 5,000 req/hr |
|
|
242
274
|
| `GITHUB_USERNAME` | Your GitHub username, used to construct the mdxgists.net URL (defaults to `CodingAbdullah`) |
|
|
243
275
|
| `GIST_BASE_URL` | Base URL for mdxgists.net links (defaults to `https://mdxgists.net`) |
|
|
276
|
+
| `RESEND_API_KEY` | Newsletter signup â authenticates with the Resend API (see the **Newsletter Subscription** section below) |
|
|
277
|
+
| `RESEND_AUDIENCE_ID` | Newsletter signup â the Resend Audience that new subscribers are added to |
|
|
244
278
|
|
|
245
279
|
```
|
|
246
280
|
# .env.local
|
|
@@ -250,6 +284,8 @@ ANTHROPIC_API_KEY=
|
|
|
250
284
|
GITHUB_TOKEN=
|
|
251
285
|
GITHUB_USERNAME=
|
|
252
286
|
GIST_BASE_URL=
|
|
287
|
+
RESEND_API_KEY=
|
|
288
|
+
RESEND_AUDIENCE_ID=
|
|
253
289
|
```
|
|
254
290
|
|
|
255
291
|
## đŠī¸ AWS
|
|
@@ -267,7 +303,7 @@ docker build -t mdx-medium-blog .
|
|
|
267
303
|
``
|
|
268
304
|
|
|
269
305
|
``
|
|
270
|
-
docker run -e SUPABASE_URL=your_supabase_url \ -e SUPABASE_ANON_KEY=your_supabase_anon_key \ -e ANTHROPIC_API_KEY=your_anthropic_api_key \ -e GITHUB_TOKEN=your_github_token \ -e GITHUB_USERNAME=your_github_username \ -e GIST_BASE_URL=https://mdxgists.net \ -p 3000:3000 mdx-medium-blog
|
|
306
|
+
docker run -e SUPABASE_URL=your_supabase_url \ -e SUPABASE_ANON_KEY=your_supabase_anon_key \ -e ANTHROPIC_API_KEY=your_anthropic_api_key \ -e GITHUB_TOKEN=your_github_token \ -e GITHUB_USERNAME=your_github_username \ -e GIST_BASE_URL=https://mdxgists.net \ -e RESEND_API_KEY=your_resend_api_key \ -e RESEND_AUDIENCE_ID=your_resend_audience_id \ -p 3000:3000 mdx-medium-blog
|
|
271
307
|
``
|
|
272
308
|
|
|
273
309
|
## đ CRUD Operations and Supabase Actions
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-next-mdx-blog-app",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.9",
|
|
4
4
|
"description": "A production-ready technical blog starter kit built with Next.js, MDX, Supabase, and TypeScript.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Abdullah Muhammad",
|
|
@@ -71,9 +71,11 @@
|
|
|
71
71
|
"lucide-react": "^1.7.0",
|
|
72
72
|
"next": "^16.2.1",
|
|
73
73
|
"next-mdx-remote": "^6.0.0",
|
|
74
|
+
"next-themes": "^0.4.6",
|
|
74
75
|
"react": "^19.2.4",
|
|
75
76
|
"react-dom": "^19.2.4",
|
|
76
77
|
"react-syntax-highlighter": "^16.1.1",
|
|
78
|
+
"resend": "^6.12.2",
|
|
77
79
|
"sonner": "^2.0.7",
|
|
78
80
|
"tailwind-merge": "^3.5.0",
|
|
79
81
|
"tailwindcss": "^4",
|