Skip to main content

Overview

The PC Fix frontend is built with Astro 5, leveraging its islands architecture for optimal performance. Interactive components are built with React 18, while static content is rendered server-side for instant page loads.
The frontend achieves a 95+ Lighthouse score through Astro’s partial hydration and View Transitions.

Core Technologies

Astro 5.16.3

Meta-framework for SSR, static generation, and partial hydration

React 18.3

UI library for interactive islands (cart, forms, admin dashboard)

Tailwind CSS 3.4

Utility-first CSS framework for responsive design

TypeScript 5.9

Type-safe development across the frontend

Astro Configuration

astro.config.mjs

astro.config.mjs
The configuration dynamically selects the adapter based on the deployment environment (Vercel vs. Node.js standalone).

Project Structure

Astro Islands Architecture

What are Islands?

Astro Islands allow you to mix static HTML with interactive JavaScript components. Only the interactive parts are hydrated on the client.
pages/tienda/index.astro

Example: Shopping Cart Island

components/cart/CartButton.tsx
components/layout/Header.astro

State Management with Zustand

Cart Store Example

stores/cartStore.ts

Auth Store Example

stores/authStore.ts

Form Handling

React Hook Form with Zod Validation

components/auth/LoginForm.tsx

Tailwind CSS Configuration

tailwind.config.mjs

UI Components

Toast Notifications with Sonner

components/ui/Toaster.tsx
Usage:

Swiper Carousels

components/product/ProductCarousel.tsx

Performance Optimizations

View Transitions

Astro’s built-in View Transitions provide smooth page navigation without full page reloads

Image Optimization

Automatic image optimization with Astro’s <Image /> component and Cloudinary CDN

Partial Hydration

Only interactive components are hydrated, reducing JavaScript payload

Code Splitting

Automatic code splitting per route and component

Testing

Vitest Configuration

vitest.config.ts

Component Test Example

components/cart/CartButton.test.tsx

Next Steps

Backend API

Learn about the Express API

Database Schema

Explore the data model

Deployment

Deploy to production