Skip to content

mDesk-Tech/mdesk.tech

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

323 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mdesk.tech — Designing and hosting your digital future

Modern website built with Next.js 16, React 19, and Tailwind CSS 4. It features server components, dynamic streaming, sleek UI components, and a production‑ready contact workflow with Discord notifications and MongoDB‑backed rate limiting.

GitHub Copilot is used to help optimize page performance

Live site: mdesk.tech

Requirements

  • Node.js 20+
  • pnpm (project is pinned to pnpm via packageManager)

Quick Start

# 1) Enable corepack (recommended to match the pinned pnpm version)
corepack enable

# 2) Install dependencies
pnpm install

# 3) Configure environment
cp .env.example .env
# Then edit .env with your values (see Environment below)

# 4) Run the dev server (Turbopack)
pnpm dev
# Open http://localhost:3000

Environment Define these variables in .env:

  • DISCORD_WEBHOOK_URL: Discord webhook to receive contact submissions (required for POST /api/contact)
  • MONGODB_URI: Connection string used for IP‑based rate limiting (required if using contact form)
  • NEXT_PUBLIC_SITE_URL: Base site URL for canonical/OG metadata (e.g. http://localhost:3000 in dev)
  • NEXT_PUBLIC_GA_ID: Optional GA4 Measurement ID (loads only in production)

Notes

  • If DISCORD_WEBHOOK_URL or MONGODB_URI are missing, the contact endpoint will return an error when called.
  • The rate‑limit window is 1 hour per IP and uses a TTL index in MongoDB (lib/db.ts).

Scripts

  • pnpm dev — Start dev server with Turbopack
  • pnpm build — Production build with Turbopack
  • pnpm start — Start production server
  • pnpm lint — Run ESLint
  • pnpm prettier — Format with Prettier
  • pnpm check-types — Type‑check with TypeScript
  • pnpm prepare — Initialize Husky (run once after install, if needed)

Pre‑commit

  • .husky/pre-commit runs pnpm check-types && pnpm lint-staged
  • lint-staged formats and fixes staged files

Project Structure

API

  • POST /api/contact (file: app/api/contact/route.ts)

    • Body: { name: string; email: string; subject?: string; message: string; isOpenSourceForm?: boolean }
  • Rate limit: 1 request per IP per hour (MongoDB TTL index)

  • Side effect: sends a Discord embed to DISCORD_WEBHOOK_URL

  • Responses: 200 { success: true }, 429 { error, message }, 400/500 { error }

SEO & Analytics

Styling & UI

Deployment

  • recommended: vercel
    • set the same environment variables in your vercel project
    • ensure a mongodb instance is reachable from your deployment if using the contact form
    • build command uses turbopack by default. if you hit issues, try removing --turbopack from scripts

Troubleshooting

  • discord webhook errors: verify discord_webhook_url and webhook permissions
  • MongoDB connection errors: Verify MONGODB_URI and network access; the TTL index is created automatically
  • GA not reporting: Ensure NEXT_PUBLIC_GA_ID is defined; analytics load only in production

Contributing

  • Fork and create a feature branch
  • Run pnpm check-types, pnpm lint, and pnpm prettier before opening a PR
  • Thanks to Renovate (renovate.json) for automated dependency updates

License

Acknowledgements

  • Next.js, React, Tailwind CSS, Vercel Analytics/SI
  • lucide-react, motion, and other open‑source libraries listed in package.json

About

Page of mdesk.tech

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors