A Next.js 14 website for MSG91 with localized data, MDX-powered blog, Tailwind CSS + DaisyUI styling, and widget/analytics integrations.
- Next.js 14 (React 18)
- Tailwind CSS + DaisyUI
- SCSS partials
- MDX via
next-mdx-remote - Utilities:
axios,date-fns,react-icons,react-toastify, etc. - Husky + lint-staged + Prettier for pre-commit formatting
- Node.js ≥ 18
- npm ≥ 10
-
Copy environment variables:
- Duplicate
.env.example→.envand fill values (see Environment Variables below).
- Duplicate
-
Install dependencies:
npm install
-
Run the dev server (port 3030):
npm run dev
-
Production build and run:
npm run build npm start
Serves the production build on port 3030.
npm run dev— Start dev server on 3030npm run build— Production buildnpm start— Serve production build on 3030npm run lint— Next.js lintnpm run prepare— Setup Husky
Configured in next.config.mjs and injected into the app:
-
URLs
BASE_URLAPI_BASE_URLREDIRECT_URLPRICING_URLSUBSCRIPTION_PRICING_URLVOICE_API_URLLOGIN_URLCHATBOT_BASE_URLHELLO_API_URLCHATBOT_TEMPLATE_TEST_URLWHATSAPP_PRICING_URL
-
Client IDs
GOOGLE_CLIENT_IDZOHO_CLIENT_IDGITHUB_CLIENT_IDMSAL_CLIENT_ID
-
Widget Config
OTP_WIDGET_TOKENWIDGET_AUTH_TOKENWIDGET_SCRIPT
-
Chat Widget
CHAT_WIDGET_TOKENECOMMERCE_WIDGET_TOKENCHAT_WIDGET_URL
Notes:
next.config.mjsloads.envusingdotenv. Values are read fromprocess.envor the.envfile.- Some pages like
src/pages/404.jsinject Google Tag Manager and Microsoft Clarity. - SEO robots meta toggles based on
BASE_URL(non-production addsnoindex,nofollow).
src/pages/— Routes (e.g.,src/pages/404.js)src/components/— Reusable UI componentssrc/data/— Localized JSON content- Country folders:
src/data/in/,src/data/gb/,src/data/ph/,src/data/global/, etc. - Example:
src/data/global/home.json
- Country folders:
_posts/blog/— MDX blog postspublic/— Static assets (images, icons, scripts)src/styles/— SCSS partials and custom stylesjsconfig.json— Path alias@/*→src/*
- Tailwind configured in
tailwind.config.js - DaisyUI theme
msg91with brand colors - PostCSS config in
postcss.config.mjs - SCSS partials in
src/styles/
- MDX files under
_posts/blog/*.mdx - Parsed via
next-mdx-remote - Code highlighting supported via
prismjs/react-syntax-highlighter(as used in components/pages)
- Static assets in
public/ - External image domains configured in
next.config.mjs(images.domains, e.g.,placehold.co)
- Prettier config at
.prettierrc.json - Husky + lint-staged formats staged files on commit:
*.{js,jsx,ts,tsx,md,mdx,html,css}→prettier --write
- Build:
npm run build - Serve:
npm start - Set required environment variables in your hosting platform (Vercel/Netlify/Render/PM2/etc.)
- For SEO: set
BASE_URL=https://msg91.comin production to enable indexing.
- Google Tag Manager and Microsoft Clarity are injected on pages like
src/pages/404.js - Chat and OTP widgets configured with the environment variables listed above
- Verify correct script URLs and tokens for production
- Port 3030 already in use: Stop the conflicting process or change script port.
- Env vars not applied: Ensure
.envexists and server restarted; set envs in hosting platform for prod. - External images blocked: Add the domain to
images.domainsinnext.config.mjs.
Proprietary. All rights reserved.
- Branch from
main - Ensure formatting passes (pre-commit hooks)
- Open a PR with description and testing notes