Skip to content

coder7475/cf-remix

Repository files navigation

cf-remix CI/CD

A modern portfolio website built with Remix and deployed on Cloudflare Pages with automated CI/CD using GitHub Actions. This project showcases a full-stack web application with server-side rendering, edge computing capabilities, and modern development practices.

✨ Features

  • πŸš€ Edge-First Architecture: Built for Cloudflare's edge network for lightning-fast global performance
  • 🎨 Modern UI Components: Crafted with Tailwind CSS, Radix UI primitives, and Lucide React icons
  • πŸ“± Fully Responsive: Mobile-first design that works seamlessly across all devices
  • ⚑ Server-Side Rendering: Remix-powered SSR for optimal SEO and performance
  • πŸ”„ Automated Deployment: CI/CD pipeline with GitHub Actions for seamless updates
  • 🎯 TypeScript: Full type safety throughout the application
  • 🎭 Interactive Components: Toast notifications and smooth animations
  • πŸ“Š Portfolio Sections: About, Experience, Projects, Skills, Blog, and Contact pages

πŸ› οΈ Tech Stack

Frontend

Infrastructure & Tooling

πŸ“‹ Prerequisites

Before you begin, ensure you have the following installed:

  • Node.js β‰₯ 20.0.0
  • pnpm β‰₯ 9.0.0 (recommended) or npm/yarn
  • Git for version control
  • Cloudflare Account for deployment

πŸš€ Quick Start

1. Clone the Repository

git clone https://github.com/coder7475/cf-remix.git
cd cf-remix

2. Install Dependencies

pnpm install

3. Start Development Server

pnpm run dev

The application will be available at http://localhost:5173

πŸ”§ Development

Available Scripts

Command Description
pnpm run dev Start development server with hot reload
pnpm run build Build the application for production
pnpm run start Preview the built application locally
pnpm run preview Build and preview the application
pnpm run deploy Build and deploy to Cloudflare Pages
pnpm run typecheck Run TypeScript type checking
pnpm run typegen Generate Cloudflare Workers types
pnpm run lint Run ESLint for code quality
pnpm run cf-typegen Alternative command for type generation

Development Workflow

  1. Local Development: Use pnpm run dev for development with hot module replacement
  2. Type Checking: Run pnpm run typecheck to ensure type safety
  3. Linting: Use pnpm run lint to maintain code quality
  4. Testing Locally: Use pnpm run start to test the built application

Working with Wrangler

