Skip to content
Rabat, Morocco
Projects

D&D Ecotourism & Real Estate – Multilingual Corporate Website

Cover for D&D Ecotourism & Real Estate – Multilingual Corporate Website
November 24, 2025
Most “multilingual websites” look fine until you add the third language, a couple of SEO requirements, and a contact flow that actually needs to be reliable. Then everything turns into brittle middleware rules, duplicated strings, and pages that don’t scale. For D&D Ecotourism & Real Estate, the goal was a platform that stays stable as content grows: type-safe translations, predictable routing, and server-side handling for lead capture (validation, delivery, and failure modes). The architecture was designed so adding a locale is a controlled change, not a rewrite. The frontend is the proof of full‑stack delivery: a fast, accessible UI on top of the routing/i18n foundation, while the backend-side integrations handle the real production needs (forms, email delivery, and SEO metadata).
  • Multi-language support: French, English, and Portuguese with seamless language switching
  • Type-safe translations: Custom TypeScript implementation ensuring compile-time type checking for translation keys, preventing runtime errors
  • Smart locale detection: Middleware-based routing that detects user language preferences via:
    • Browser Accept-Language headers
    • Cookie-based preference storage
    • Fallback to default locale
  • Dynamic routing: Locale-aware URL structure (
    /[locale]/page
    ) with automatic redirection
  • Server Components: Optimized server-side rendering for improved performance and reduced client-side JavaScript
  • Static Site Generation: Implemented
    generateStaticParams()
    for pre-rendering all locale variants at build time
  • Dynamic Metadata: SEO-optimized metadata generation per locale using
    generateMetadata()
    for improved search visibility
  • API Routes: RESTful API endpoints with proper error handling and validation
  • Strict type checking: Full type safety across the entire codebase with TypeScript 5 strict mode
  • Type-safe i18n: Custom translation system with TypeScript generics ensuring translation key validation at compile time
  • Type guards: Locale validation functions preventing runtime errors
  • Comprehensive typing: Well-structured type definitions for props, API responses, and configuration objects
  • Server-side form processing: Robust contact form API with comprehensive input validation
  • Email integration: Dual email sending (notification + confirmation) via Resend API
  • Error handling: Proper HTTP status codes and user-friendly error messages
  • Type-safe requests: Full TypeScript typing for API handlers and request/response objects
  • Next.js 16: App Router with Server Components, Middleware, and Static Site Generation
  • TypeScript 5: Strict mode enabled for maximum type safety
  • React 19: Modern React patterns with Server Components and Client Components
  • Tailwind CSS 4: Utility-first styling with responsive design and mobile-first approach
  • Resend API: Email service integration for contact form functionality
  • App Router with Server Components for performance-first rendering
  • Locale-aware routing and detection without fragile string parsing
  • Static generation and metadata for SEO across locales
  • API endpoints for form processing with validation and predictable responses
  • Strict type safety that catches translation mistakes at build time
  • A type-safe i18n system with generics and guards
  • Clear interfaces for routing, config, and server responses
  • Server Components by default, client-only where interactivity is needed
  • Async server rendering patterns for speed and simplicity
  • Minimal client state for language switching and UX polish
One of the main challenges was building a type-safe i18n system that would catch translation errors at compile time rather than runtime. This was solved by creating a custom TypeScript implementation using generics and type guards, ensuring that all translation keys are validated during development. Implementing middleware-based locale detection required careful consideration of user preferences, browser settings, and fallback mechanisms. The solution involved creating sophisticated routing logic that respects user choices while providing a seamless experience. Balancing server-side rendering with client-side interactivity required strategic use of Server Components and Client Components. This led to significant performance improvements while maintaining a responsive user experience. Building robust API endpoints with proper validation, error handling, and email integration required careful attention to security and user experience. The implementation includes comprehensive input validation and appropriate HTTP status codes.
  1. Built a production-ready multilingual website with seamless language switching and intelligent locale detection
  2. Implemented a type-safe i18n system preventing translation errors at compile time, reducing bugs and improving developer experience
  3. Created intelligent routing middleware that enhances user experience through automatic locale detection based on browser preferences
  4. Developed a robust API with proper validation, error handling, and email integration
  5. Optimized for performance using Next.js static generation and server components, resulting in fast page loads
  6. Ensured type safety throughout the entire application with strict TypeScript, catching errors before deployment
  • Next.js: App Router, Server Components, Middleware, API Routes, Static Generation, Dynamic Routing
  • TypeScript: Type Safety, Generics, Type Guards, Interface Design, Strict Mode, Type Inference
  • React: Server Components, Client Components, Hooks, Modern Patterns, Async Components
  • Web Development: RESTful APIs, Form Handling, Email Integration, SEO Optimization, Responsive Design
  • Architecture: Scalable Code Structure, Separation of Concerns, Best Practices, Performance Optimization
src/
├── app/
│   ├── [locale]/          # Locale-based routing
│   │   ├── page.tsx       # Homepage (Server Component)
│   │   ├── about/         # About page
│   │   ├── projects/      # Projects showcase
│   │   ├── ecotourism/    # Ecotourism information
│   │   ├── contact/       # Contact form
│   │   ├── privacy/       # Privacy policy
│   │   └── terms/         # Terms of service
│   ├── api/
│   │   └── contact/       # Contact form API endpoint
│   └── components/        # Reusable components
├── i18n/
│   ├── config.ts          # Locale configuration
│   ├── index.ts           # Translation system
│   └── translations/      # Translation files (fr, en, pt)
└── middleware.ts          # Locale detection middleware

D&D Ecotourism & Real Estate – Multilingual Corporate Website gallery image 1