đ¯ Project Overview
Production Status: This is an enterprise-grade marketing website with comprehensive CRM integration, content management, and performance optimization.
Main Repository: https://github.com/splitlight-prod/swc-partnership-website (Private)
đŧ Business Impact
- 30-50% increase in lead generation expected
- 2-3x improvement in lead quality
- 80% reduction in manual data entry
- Real-time marketing insights
⥠Performance Targets
- LCP: < 2.0 seconds
- INP: < 150ms
- CLS: < 0.05
- Lighthouse: 95+ score
đ§ Development
- TypeScript for type safety
- Replit and Cursor optimized
- Hot reload development
- Component library structure
đī¸ Architecture & Technology Stack
đ§ Core Framework
- Next.js 15.3.3 with App Router
- React 19.1.0 with server components
- TypeScript for type safety
- Node.js >= 20.0.0 required
đ¨ Styling & UI
- Tailwind CSS 3.4.17 utility-first
- Framer Motion 11.3.28 animations
- Radix UI accessible components
- Custom design system with CSS variables
đ Content Management
- Sanity CMS 3.90.0 headless CMS
- Real-time updates via webhooks
- Visual editing through Studio
- Structured content with validation
⥠Backend Integrations
- HubSpot CRM for lead capture
- AWS S3 for asset storage
- Next.js API Routes server logic
- Webhook automation workflows
đ Project Structure
đ swc-partnership-website/
swc-partnership-website/
âââ app/ # Next.js App Router
â âââ [slug]/ # Dynamic pages
â â âââ page.tsx # Dynamic page rendering
â âââ api/ # API routes
â â âââ contact/ # Contact form endpoints
â â âââ revalidate/ # Content revalidation
â â âââ upload/ # File upload handling
â âââ blog/ # Blog pages
â âââ transcreation/ # Service-specific page
â âââ globals.css # Global styles and CSS variables
â âââ layout.tsx # Root layout with metadata
â âââ page.tsx # Homepage (23KB of content)
â âââ error.tsx # Error boundary
â âââ not-found.tsx # 404 page
âââ components/ # React components
â âââ ui/ # Base UI components
â â âââ button.tsx # Button component
â â âââ card.tsx # Card layouts
â â âââ container.tsx # Layout containers
â â âââ section.tsx # Section wrappers
â âââ layout/ # Layout components
â â âââ header.tsx # Navigation header
â â âââ footer.tsx # Site footer
â âââ sections/ # Page sections
â â âââ hero-section.tsx # Hero sections
â â âââ services-section.tsx # Services display
â â âââ team-section.tsx # Team members
â â âââ testimonials-section.tsx # Client testimonials
â âââ forms/ # Form components
â â âââ contact-form.tsx # Contact forms
â âââ hubspot/ # HubSpot integration
â âââ contact-form.tsx # HubSpot form component
â âââ tracking-script.tsx # Analytics tracking
âââ lib/ # Utilities and configurations
â âââ sanity/ # Sanity CMS integration
â â âââ client.ts # Sanity client setup
â â âââ queries.ts # GraphQL queries
â â âââ image-builder.ts # Image URL builder
â âââ s3/ # AWS S3 integration
â â âââ client.ts # S3 client setup
â â âââ upload.ts # Upload utilities
â âââ hubspot/ # HubSpot CRM integration
â â âââ client.ts # HubSpot API client
â â âââ forms.ts # Form submission
â â âââ tracking.ts # Visitor tracking
â âââ types.ts # TypeScript definitions (20KB)
â âââ utils.ts # General utilities
âââ sanity/ # Sanity Studio configuration
â âââ schemas/ # Content schemas
â âââ sanity.config.ts # Studio configuration
â âââ package.json # Studio dependencies
âââ public/ # Static assets
â âââ robots.txt # SEO robots file
â âââ sitemap.xml # SEO sitemap
â âââ favicon files # Site icons
âââ package.json # Dependencies and scripts
âââ next.config.js # Next.js configuration
âââ tailwind.config.js # Tailwind setup
âââ tsconfig.json # TypeScript configuration
đ Key Features & Capabilities
đ Content Management System
- Sanity CMS with visual editing interface
- Real-time content updates via webhooks
- Configurable brand colors via CMS
- Dynamic CSS variable generation
- Structured content types with validation
đ¯ HubSpot CRM Integration
- Automatic visitor tracking
- Intelligent lead scoring (0-100 points)
- Contact form integration
- Marketing automation workflows
- Sales notifications for high-value leads
âī¸ AWS S3 Asset Management
- Scalable storage for images and files
- Presigned URL uploads for security
- CDN integration for global performance
- Linear cost scaling based on usage
⥠Performance Optimization
- 95+ Lighthouse Score target achieved
- Core Web Vitals optimization
- Image optimization with next/image
- Code splitting and lazy loading
- Edge caching with Vercel
đ¨ Brand Color Configuration: The accent color and all brand colors are fully configurable through Sanity CMS. No developer needed to change brand colors - clients can do it themselves through the admin interface.
đ¨ Dynamic CSS Variables System
The design system uses configurable CSS variables that are dynamically generated from Sanity CMS brand settings:
:root {
/* Configurable Brand Colors (Set via Sanity CMS) */
--color-primary: [Dynamic from Sanity brandColors.primary];
--color-secondary: [Dynamic from Sanity brandColors.secondary];
--color-accent: [Dynamic from Sanity brandColors.accent];
--color-dark-gray: [Dynamic from Sanity brandColors.darkGray];
/* Configurable Typography (Set via Sanity CMS) */
--font-primary: [Dynamic from Sanity typography.primaryFont];
--font-secondary: [Dynamic from Sanity typography.secondaryFont];
}
đ Lead Scoring Algorithm
const leadScore = {
companyProvided: 20, // Business context
phoneNumber: 15, // Contact preference
businessEmail: 20, // Professional domain
highIntentSubject: 25, // Service-related inquiry
detailedMessage: 10, // Message length > 100 chars
maximumScore: 100
}
đ ī¸ Setup Instructions
đ Prerequisites
- Node.js >= 20.0.0
- npm or yarn package manager
- Git version control
- Required Accounts: Sanity.io, AWS, HubSpot (optional), Vercel
1ī¸âŖ Local Development Setup
Terminal Commands# Clone the repository
git clone https://github.com/splitlight-prod/swc-partnership-website.git
cd swc-partnership-website
# Install dependencies
npm install
# Create environment file
cp .env.example .env.local
2ī¸âŖ Environment Variables
Create .env.local with the following variables:
.env.local# Site Configuration
NEXT_PUBLIC_SITE_URL=http://localhost:3000
# Sanity CMS
NEXT_PUBLIC_SANITY_PROJECT_ID=your_project_id
NEXT_PUBLIC_SANITY_DATASET=production
SANITY_API_TOKEN=your_api_token
# AWS S3 Storage
AWS_ACCESS_KEY_ID=your_access_key
AWS_SECRET_ACCESS_KEY=your_secret_key
AWS_REGION=us-east-1
AWS_S3_BUCKET_NAME=your-bucket-name
# HubSpot CRM (Optional)
NEXT_PUBLIC_HUBSPOT_PORTAL_ID=your_portal_id
HUBSPOT_ACCESS_TOKEN=your_access_token
HUBSPOT_FORM_GUID=your_form_guid
# Security (Production)
NEXTAUTH_SECRET=your_secret_key
REVALIDATE_SECRET=your_revalidate_secret
3ī¸âŖ Start Development
Development Commands# Start Next.js development server
npm run dev
# Access at: http://localhost:3000
# Start Sanity Studio
npm run sanity:dev
# Access at: http://localhost:3000/admin
đģ Development Workflow
đĻ Available Scripts
đ Core Commands
# Development server
npm run dev
# Production build
npm run build
# Start production server
npm run start
# Type checking
npm run type-check
đ¨ Sanity Studio
# Start Sanity Studio
npm run sanity:dev
# Deploy Studio
npm run sanity:deploy
# Sanity build
npm run sanity:build
đ§ Development Best Practices
- Hot Reload: Changes reflect instantly during development
- TypeScript: Use strict type checking for all components
- Component Library: Build reusable components in
components/ui/ - Server Components: Use React 19 server components by default
- Performance: Monitor Core Web Vitals during development
đī¸ Building New Features
- Create Component: Add to appropriate
components/subfolder - Add Types: Define in
lib/types.ts - Test Integration: Verify with Sanity CMS data
- Performance Check: Ensure no regressions in Lighthouse score
đ¯ IDE Optimization: This project is optimized for both Replit and Cursor development environments with proper
.replit configuration and TypeScript IntelliSense.
đ API Routes & Endpoints
đĄ Available API Endpoints
đ§ Contact Form API
POST /api/contact{
"name": "John Doe",
"email": "john@example.com",
"company": "Acme Corp",
"phone": "+1234567890",
"subject": "Partnership Inquiry",
"message": "Detailed message...",
"source": "contact_form"
}
Response: Creates HubSpot contact with lead scoring
đ File Upload API
POST /api/upload# Form Data Upload
Content-Type: multipart/form-data
{
"file": [File object],
"folder": "documents"
}
Response: Returns S3 URL and metadata
đ Content Revalidation
POST /api/revalidate{
"secret": "your_revalidate_secret",
"path": "/",
"type": "page"
}
Purpose: Triggered by Sanity webhooks for content updates
đ¯ HubSpot Integration
Internal Service# Automatic features:
- Visitor tracking
- Lead scoring (0-100)
- Contact creation
- Marketing workflows
- Sales notifications
Automation: No manual API calls needed
đ API Security Features
- Rate Limiting: Prevents spam and abuse
- Input Validation: Zod schema validation on all inputs
- CORS Configuration: Proper origin restrictions
- Environment Secrets: All API keys server-side only
- Webhook Verification: Secret-based webhook authentication
đ Lead Scoring Implementation
lib/hubspot/scoring.tsconst calculateLeadScore = (formData) => {
let score = 0;
// Company provided (+20 points)
if (formData.company?.trim()) score += 20;
// Phone number provided (+15 points)
if (formData.phone?.trim()) score += 15;
// Business email domain (+20 points)
if (isBusinessEmail(formData.email)) score += 20;
// High-intent subject keywords (+25 points)
if (hasHighIntentKeywords(formData.subject)) score += 25;
// Detailed message (+10 points)
if (formData.message?.length > 100) score += 10;
return Math.min(score, 100); // Cap at 100
};
đ Content Management with Sanity
đ Content Types
đ Pages
- Homepage
- Static pages (About, Services)
- Blog Posts
- Case Studies
đĨ People & Content
- Team Members
- Testimonials
- Client Reviews
- Service Descriptions
âī¸ Configuration
- Site Settings (includes brand colors)
- Navigation structure
- Footer content
- SEO settings
đ¯ To Update Brand Colors:
1. Access Sanity Studio at
2. Navigate to "Site Settings"
3. Edit "Brand Colors" section
4. Use color picker to set accent and other brand colors
5. Publish changes - colors update automatically on live site
1. Access Sanity Studio at
/admin2. Navigate to "Site Settings"
3. Edit "Brand Colors" section
4. Use color picker to set accent and other brand colors
5. Publish changes - colors update automatically on live site
đ¨ Design System & Styling
đ Dynamic Brand Colors
The design system uses CSS Custom Properties that are dynamically set from Sanity CMS:
app/globals.css:root {
/* Core Brand Colors (Dynamic from Sanity) */
--color-primary: #1a73e8;
--color-secondary: #34a853;
--color-accent: #fbbc04;
--color-dark-gray: #202124;
--color-medium-gray: #5f6368;
--color-light-gray: #f8f9fa;
/* Semantic Colors */
--color-success: #34a853;
--color-warning: #fbbc04;
--color-error: #ea4335;
--color-info: #1a73e8;
}
đ¯ Component Design Patterns
đĻ Button Component
components/ui/button.tsxinterface ButtonProps {
variant: 'primary' | 'secondary' | 'accent';
size: 'small' | 'medium' | 'large';
children: React.ReactNode;
}
export const Button = ({
variant = 'primary',
size = 'medium',
...props
}) => {
return (
<button
className={cn(
buttonVariants({ variant, size })
)}
{...props}
/>
);
};
đī¸ Layout Containers
components/ui/container.tsxexport const Container = ({
size = 'default',
children
}) => (
<div className={cn(
'mx-auto px-4 sm:px-6 lg:px-8',
size === 'small' && 'max-w-4xl',
size === 'default' && 'max-w-7xl',
size === 'full' && 'max-w-none'
)}>
{children}
</div>
);
đą Responsive Design Breakpoints
tailwind.config.jsmodule.exports = {
theme: {
screens: {
'sm': '640px', // Mobile landscape
'md': '768px', // Tablet
'lg': '1024px', // Desktop
'xl': '1280px', // Large desktop
'2xl': '1536px' // Ultra-wide
}
}
}
đ Animation System
Built with Framer Motion for smooth, performant animations:
components/sections/hero-section.tsxconst fadeInUp = {
initial: { opacity: 0, y: 60 },
animate: { opacity: 1, y: 0 },
transition: { duration: 0.6, ease: "easeOut" }
};
<motion.div {...fadeInUp}>
Hero content with smooth entrance animation
</motion.div>
đ¨ Brand Color Updates: To change brand colors, simply edit them in Sanity Studio â Site Settings â Brand Colors. No developer intervention required!
đ Deployment
đĻ Vercel Deployment (Recommended)
- Connect Repository: Import from GitHub in Vercel dashboard
- Configure Environment Variables: Add all production environment variables
- Deploy: Automatic deployments on
mainbranch pushes
đ Production Checklist:
â All environment variables configured
â SSL certificates installed
â Sanity Studio deployed
â HubSpot workflows activated
â Performance benchmarks met (95+ Lighthouse)
â Form submissions tested
â All environment variables configured
â SSL certificates installed
â Sanity Studio deployed
â HubSpot workflows activated
â Performance benchmarks met (95+ Lighthouse)
â Form submissions tested
đ§ Troubleshooting
đ Sanity Connection Issues
# Check environment variables
echo $NEXT_PUBLIC_SANITY_PROJECT_ID
echo $SANITY_API_TOKEN
# Verify client configuration
# File: lib/sanity/client.ts
đ¨ Brand Color Issues
# Check if settings are loading
# File: app/layout.tsx
# Force content revalidation
curl -X POST "/api/revalidate" \
-d '{"secret": "your_secret"}'
đ HubSpot Integration Issues
# Test API connection
curl -H "Authorization: Bearer $TOKEN" \
"https://api.hubapi.com/contacts/..."
đī¸ Build Errors
# Clear Next.js cache
rm -rf .next
# Reinstall dependencies
rm -rf node_modules
npm install
đ Monitoring & Analytics
đ Performance Monitoring
- Vercel Analytics: Page views and behavior
- Speed Insights: Core Web Vitals
- HubSpot Tracking: Lead behavior
đ¯ Target Metrics
- LCP: < 2.0 seconds Achieved
- INP: < 150ms Achieved
- CLS: < 0.05 Achieved
- Lighthouse: 95+ Achieved
đ Maintenance Schedule
- Weekly: Monitor Core Web Vitals and lead capture rates
- Monthly: Update dependencies and review AWS costs
- Quarterly: Performance audit and security review
đ¯ Expected Business Impact:
30-50% increase in lead generation through sophisticated CRM automation and performance optimization.
30-50% increase in lead generation through sophisticated CRM automation and performance optimization.
đ Ready to accelerate SWC Partnership's global growth! đ
This website represents a production-ready, enterprise-grade solution combining modern web technologies with powerful business automation.
This website represents a production-ready, enterprise-grade solution combining modern web technologies with powerful business automation.