Skip to main content

Project Structure

The VENCOL Front Template is a modern React + TypeScript application built with Vite. The project follows a well-organized structure that separates concerns and promotes maintainability.

Directory Layout

Component Architecture

Component Hierarchy

The application follows a hierarchical component structure:

Main App Component

The App component sets up the routing structure and global layout:
App.tsx

Data Flow

Static Content

Static content is centralized in the data/ directory:
  • data.tsx: Contains all site content (navigation, hero sections, testimonials, etc.)
  • solutions.tsx: Service/solution data with icons and descriptions
This approach provides:
  • Easy content updates without touching components
  • Type safety for content structure
  • Single source of truth for site data

Dynamic Content (WordPress)

The application integrates with WordPress for dynamic content:
  1. Blog posts are fetched from WordPress REST API
  2. Custom pages are loaded dynamically via slug
  3. Fallback data is used when WordPress is unavailable

State Management

The application uses React’s built-in state management:
  • Component State: Local UI state with useState
  • Side Effects: Data fetching and DOM manipulation with useEffect
  • URL Parameters: Route parameters with React Router’s useParams
  • Navigation: Location tracking with useLocation
No external state management library is needed. The application architecture keeps state localized to components where it’s used.

Type System

Core Types

The types.ts file defines the application’s data contracts:
types.ts

Component Patterns

Reusable UI Components

The components/ui/ directory contains reusable components: GlassCard: A glassmorphism-styled container
BackgroundBlobs: Animated background effects

Page Components

Each page component follows this pattern:
  1. Import dependencies and types
  2. Define component with proper TypeScript types
  3. Manage local state
  4. Fetch data (if needed)
  5. Render SEO component
  6. Render page content

Build and Deployment

The application uses Vite for building:
  • Development: Fast HMR with vite
  • Production: Optimized bundle with vite build
  • Preview: Test production build with vite preview

Deployment

The project is configured for Vercel deployment with vercel.json. Build output is optimized for modern browsers with ESM imports.

Performance Considerations

Code Splitting

React Router automatically code-splits by route, loading only the necessary components for each page.

Image Optimization

Images are loaded from external sources (WordPress, CDN) and use proper alt text and lazy loading where applicable.

API Caching

WordPress data is fetched on component mount and cached in component state, with fallback data for offline scenarios.

Best Practices

  • Keep components focused on a single responsibility
  • Use TypeScript interfaces for all props
  • Separate UI components from page components
  • Centralize static content in data/ directory
  • Define interfaces for all data structures
  • Use proper React.FC types for components
  • Avoid any types
  • Leverage TypeScript’s type inference
  • Keep state as local as possible
  • Use hooks for side effects
  • Implement proper loading and error states
  • Provide fallback data for external APIs