To run the application using Wrangler (Cloudflare's development environment):

pnpm run build
pnpm run start

This simulates the Cloudflare Pages environment locally, including edge runtime features.

πŸ—οΈ Project Structure

cf-remix/
β”œβ”€β”€ app/                        # Remix application code
β”‚   β”œβ”€β”€ components/            # Reusable React components
β”‚   β”‚   β”œβ”€β”€ ui/               # UI primitives and shared components
β”‚   β”‚   β”œβ”€β”€ AboutMe.tsx       # About section component
β”‚   β”‚   β”œβ”€β”€ Banner.tsx        # Hero banner component
β”‚   β”‚   β”œβ”€β”€ Blog.tsx          # Blog section component
β”‚   β”‚   β”œβ”€β”€ Experience.tsx    # Experience timeline component
β”‚   β”‚   β”œβ”€β”€ Footer.tsx        # Site footer component
β”‚   β”‚   β”œβ”€β”€ GetInTouch.tsx    # Contact form component
β”‚   β”‚   β”œβ”€β”€ Navbar.tsx        # Navigation component
β”‚   β”‚   β”œβ”€β”€ Projects.tsx      # Projects showcase component
β”‚   β”‚   └── Skills.tsx        # Skills display component
β”‚   β”œβ”€β”€ hooks/                # Custom React hooks
β”‚   β”œβ”€β”€ libs/                 # Utility functions and helpers
β”‚   β”œβ”€β”€ routes/               # Remix route components
β”‚   β”‚   β”œβ”€β”€ _index.tsx        # Home page route
β”‚   β”‚   β”œβ”€β”€ about.tsx         # About page route
β”‚   β”‚   β”œβ”€β”€ blog.tsx          # Blog page route
β”‚   β”‚   β”œβ”€β”€ contact.tsx       # Contact page route
β”‚   β”‚   β”œβ”€β”€ experiences.tsx   # Experience page route
β”‚   β”‚   β”œβ”€β”€ projects.tsx      # Projects page route
β”‚   β”‚   └── skills.tsx        # Skills page route
β”‚   β”œβ”€β”€ entry.client.tsx      # Client-side entry point
β”‚   β”œβ”€β”€ entry.server.tsx      # Server-side entry point
β”‚   β”œβ”€β”€ root.tsx              # Root application component
β”‚   └── tailwind.css          # Global styles and Tailwind imports
β”œβ”€β”€ build/                     # Built application (generated)
β”œβ”€β”€ public/                    # Static assets
β”œβ”€β”€ .github/                   # GitHub Actions workflows
β”‚   └── workflows/
β”‚       └── ci_cd.yml         # CI/CD pipeline configuration
β”œβ”€β”€ package.json              # Project dependencies and scripts
β”œβ”€β”€ wrangler.toml            # Cloudflare Workers configuration
β”œβ”€β”€ vite.config.ts           # Vite build configuration
β”œβ”€β”€ tailwind.config.ts       # Tailwind CSS configuration
└── tsconfig.json            # TypeScript configuration

🎨 Styling & UI

Tailwind CSS Configuration

The project uses a custom Tailwind CSS setup with:

  • Custom Design System: Consistent spacing, colors, and typography
  • Component Variants: Using Class Variance Authority for component styling
  • Responsive Design: Mobile-first approach with responsive utilities
  • Animations: Smooth transitions and micro-interactions
  • Dark Mode Support: Built-in dark mode capabilities

Component Architecture

  • Atomic Design: Components are organized in a scalable hierarchy
  • Accessibility First: All components follow WCAG guidelines
  • Reusability: Shared components with flexible prop interfaces
  • Type Safety: Full TypeScript integration for component props

βš™οΈ Configuration

Environment Variables

Create a .env file in the root directory for local development:

# Add your environment variables here
# CLOUDFLARE_API_TOKEN=your_api_token
# CLOUDFLARE_ACCOUNT_ID=your_account_id

Wrangler Configuration

The wrangler.toml file configures Cloudflare Workers settings:

name = "cf-remix"
compatibility_date = "2024-02-20"

[site]
bucket = "./build/client"

Vite Configuration

Custom Vite setup with:

  • Remix Integration: Full-stack development with file-based routing
  • TypeScript Paths: Absolute imports configuration
  • Cloudflare Dev Proxy: Local development with edge runtime
  • Future Flags: Latest Remix features enabled

πŸ“¦ Type Generation

Generate TypeScript types for your Cloudflare bindings:

pnpm run typegen

This command:

  • Reads your wrangler.toml configuration
  • Generates TypeScript definitions for Workers APIs
  • Updates type definitions for environment bindings
  • Ensures type safety across your application

Note: Rerun typegen whenever you modify wrangler.toml or add new Cloudflare bindings.

🚒 Deployment

Automatic Deployment (Recommended)

The project includes a GitHub Actions workflow that automatically:

  1. Builds the application on every push to main
  2. Tests code quality with linting and type checking
  3. Deploys to Cloudflare Pages
  4. Notifies of deployment status

Manual Deployment

For manual deployments:

# Build the application
pnpm run build

# Deploy to Cloudflare Pages
pnpm run deploy

Deployment Prerequisites

  1. Cloudflare Account: Set up a Cloudflare account
  2. Wrangler Authentication: Login with wrangler login
  3. GitHub Secrets: Configure deployment secrets in GitHub repository
  4. Domain Configuration: Set up custom domain (optional)

πŸ” Performance & Optimization

Edge Computing Benefits

  • Global CDN: Content delivered from 200+ edge locations
  • Zero Cold Starts: Instant response times worldwide
  • Automatic Scaling: Handles traffic spikes seamlessly
  • Built-in Caching: Intelligent edge caching strategies

Bundle Optimization

  • Tree Shaking: Eliminates unused code automatically
  • Code Splitting: Lazy loading for optimal performance
  • Asset Optimization: Automatic image and asset optimization
  • Compression: Gzip and Brotli compression enabled

πŸ§ͺ Testing & Quality Assurance

Code Quality

  • ESLint: Comprehensive linting rules for JavaScript/TypeScript
  • TypeScript: Compile-time error checking and IntelliSense
  • Prettier Integration: Consistent code formatting
  • Import Sorting: Organized import statements

CI/CD Pipeline

The GitHub Actions workflow ensures:

  • Dependency Installation: Cached for faster builds
  • Type Checking: Validates TypeScript across the project
  • Linting: Enforces code quality standards
  • Build Verification: Ensures successful production builds
  • Automated Deployment: Seamless deployment on success

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Development Guidelines

  • Follow the existing code style and conventions
  • Write meaningful commit messages
  • Add appropriate TypeScript types for new features
  • Test your changes locally before submitting
  • Update documentation for significant changes

πŸ“š Learning Resources

πŸ› Troubleshooting

Common Issues

Development server not starting:

# Clear node_modules and reinstall
rm -rf node_modules pnpm-lock.yaml
pnpm install
pnpm run dev

Type errors after updating dependencies:

# Regenerate types
pnpm run typegen
pnpm run typecheck

Build failures:

# Check for TypeScript errors
pnpm run typecheck

# Check for linting issues
pnpm run lint

Deployment issues:

# Login to Wrangler
wrangler login

# Verify configuration
wrangler pages project list

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™ Acknowledgments

  • Remix Team for the amazing full-stack framework
  • Cloudflare for the edge computing platform
  • Tailwind CSS for the utility-first CSS framework
  • Radix UI for accessible UI primitives
  • Open Source Community for the excellent tools and libraries

About

My Portfolio build using Remix And Deployed to Cloudflare

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •