- Next.js 14 - React framework for production-ready applications
- TypeScript - Static type-checking for JavaScript
- Tailwind CSS - A utility-first CSS framework
- Framer Motion - Animation library for React
- Lucide React - Beautiful & consistent icons
- Bun - A fast JavaScript runtime & package manager
- Auth0 - Authentication and authorization platform
- PostHog - Product analytics and feature flags
- Stripe - Payment processing
- React Hook Form - Forms with easy validation
- Zustand - State management
- React Hot Toast - Toast notifications
- React Markdown - Markdown to React component renderer
- Bun (latest version)
-
Install bun
macOS and Linux:
curl -fsSL https://bun.sh/install | bash
After installation, restart your terminal and verify:
bun --version
-
Clone the repository
git clone https://github.com/CambioML/CambioML.github.io cd CambioML.github.io
-
Install dependencies
bun install
-
Set up environment variables (see Environment Variables section below)
-
Start the development server
bun run dev
-
Open your browser and navigate to
http://localhost:3000
The application uses environment variables prefixed with NEXT_PUBLIC_
for client-side configuration. Create a .env.local
file in the project root with the following variables:
# Auth0 Configuration (required for authentication)
NEXT_PUBLIC_AUTH0_DOMAIN=your-auth0-domain.auth0.com
NEXT_PUBLIC_AUTH0_CLIENT_ID=your-auth0-client-id
# PostHog Analytics Configuration
NEXT_PUBLIC_POSTHOG_KEY=your-posthog-key
NEXT_PUBLIC_POSTHOG_HOST=https://app.posthog.com
# Google Tag Manager
NEXT_PUBLIC_GTM_ID=your-google-tag-manager-id
# API Endpoints
NEXT_PUBLIC_PLAYGROUND_API_URL=https://api.cambioml.com
NEXT_PUBLIC_PRE_PROD_PLAYGROUND_API_URL=https://preprod-api.cambioml.com
NEXT_PUBLIC_API_VERIFICATION_EMAIL_URL=https://api.cambioml.com/verification
# Stripe Configuration
NEXT_PUBLIC_STRIPE_SESSION_URL=https://api.cambioml.com/stripe/
NEXT_PUBLIC_STRIPE_RETURN_URL=https://www.cambioml.com/account
NEXT_PUBLIC_STRIPE_PORTAL_RETURN_URL=https://www.cambioml.com/account
# EmailJS Configuration
NEXT_PUBLIC_EMAILJS_PUBLIC_KEY=your-emailjs-public-key
NEXT_PUBLIC_EMAILJS_SERVICE_ID=your-emailjs-service-id
NEXT_PUBLIC_EMAILJS_TEMPLATE_ID=your-emailjs-template-id
NEXT_PUBLIC_EMAILJS_PLAYGROUND_TEMPLATE_ID=your-playground-template-id
# Calendly Integration
NEXT_PUBLIC_CALENDLY_URL=https://calendly.com/your-calendly-url
# OpenAI API (for AI features)
NEXT_PUBLIC_OPENAI_API_KEY=your-openai-api-key
The following environment variables are configured in the CI/CD pipeline but not actually used in the codebase:
# These can be removed from GitHub Actions secrets
NEXT_PUBLIC_GA_ID
NEXT_PUBLIC_OAUTH_GOOGLE_CLIENT_ID
NEXT_PUBLIC_AUTH0_REDIRECT_URI
NEXT_PUBLIC_PLAYGROUND_API_KEY
NEXT_PUBLIC_PRE_PROD_AUTH0_REDIRECT_URI
NEXT_PUBLIC_AWS_ACCESS_KEY
NEXT_PUBLIC_AWS_SECRET_KEY
NEXT_PUBLIC_AWS_REGION
NEXT_PUBLIC_LOGOUT_URL_PLAYGROUND
NEXT_PUBLIC_LOGOUT_URL_ACCOUNT_PRE_PROD
NEXT_PUBLIC_LOGOUT_URL_ACCOUNT
NEXT_PUBLIC_LOGOUT_URL_PLAYGROUND_PRE_PROD
NEXT_PUBLIC_API_KEY_ENDPOINT
NEXT_PUBLIC_STRIPE_SECRET_KEY
NEXT_PUBLIC_PRODUCT_AUTH0_REDIRECT_URI
Auth0 domain and client ID for user authentication and management. Used throughout the application for secure user login, registration, and session management.
// Used in: app/components/auth/LoginButton.tsx
const { loginWithPopup } = useAuth0();
loginWithPopup({
authorizationParams: {
scope: 'openid profile email',
},
});
PostHog project API key and instance URL for product analytics, user behavior tracking, and feature flags. Enables comprehensive user journey tracking and A/B testing capabilities.
// Used in: app/providers.tsx
posthog.init(process.env.NEXT_PUBLIC_POSTHOG_KEY!, {
api_host: process.env.NEXT_PUBLIC_POSTHOG_HOST,
person_profiles: 'identified_only',
capture_pageview: false,
});
Main API endpoint for the CambioML AnyParser playground and document processing features. Different environments use different API endpoints for development and production.
// Used in: app/components/playground/ProductionContext.tsx
const apiURL = isProduction
? process.env.NEXT_PUBLIC_PLAYGROUND_API_URL || ''
: process.env.NEXT_PUBLIC_PRE_PROD_PLAYGROUND_API_URL || '';
Authentication state is managed through:
app/components/auth/LoginButton.tsx
- Login interface with Auth0 integrationapp/components/auth/LogoutButton.tsx
- Logout functionalityapp/hooks/useUserProfile.ts
- User profile and session state management
PostHog provides comprehensive product analytics, user behavior tracking, and feature flags for data-driven decision making.
Caution
The PostHog API key is currently not working. Analytics tracking may be unavailable until the API key configuration is resolved.
- Event Tracking: Custom event tracking for user actions and feature usage
- User Identification: Authenticated user tracking with profile data
- Feature Flags: A/B testing and gradual feature rollouts
- Session Recording: User session analysis for UX optimization
PostHog is initialized as a React context provider in app/providers.tsx
:
import posthog from 'posthog-js';
import { PostHogProvider } from 'posthog-js/react';
if (typeof window !== 'undefined') {
posthog.init(process.env.NEXT_PUBLIC_POSTHOG_KEY!, {
api_host: process.env.NEXT_PUBLIC_POSTHOG_HOST,
person_profiles: 'identified_only',
capture_pageview: false, // Manual pageview capture
});
}
PostHog tracking is available throughout the application:
import { usePostHog } from 'posthog-js/react';
const posthog = usePostHog();
posthog.capture('user_action', {
feature: 'playground',
action: 'file_upload',
});
The application supports 22 languages with automated translation workflows and comprehensive localization features.
- How to Add a Blog Post - Complete guide for adding new blog posts
- How to Modify Page Content - Guide for updating existing page content
The project features automatic translation workflows that trigger when content is updated:
- Trigger: When English blog posts are added or modified in
blog/en/
- Workflow:
.github/workflows/translate-blog.yml
- Process:
- Detects changes to English blog posts in pull requests
- Automatically translates content to all 21 supported languages using Azure OpenAI
- Commits translated files back to the same pull request
- Adds a comment to the PR confirming completion
- Trigger: When English resources are updated in
resources/en/
- Workflow:
.github/workflows/translate-resources.yml
- Process: Similar to blog translation but for resource files
- Trigger: When
lib/translations/en.ts
is modified in pull requests - Workflow:
.github/workflows/check-translations.yml
- Script:
scripts/i18n-diff-checker.ts
- Process:
- Analyzes changes in the English translation properties using git diff
- Identifies which specific translation keys were added, modified, or deleted
- Reports property changes in GitHub status checks and PR comments
- Validates that all corresponding language files are complete and up-to-date
- Blocks deployment if translations are incomplete
The enhanced translation check workflow ensures comprehensive multilingual support:
- File Coverage: Verifies all TypeScript translation files exist (
lib/translations/{lang}.ts
) - Content Coverage: Checks blog posts and resources in all supported languages
- Property Tracking: Uses intelligent diff analysis to detect translation property changes
- Automated Reporting: Provides detailed feedback on missing translations and property changes
# Translate TypeScript interface files
bun run translate
# Check for translation property changes
bun run translate:diff
# Translate blog posts to all languages
bun run translate:blog
# Translate resource files to all languages
bun run translate:resources
The i18n-diff-checker.ts
script provides intelligent analysis of translation changes:
// Detects property changes in en.ts
import { analyzeTranslationChanges } from './scripts/i18n-diff-checker.ts';
const result = analyzeTranslationChanges();
console.log(`Modified properties: ${result.modifiedProperties.length}`);
result.changes.forEach((change) => {
console.log(`${change.action}: ${change.path}`);
});
Features:
- Git Integration: Compares current changes with previous commits
- Property Flattening: Converts nested objects to dot notation for precise tracking
- Change Detection: Identifies additions, modifications, and deletions
- JSON Output: Machine-readable output for CI/CD integration
When you add a new blog post in English:
- Create:
blog/en/my-new-post.md
- Open a pull request
- GitHub Actions automatically creates:
blog/es/my-new-post.md
(Spanish)blog/fr/my-new-post.md
(French)blog/de/my-new-post.md
(German)- ... and 18 more languages
- All translations are committed to your PR automatically
When you modify translation properties:
- Update:
lib/translations/en.ts
- Open a pull request
- GitHub Actions automatically:
- Analyzes which properties changed using
i18n-diff-checker.ts
- Reports specific properties modified (e.g.,
nav.pricing
,auth.login
) - Validates all language files have corresponding translations
- Blocks deployment if any translations are missing
- Provides detailed feedback in PR comments and status checks
- Analyzes which properties changed using
The application is configured for static export to GitHub Pages:
bun run build
The build creates a static export in the out
directory that can be deployed to any static hosting service.
// next.config.js
const nextConfig = {
output: 'export',
reactStrictMode: true,
images: { unoptimized: true },
staticPageGenerationTimeout: 300,
};
The project uses GitHub Actions for automated deployment to GitHub Pages.
The deployment is configured in .github/workflows/nextjs.yml
:
- Build Trigger: Automatically deploys on pushes to
main
branch - Environment Setup: Installs dependencies and configures build environment
- Static Build: Creates optimized static build with all environment variables
- GitHub Pages Deploy: Deploys to GitHub Pages with proper permissions
All environment variables are securely stored as GitHub repository secrets and injected during the build process:
env:
NEXT_PUBLIC_AUTH0_DOMAIN: ${{ secrets.NEXT_PUBLIC_AUTH0_DOMAIN }}
NEXT_PUBLIC_POSTHOG_KEY: ${{ secrets.NEXT_PUBLIC_POSTHOG_KEY }}
NEXT_PUBLIC_STRIPE_SECRET_KEY: ${{ secrets.NEXT_PUBLIC_STRIPE_SECRET_KEY }}
# ... additional environment variables
The application uses Next.js 14 App Router with internationalized routing:
- Localized Routes:
/[locale]/
- All pages support multiple languages - Homepage:
/[locale]/page.tsx
- Main landing page - Playground:
/[locale]/playground/page.tsx
- Interactive document processing - Account Management:
/[locale]/account/page.tsx
- User dashboard and API keys - Blog:
/[locale]/blog/
- Multi-language blog system - Pricing:
/[locale]/pricing-rt/page.tsx
- Real-time pricing information - Solutions:
/[locale]/solutions/
- Industry-specific solutions - Company:
/[locale]/company/about-us/page.tsx
- About us page
app/components/Button.tsx
- Reusable button component with variantsapp/components/Card.tsx
- Card component for content displayapp/components/CodeBlock.tsx
- Syntax-highlighted code displayapp/components/DocumentViewer.tsx
- PDF and document preview
app/components/playground/
- Interactive document processing interfaceapp/components/pricing/
- Pricing cards and Stripe integrationapp/components/blog/
- Blog post rendering and navigationapp/components/navbar/
- Navigation with language switchingapp/components/footer/
- Site footer with links and information
app/components/auth/LoginButton.tsx
- Auth0 login integrationapp/components/auth/LogoutButton.tsx
- Logout functionalityapp/components/account/
- Account management interface
app/components/animations/
- Framer Motion animation componentsapp/components/modals/
- Modal dialogs for various featuresapp/components/inputs/
- Form input components with validation
The application uses Zustand for state management with multiple specialized stores:
app/hooks/useAccountStore.ts
- User account and profile stateapp/hooks/useCompareModal.ts
- Comparison modal stateapp/hooks/useAccessToken.ts
- Auth0 token management- Theme state managed through React Context (
app/contexts/ThemeContext.tsx
)
app/actions/
- Server actions for data fetching and mutationsapp/actions/account/
- Account-related API callsapp/actions/preprod/
- Pre-production API endpoints- Secure API key management and user authentication
- EmailJS: Contact form and notification emails
- Stripe: Payment processing and subscription management
- OpenAI: AI-powered content generation and translation
- AWS: File storage and processing
- Google Analytics: Website analytics and tracking
- Custom color palette for CambioML branding
- Extended spacing and typography scales
- Dark mode support with theme switching
- Responsive design utilities
- Consistent component styling with Tailwind classes
- Custom gradient utilities for brand elements
- Accessible color contrast ratios
- Mobile-first responsive design
- Markdown-based blog posts with frontmatter
- Multi-language blog support with automated translation
- Dynamic routing for blog posts
- LaTeX support for mathematical content
- Solutions and case studies
- Company information and team profiles
- Pricing information and feature comparisons
- Legal documents and policies
The project includes comprehensive testing with Playwright:
# Run playground tests
bun run test:playground
- End-to-End Testing: Playwright tests for critical user journeys
- Authentication Testing: Auth0 integration testing
- API Testing: Playground API functionality tests
- Cross-browser Testing: Chrome, Firefox, and Safari support
- Static Site Generation: Pre-rendered pages for optimal performance
- Image Optimization: Optimized images with Next.js Image component
- Code Splitting: Automatic code splitting for faster page loads
- Bundle Analysis: Webpack bundle optimization
- Lazy Loading: Components and images loaded on demand
- Caching Strategy: Static asset caching with proper cache headers
- CDN Integration: Static assets served from CDN
- Performance Monitoring: PostHog performance tracking
This project is licensed under the MIT License.