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 thedata/ directory:
- data.tsx: Contains all site content (navigation, hero sections, testimonials, etc.)
- solutions.tsx: Service/solution data with icons and descriptions
- 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:- Blog posts are fetched from WordPress REST API
- Custom pages are loaded dynamically via slug
- 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
Thetypes.ts file defines the application’s data contracts:
types.ts
Component Patterns
Reusable UI Components
Thecomponents/ui/ directory contains reusable components:
GlassCard: A glassmorphism-styled container
Page Components
Each page component follows this pattern:- Import dependencies and types
- Define component with proper TypeScript types
- Manage local state
- Fetch data (if needed)
- Render SEO component
- 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
Component Organization
Component Organization
- 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
Type Safety
Type Safety
- Define interfaces for all data structures
- Use proper React.FC types for components
- Avoid
anytypes - Leverage TypeScript’s type inference
State Management
State Management
- Keep state as local as possible
- Use hooks for side effects
- Implement proper loading and error states
- Provide fallback data for external APIs