GitHunt

RailNex Website

Professional marketing website for RailNex - built with React, TypeScript, and Webpack.

RailNex WebPages Deployment

๐Ÿš‚ About

RailNex is a professional railroad simulation platform featuring:

  • RailNex Engine: Custom engine for railroad simulation
  • Global Railroad Database: Operate anywhere in the world using data from OpenStreetMap, OpenRailwayMap, and other sources
  • Vulkan Graphics Engine: Modern, high-performance rendering
  • Real-Time Physics: Advanced train dynamics and realistic behavior
  • Study-Level Accuracy: Meticulously detailed locomotive models

๐Ÿ› ๏ธ Tech Stack

  • React 18: Modern UI library
  • TypeScript: Type-safe development
  • Webpack 5: Module bundling and optimization
  • SCSS: Advanced styling with variables and mixins
  • GitHub Pages: Static site hosting

๐Ÿ“ Project Structure

RailNex-Website/
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ components/        # React components
โ”‚   โ”‚   โ”œโ”€โ”€ Hero.tsx/scss
โ”‚   โ”‚   โ”œโ”€โ”€ FeatureCards.tsx/scss
โ”‚   โ”‚   โ”œโ”€โ”€ FeaturesSection.tsx/scss
โ”‚   โ”‚   โ”œโ”€โ”€ Footer.tsx/scss
โ”‚   โ”‚   โ”œโ”€โ”€ Navigation.tsx/scss
โ”‚   โ”‚   โ”œโ”€โ”€ APIDocumentation.tsx/scss
โ”‚   โ”‚   โ”œโ”€โ”€ RailNexEngine.tsx/scss
โ”‚   โ”‚   โ””โ”€โ”€ RailNexForge.tsx/scss
โ”‚   โ”œโ”€โ”€ styles/           # Global styles and variables
โ”‚   โ”‚   โ”œโ”€โ”€ _variables.scss         # Design tokens
โ”‚   โ”‚   โ”œโ”€โ”€ _common.scss            # โญ Shared components (900+ lines)
โ”‚   โ”‚   โ”œโ”€โ”€ main.scss               # Global styles
โ”‚   โ”‚   โ””โ”€โ”€ COMMON_STYLES_GUIDE.md  # Full documentation
โ”‚   โ”œโ”€โ”€ assets/          # Images and static assets
โ”‚   โ”‚   โ””โ”€โ”€ images/
โ”‚   โ”œโ”€โ”€ App.tsx          # Main app with routing
โ”‚   โ”œโ”€โ”€ index.tsx        # Entry point
โ”‚   โ”œโ”€โ”€ index.html       # HTML template
โ”‚   โ””โ”€โ”€ types.d.ts       # TypeScript declarations
โ”œโ”€โ”€ dist/                # Build output (gitignored)
โ”œโ”€โ”€ QUICK_REFERENCE.md   # Common styles cheat sheet
โ”œโ”€โ”€ webpack.config.js    # Webpack configuration
โ”œโ”€โ”€ tsconfig.json        # TypeScript configuration
โ””โ”€โ”€ package.json         # Dependencies and scripts

๐Ÿš€ Getting Started

Prerequisites

  • Node.js 18+
  • npm or yarn

Installation

# Install dependencies
npm install

Development

# Start development server at http://localhost:3000
npm start

# Or use the dev command
npm run dev

The dev server includes:

  • Hot module replacement
  • Automatic reloading
  • Source maps for debugging

Building for Production

# Create optimized production build
npm run build

Output will be in the dist/ directory, ready for deployment.

Cleaning Build Files

# Remove dist directory
npm run clean

๐ŸŽจ Design System

Common Styles System

The project uses a standardized common styles library (_common.scss) to reduce code duplication and ensure consistency across all components.

๐Ÿ“– Full Documentation โ†’ | Quick Reference โ†’

Key Benefits:

  • 80-90% reduction in component SCSS
  • Guaranteed visual consistency
  • Faster development with pre-built components
  • Single source of truth for styling

Quick Example:

// Use common classes instead of writing custom SCSS
<div className="card card--interactive">
  <div className="icon-container icon-container--md mb-2">๐Ÿš‚</div>
  <h3 className="card__title">Title</h3>
  <p className="card__description">Description</p>
