How r4m21/balaji-decor-website works
Project type & purpose (from file tree + README)
This is a Next.js (App Router) web application that looks like a marketing/lead-generation site for a service business:
• User-facing pages:
• Home: app/page.tsx
• Service detail pages: app/services/[slug]/page.tsx + lib/services.ts
• Location pages: app/locations/[slug]/page.tsx + lib/locations.ts
• Thank-you page: app/thank-you/page.tsx
• SEO endpoints: app/sitemap.ts, app/robots.ts
• Error handling: app/error.tsx, app/not-found.tsx
• Lead capture + messaging integrations:
• Contact endpoint: app/api/contact/route.ts (likely used by components/sections/ContactForm.tsx)
• WhatsApp webhook: app/api/whatsapp/webhook/route.ts (incoming messages/events from WhatsApp provider)
• Shared “backend-ish” utilities in lib/:
• lib/db.ts (persistence)
• lib/mailer.ts (email sending)
• lib/recaptcha.ts (bot protection)
• lib/rate-limit.ts (abuse protection)
• lib/whatsapp.ts, lib/whatsapp-templates.ts (WhatsApp integration)
• lib/env.ts, lib/config.ts (configuration)
the frontend UI (pages/components), and
2) backend API routes (contact + WhatsApp webhook) that integrate with external services and storage.
Server/API layer (still inside the same Next.js app)
• app/api/contact/route.ts
• app/api/whatsapp/webhook/route.ts
Domain/config/integration layer
• lib/* as internal services:
• Persistence: lib/db.ts
• Email: lib/mailer.ts
• WhatsApp: lib/whatsapp.ts, lib/whatsapp-templates.ts
• Security: lib/rate-limit.ts, lib/recaptcha.ts
• Data sources for dynamic routes: lib/services.ts, lib/locations.ts
• Configuration: lib/env.ts, lib/config.ts
Platform/build/deploy
• Next.js config: next.config.ts
• Styling/build: tailwind.config.ts, postcss.config.mjs, styles/globals.css
• TypeScript: tsconfig.json, global.d.ts, types/*
• Hosting implied by README: Vercel (or any Node runtime)
Next.js App (Vercel/Node runtime)
• App Router Pages (app/*)
• API Routes (app/api/*)
External services
• Email provider (SMTP/API) used by lib/mailer.ts
• Google reCAPTCHA (or similar) used by lib/recaptcha.ts
• WhatsApp Cloud API / WhatsApp provider used by lib/whatsapp.ts
API route calls
• lib/rate-limit.ts (prevent spam)
• lib/recaptcha.ts (verify human)
• lib/mailer.ts (send lead email)
• lib/db.ts (store lead, if implemented)
• ContactForm.tsx → /api/contact
• /api/contact → rate-limit → (allow/deny)
• /api/contact → recaptcha → reCAPTCHA external API
• /api/contact → mailer → Email provider
• /api/contact → db → Database
Webhook route calls
• lib/whatsapp.ts (signature validation / parsing / sending replies)
• lib/whatsapp-templates.ts (message templates)
• optionally lib/db.ts (store conversations/events)
• WhatsApp Provider → /api/whatsapp/webhook
• /api/whatsapp/webhook → whatsapp.ts → (optional outbound) WhatsApp Cloud API
• /api/whatsapp/webhook → db
SEO/metadata flows (often omitted, but this repo has explicit files)
• Search engine crawlers → app/sitemap.ts, app/robots.ts
Architectural patterns to highlight
• Monolith-but-layered Next.js app: UI + API routes in one deployable unit.
• App Router route-based architecture: folders map to routes (app/services/[slug], app/api/...).
• Integration adapters in lib/:
• mailer.ts as an outbound adapter
• whatsapp.ts as an inbound/outbound adapter
• db.ts as persistence adapter
• Cross-cutting concerns centralized:
• env.ts/config.ts for configuration
• rate-limit.ts and recaptcha.ts for security/abuse prevention
• shared modules shown as sub-components used by multiple routes
UI Routes
• app/layout.tsx (shell)
• app/page.tsx (home)
• app/services/[slug]/page.tsx (service detail)
• app/locations/[slug]/page.tsx (location detail)
• app/thank-you/page.tsx
• app/sitemap.ts, app/robots.ts
• app/error.tsx, app/not-found.tsx
UI Building Blocks
• components/sections/ContactForm.tsx (ties to /api/contact)
• components/ui/FloatingButtons.tsx (likely triggers WhatsApp/phone CTA)
• components/providers/ThemeProvider.tsx
API Entry Points
• app/api/contact/route.ts
• app/api/whatsapp/webhook/route.ts
Internal Services
• lib/env.ts + lib/config.ts
• lib/rate-limit.ts
• lib/recaptcha.ts
• lib/mailer.ts
• lib/db.ts
• lib/whatsapp.ts + lib/whatsapp-templates.ts
• lib/services.ts + lib/locations.ts
External Dependencies
• Database service
• Email service
• Google reCAPTCHA
• WhatsApp provider / WhatsApp Cloud API