A modern, scalable e-commerce platform for Campana Ranch Wines, built with Next.js 14+, TypeScript, and a modular monolith architecture. Integrates with Commerce7 for wine commerce and supports free CMS options like Strapi.
This project implements a modular monolith architecture, providing:
- Clear module boundaries with defined interfaces
- Shared kernel for common functionality
- Event-driven inter-module communication
- Ready for microservices migration if needed
- Catalog: Wine product management and display
- Commerce: Commerce7 integration, cart, and checkout
- Content: CMS integration for pages and blog
- Club: Wine club management
- Customer: Authentication and user profiles
- Events: Event management and bookings
- Analytics: Tracking and reporting
- Node.js 18+ and npm
- Commerce7 account (for e-commerce functionality)
- Strapi instance (optional, for CMS)
- Clone the repository:
git clone https://github.com/your-org/campana-ranch-wines.git
cd campana-ranch-wines- Install dependencies:
npm install- Set up environment variables:
cp .env.example .env.local-
Configure your
.env.localwith:- Commerce7 API credentials
- CMS API URL and token (if using Strapi)
- Other optional services
-
Run the development server:
npm run devOpen http://localhost:3000 to see the application.
campana-ranch-wines/
βββ src/
β βββ modules/ # Business modules
β β βββ catalog/ # Wine catalog
β β βββ commerce/ # E-commerce & checkout
β β βββ content/ # CMS content
β β βββ club/ # Wine club
β β βββ customer/ # User management
β β βββ events/ # Events & tastings
β β βββ analytics/ # Analytics tracking
β β
β βββ shared/ # Shared kernel
β β βββ components/ # Common UI components
β β βββ hooks/ # Shared React hooks
β β βββ utils/ # Utility functions
β β βββ types/ # Shared TypeScript types
β β βββ config/ # Configuration
β β
β βββ infrastructure/ # Technical infrastructure
β β βββ database/ # Database utilities
β β βββ cache/ # Caching layer
β β βββ monitoring/ # Logging & monitoring
β β
β βββ app/ # Next.js App Router
β βββ (public)/ # Public routes
β βββ (authenticated)/ # Protected routes
β βββ api/ # API routes
β
βββ tests/ # Test suites
βββ docs/ # Documentation
βββ public/ # Static assets
npm run dev # Start development server
npm run build # Build for production
npm run start # Start production server
npm run lint # Run ESLint
npm run type-check # TypeScript type checking
npm run format # Format code with Prettier
npm run test # Run tests
npm run analyze # Analyze bundle size- Create module directory structure:
mkdir -p src/modules/your-module/{api,components,data,domain,types}- Define the module's public API in
index.ts - Keep all internal logic private to the module
- Use the event bus for cross-module communication
Modules communicate via the event bus:
import { eventBus, ModuleEvents } from '@shared/utils/event-bus'
// Emit an event
eventBus.emit(ModuleEvents.WINE_ADDED_TO_CART, { wineId, quantity })
// Subscribe to events
eventBus.on(ModuleEvents.ORDER_PLACED, handleOrderPlaced)The Commerce module integrates with Commerce7 for:
- Product catalog sync
- Cart and checkout
- Customer management
- Wine club operations
- Order processing
Configure in .env.local:
NEXT_PUBLIC_COMMERCE7_API_URL=https://api.commerce7.com/v1
NEXT_PUBLIC_COMMERCE7_TENANT_ID=your-tenant-id
COMMERCE7_API_KEY=your-api-key
The Content module can integrate with Strapi for:
- Page content management
- Blog posts
- Event listings
- Media management
Configure in .env.local:
NEXT_PUBLIC_CMS_API_URL=http://localhost:1337
CMS_API_TOKEN=your-strapi-token
The project uses Tailwind CSS with custom wine-themed configuration:
- Custom color palette (wine, cream, gold)
- Typography presets
- Animation utilities
- Responsive design system
- Push to GitHub
- Import project in Vercel
- Configure environment variables
- Deploy
docker build -t campana-ranch-wines .
docker run -p 3000:3000 campana-ranch-wines- Modular architecture for code splitting
- Image optimization with Next.js Image
- API response caching
- Static page generation where possible
- Progressive Web App capabilities
- Environment variables for sensitive data
- API route protection
- Input validation
- CORS configuration
- Rate limiting on API routes
npm run test:unit # Unit tests
npm run test:integration # Integration tests
npm run test:e2e # End-to-end tests- Fork the repository
- Create a feature branch
- Make your changes
- Write/update tests
- Submit a pull request
Copyright Β© 2024 Campana Ranch Wines. All rights reserved.
For issues and questions:
- Create an issue on GitHub
- Contact: dev@campanaranchwines.com
Built with β€οΈ using Next.js, TypeScript, and modular architecture principles.