</div>

Available Components:

  • Layouts: hero-section, content-section, page-wrapper
  • Cards: card (with --interactive, --flat modifiers)
  • Grids: grid-layout--2-col/3-col/4-col/sidebar/split
  • Forms: form-input, form-select, form-label
  • Icons: icon-container--sm/md/lg (with optional --hover-scale)
  • UI: badge, tag, link, divider, code-block
  • Utilities: Spacing (mt-1, mb-2), flex (d-flex gap-2), animations (animate-fadeInUp)

See QUICK_REFERENCE.md for copy-paste examples.

Color Scheme

The website uses a professional, technical color scheme:

  • Background: Dark navy (#0a0e1a, #050810)
  • Cards: Subtle dark (#141824)
  • Accent: Cyan (#00d9ff) - primary technical accent
  • Secondary: Purple (#7b68ee) - gradient accent
  • Text: Light gray (#e8eaed) with muted variations

Typography

  • Font: Segoe UI system font stack
  • Headings: Bold, clear hierarchy
  • Body: 1.6 line-height for readability

Components

All components use BEM-style SCSS modules:

.component
  &__element
    &--modifier

๐Ÿ“ฆ Deployment

GitHub Pages

The site automatically deploys to GitHub Pages when you push to main:

  1. GitHub Actions builds the React app
  2. Webpack creates optimized bundle in dist/
  3. GitHub Pages serves the static files

Workflow: .github/workflows/static.yml

Manual Deployment

# Build the app
npm run build

# Deploy dist/ folder to your hosting service

๐Ÿ”ง Configuration

Webpack

  • Dev: Hot reload, source maps, unminified
  • Production: Minified, optimized, hashed filenames
  • Assets: Automatic handling of images, fonts, styles

TypeScript

  • Strict mode enabled
  • Path aliases configured:
    • @/* โ†’ src/*
    • @components/* โ†’ src/components/*
    • @styles/* โ†’ src/styles/*
    • @assets/* โ†’ src/assets/*

๐ŸŽฏ Key Features

Modern Build Pipeline

  • Tree shaking for smaller bundles
  • Code splitting for faster loads
  • Asset optimization (images, fonts)
  • CSS extraction and minification

Professional Design

  • Smooth animations and transitions
  • Responsive grid layouts
  • Modern glassmorphism effects
  • Gradient accents for visual interest

Performance

  • Lazy loading where beneficial
  • Optimized images
  • Minimal dependencies
  • Production build < 500KB

๐Ÿ“ Development Notes

Adding New Components

  1. Check common styles first - Use .card, .grid-layout, .icon-container before writing custom CSS
  2. Create .tsx file in src/components/
  3. Create .scss file ONLY for truly unique styles (import common: @use '../styles/common' as *;)
  4. Import and use in App.tsx

Component SCSS Template:

@use '../styles/variables' as *;
@use '../styles/common' as *;

// Only add truly unique styles - use common classes in TSX!
.my-component {
  // Unique styles only
}

Modifying Styles

  • Common styles: src/styles/_common.scss (shared components)
  • Design tokens: src/styles/_variables.scss (colors, spacing, shadows)
  • Component styles: Co-located .scss files (use @use '../styles/common' as *;)
  • Prefer common classes over custom SCSS (see QUICK_REFERENCE.md)

Adding Images

  1. Place images in src/assets/images/
  2. Import in component:
    import myImage from '@assets/images/my-image.jpg';
  3. Use in JSX:
    <img src={myImage} alt="Description" />

๐Ÿ› Troubleshooting

Build Fails

# Clear node_modules and reinstall
rm -rf node_modules package-lock.json
npm install

TypeScript Errors

  • Check tsconfig.json for correct paths
  • Ensure all .d.ts files are in src/

Webpack Errors

  • Verify all loaders are installed
  • Check file extensions in imports

๐Ÿ“„ License

Copyright ยฉ 2024-2025 | RailNex

๐Ÿค Contributing

This is an open-source project. Contributions are welcome!

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Submit a pull request

Made with โšก for professional railroad simulation

TheCorridor-Train-Simulator/TheCorridor-Train-Simulator.github.io | GitHunt