Building It Yourself
Overview
This guide will walk you through setting up the FC-Catalyst Prediction Tool locally for development or deployment. The site is built using VitePress, a modern static site generator powered by Vue 3 and Vite.
Prerequisites
Before you begin, ensure you have the following installed on your system:
Required Software
Node.js: Version 18.0 or higher
- Download from nodejs.org
- Verify installation:
node --version
npm: Version 9.0 or higher (comes with Node.js)
- Verify installation:
npm --version
- Verify installation:
Optional Tools
Git: For cloning the repository
- Download from git-scm.com
VS Code: Recommended editor with Vue and VitePress extensions
- Download from code.visualstudio.com
Installation
1. Clone the Repository
git clone https://github.com/your-org/fc-catalyst-prediction.git
cd fc-catalyst-predictionIf you don't have Git installed, you can download the source code as a ZIP file from the repository.
2. Install Dependencies
Install all required npm packages:
npm installThis will install VitePress and all other dependencies defined in package.json.
TIP
If you encounter permission errors on Linux/Mac, avoid using sudo. Instead, configure npm to use a different directory for global packages.
3. Verify Installation
Check that VitePress is installed correctly:
npx vitepress --versionYou should see the VitePress version number (e.g., 1.6.4).
Development
Starting the Development Server
Run the development server with hot module replacement:
npm run devThis command will:
- Start a local development server
- Watch for file changes
- Automatically reload the browser when changes are detected
The site will be available at:
http://localhost:5173INFO
The port number may vary if 5173 is already in use. Check the console output for the actual URL.
Development Workflow
- Edit Content: Modify markdown files in the root and subdirectories
- Update Components: Edit Vue components in
.vitepress/theme/components/ - Configure Site: Modify
.vitepress/config.mjsfor navigation and settings - Style Changes: Update
.vitepress/theme/style.cssfor custom styles
Changes will be reflected immediately in your browser thanks to Vite's hot module replacement.
Project Structure
fc-catalyst-prediction/
├── .vitepress/
│ ├── config.mjs # Site configuration
│ ├── theme/
│ │ ├── index.js # Theme customization
│ │ ├── style.css # Custom styles
│ │ └── components/ # Vue components
│ │ └── PredictPage.vue
│ └── dist/ # Build output (generated)
├── Documentation/
│ ├── api.md # API documentation
│ └── build.md # This file
├── Introduction/
│ ├── whats-this.md # Project introduction
│ └── how-to-use.md # Usage guide
├── index.md # Home page
├── predict.md # Prediction page
├── about.md # About page
└── package.json # Dependencies and scriptsBuilding for Production
Create Production Build
Generate optimized static files for deployment:
npm run buildThis command will:
- Bundle and minify all assets
- Generate static HTML files
- Optimize images and resources
- Output files to
.vitepress/dist/
Build output:
.vitepress/dist/
├── assets/ # CSS, JS, and other assets
├── Documentation/ # Documentation pages
├── Introduction/ # Introduction pages
├── index.html # Home page
├── predict.html # Prediction page
└── about.html # About pagePreview Production Build
Test the production build locally before deployment:
npm run previewThis starts a local server serving the built files from .vitepress/dist/. The preview server will be available at:
http://localhost:4173WARNING
The preview server is for testing only. Use a proper web server for production deployment.
Deployment
Static Hosting Platforms
The built site can be deployed to any static hosting service:
Netlify
- Connect your Git repository to Netlify
- Configure build settings:
- Build command:
npm run build - Publish directory:
.vitepress/dist
- Build command:
- Deploy
Vercel
- Import your Git repository to Vercel
- Vercel will auto-detect VitePress
- Deploy with default settings
GitHub Pages
Add a deploy script to package.json:
{
"scripts": {
"deploy": "vitepress build && gh-pages -d .vitepress/dist"
}
}Install gh-pages:
npm install -D gh-pagesDeploy:
npm run deployManual Deployment
Upload the contents of .vitepress/dist/ to your web server:
# Example using rsync
rsync -avz .vitepress/dist/ user@server:/var/www/html/Environment Variables
For production deployments, you may need to configure:
- Base URL: Set in
.vitepress/config.mjsif deploying to a subdirectory - API Endpoints: Update API URLs in components for production
Example config for subdirectory deployment:
// .vitepress/config.mjs
export default {
base: '/fc-catalyst/',
// ... other config
}Troubleshooting
Common Issues
Port Already in Use
If the default port is occupied:
# Specify a different port
npx vitepress dev --port 3000Build Failures
Clear cache and reinstall dependencies:
rm -rf node_modules package-lock.json
npm install
npm run buildModule Not Found Errors
Ensure all dependencies are installed:
npm installCheck that import paths in components are correct.
Styling Issues
Clear VitePress cache:
rm -rf .vitepress/cache
npm run devGetting Help
If you encounter issues:
- Check the VitePress documentation
- Search existing GitHub issues
- Create a new issue with:
- Node.js and npm versions
- Operating system
- Error messages
- Steps to reproduce
Advanced Configuration
Custom Domain
To use a custom domain:
Add a
CNAMEfile to thepublic/directory:your-domain.comConfigure DNS records with your domain provider
Enable HTTPS through your hosting platform
Performance Optimization
- Image Optimization: Use WebP format for images
- Code Splitting: VitePress handles this automatically
- Caching: Configure cache headers on your web server
- CDN: Use a CDN for faster global delivery
CI/CD Integration
Example GitHub Actions workflow:
name: Deploy
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
- run: npm install
- run: npm run build
- uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: .vitepress/distDevelopment Tips
- Hot Reload: Keep the dev server running while editing
- Component Testing: Test Vue components in isolation
- Markdown Preview: Use VS Code's markdown preview alongside the dev server
- Browser DevTools: Use Vue DevTools extension for debugging
- Incremental Builds: VitePress only rebuilds changed files
Next Steps
- Read the API Documentation to integrate with the prediction API
- Explore VitePress features for advanced customization
- Contribute to the project by submitting pull requests