π Automated Advertising Agent Landing Pages with A/B Testing
A modern, high-performance landing page system built for Soku AI - the one-stop automated advertising agent that automates your entire marketing team. Features comprehensive A/B testing capabilities, real-time analytics, and conversion tracking.
Note: This project has been simplified by removing middleware and security configurations for easier setup and maintenance.
- π― Dual Landing Page Variants - Professional vs. Urgency-driven approaches
- π Real-time A/B Testing - Live conversion tracking and analytics dashboard
- β‘ High Performance - Built with Next.js 14, optimized for speed
- π¨ Modern UI/UX - Responsive design with Tailwind CSS and Framer Motion
- π Analytics Integration - Comprehensive user behavior tracking
- π§ Developer Experience - TypeScript, oxlint, Prettier, and modern tooling
- Framework: Next.js 14 with App Router
- Language: TypeScript
- Styling: Tailwind CSS
- Animations: Framer Motion
- Linting: oxlint (replacing ESLint for better performance)
- Formatting: Prettier
- Package Manager: Yarn 4 (Berry) with PnP
- Icons: Lucide React
- State Management: React Hooks
- Testing: Jest with Testing Library and comprehensive A/B testing suite
- A/B Testing: Cookie-based session management with variant assignment
- Node.js 18+
- Yarn 4 (automatically managed via packageManager field)
# Clone the repository
git clone [email protected]:JimmFly/jimmy-yang-frontend-interview.git
cd soku-ai-landing-pages
# Install dependencies
yarn install
# Start development server
yarn dev
# Development
yarn dev # Start development server at http://localhost:3000
yarn build # Build for production
yarn start # Start production server
# Code Quality
yarn lint # Run oxlint for code linting
yarn format # Format code with Prettier
yarn type-check # Run TypeScript type checking
yarn check-all # Run all checks (lint + format + type-check)
# Testing
yarn test # Run Jest tests (unit + integration)
yarn test:watch # Run tests in watch mode
yarn test --coverage # Run tests with coverage report
This project uses Yarn 4 (Berry) with Plug'n'Play (PnP) for faster installs and better dependency management.
- Zero Installs: Dependencies are stored in
.yarn/cache
- PnP Mode: No
node_modules
folder, faster resolution - Workspace Support: Ready for monorepo setup
- Better Security: Stricter dependency resolution
# Add a dependency
yarn add package-name
# Add a dev dependency
yarn add -D package-name
# Remove a dependency
yarn remove package-name
# Update dependencies
yarn up
# Check for outdated packages
yarn outdated
# Run scripts
yarn dev
yarn build
yarn test
The project features a comprehensive A/B testing system with two distinct landing page variants:
-
π’ Variant A (
/landing-a
) - Professional & Automation-Focused- Clean, corporate design
- Emphasizes automation and efficiency
- Trust-building elements and testimonials
- Detailed feature explanations
-
β‘ Variant B (
/landing-b
) - Aggressive & Urgency-Driven- Bold, high-contrast design
- Urgency-focused messaging
- Limited-time offers and scarcity tactics
- Action-oriented CTAs
- π Real-time Metrics: Visit
/analytics
to view live A/B test results - π Conversion Tracking: Monitor signup rates and user engagement
- π― Performance Comparison: Side-by-side variant performance analysis
- π± Device Analytics: Desktop vs. mobile conversion insights
- πͺ Cookie-based Sessions: Persistent user variant assignment using
js-cookie
- π² Configurable Traffic Split: Adjustable percentage allocation between variants
- π Session Management: Automatic session ID generation and variant persistence
- π§ͺ Comprehensive Testing: 27 test cases covering unit and integration scenarios
- π 100% Test Coverage: Complete coverage of A/B testing logic and edge cases
βββ app/ # Next.js 14 App Router
β βββ analytics/ # π A/B test analytics dashboard
β β βββ page.tsx # Analytics page with real-time metrics
β βββ api/ # π API routes
β β βββ analytics/ # Analytics API endpoints
β βββ landing-a/ # π’ Professional landing page variant
β β βββ page.tsx # Variant A implementation
β βββ landing-b/ # β‘ Urgency-driven landing page variant
β β βββ page.tsx # Variant B implementation
β βββ globals.css # Global styles and Tailwind imports
β βββ layout.tsx # Root layout component
β βββ page.tsx # Home page (redirects to variants)
βββ __tests__/ # π§ͺ Test suites
β βββ ab-testing.test.ts # Unit tests for A/B testing logic
β βββ ab-testing.integration.test.ts # Integration tests for complete user flows
βββ components/ # π§© Reusable React components
β βββ layout/ # Layout-specific components
β β βββ CTASection.tsx
β β βββ FeaturesSection.tsx
β β βββ Footer.tsx
β β βββ Header.tsx
β β βββ HeroSection.tsx
β βββ ui/ # UI components and primitives
βββ hooks/ # π£ Custom React hooks
β βββ useLandingPage.ts # Landing page logic and analytics
βββ lib/ # π Utility libraries and configurations
β βββ ab-testing.ts # A/B testing core logic and session management
β βββ analytics.ts # Analytics tracking utilities
β βββ ... # Other utility modules
βββ types/ # π TypeScript type definitions
βββ utils/ # π οΈ Helper functions and utilities
βββ .yarn/ # π¦ Yarn 4 cache and configuration
βββ .yarnrc.yml # Yarn configuration
βββ jest.config.js # Jest testing configuration
βββ jest.setup.js # Jest setup and global mocks
βββ oxlintrc.json # oxlint configuration
βββ tailwind.config.js # Tailwind CSS configuration
βββ yarn.lock # Dependency lock file
- nodeLinker:
pnp
- Use Plug'n'Play for faster installs - pnpMode:
loose
- Better compatibility with legacy packages - enableGlobalCache:
true
- Share cache across projects - packageManager: Automatically managed via package.json
Comprehensive testing setup for A/B testing and component testing:
- TypeScript support with SWC transformation
- Module path mapping for clean imports
- Coverage reporting with detailed metrics
- Mock setup for browser APIs and external dependencies
- Test environment configured for DOM testing
Replaced ESLint with oxlint for significantly better performance:
- 10-100x faster than ESLint
- Zero configuration required for most use cases
- TypeScript support out of the box
- React hooks and Next.js rules included
Create a .env.local
file for local development:
# Analytics Configuration
NEXT_PUBLIC_ANALYTICS_ENABLED=true
# Development Settings
NEXT_PUBLIC_DEV_MODE=true
# API Configuration (if needed)
# NEXT_PUBLIC_API_URL=http://localhost:3000/api
Comprehensive analytics system for monitoring A/B test performance:
- π Page Views: Track visits to each landing page variant
- π€ User Interactions: Monitor button clicks, form submissions, and scroll behavior
- π― A/B Test Assignment: Automatic variant assignment and tracking
- π° Conversion Tracking: Measure signup rates and conversion funnels
- β±οΈ Real-time Dashboard: Live metrics at
/analytics
- π± Device Analytics: Performance breakdown by device type
# Run all quality checks
yarn check-all
# Build the application
yarn build
# Start production server
yarn start
This project is optimized for deployment on:
- Vercel (Recommended) - Zero configuration deployment
- Netlify - Static site hosting with serverless functions
- Docker - Containerized deployment
- Setup:
yarn install
- Branch: Create a feature branch from
main
- Develop: Make your changes with
yarn dev
- Test: Write and run tests with
yarn test
- Quality: Run
yarn check-all
before committing - Coverage: Verify test coverage with
yarn test --coverage
- Build: Verify production build with
yarn build
- PR: Submit a pull request with clear description
- TypeScript: Strict type checking enabled
- oxlint: Fast linting with zero configuration
- Prettier: Consistent code formatting
- Conventional Commits: Use semantic commit messages
- π Landing Page A: http://localhost:3000/landing-a
- β‘ Landing Page B: http://localhost:3000/landing-b
- π Analytics Dashboard: http://localhost:3000/analytics
- π Next.js Documentation: https://nextjs.org/docs
- π¨ Tailwind CSS: https://tailwindcss.com/docs
- π§Ά Yarn 4 Documentation: https://yarnpkg.com/
- β‘ oxlint: 10-100x faster than ESLint
- π Next.js 14: Latest App Router with optimizations
- π¦ Yarn PnP: Zero-install, faster dependency resolution
- π― TypeScript: Full type safety and IntelliSense
- π¨ Tailwind CSS: Utility-first, optimized CSS
- π¬ Framer Motion: Smooth, performant animations
MIT License - see LICENSE file for details.
Built with β€οΈ for Soku AI - Automating your entire marketing team with AI-powered advertising agents.