Professional marketing website for RailNex - built with React, TypeScript, and Webpack.
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
- 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
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
- Node.js 18+
- npm or yarn
# Install dependencies
npm install# Start development server at http://localhost:3000
npm start
# Or use the dev command
npm run devThe dev server includes:
- Hot module replacement
- Automatic reloading
- Source maps for debugging
# Create optimized production build
npm run buildOutput will be in the dist/ directory, ready for deployment.
# Remove dist directory
npm run cleanThe 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,--flatmodifiers) - 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.
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
- Font: Segoe UI system font stack
- Headings: Bold, clear hierarchy
- Body: 1.6 line-height for readability
All components use BEM-style SCSS modules:
.component
&__element
&--modifierThe site automatically deploys to GitHub Pages when you push to main:
- GitHub Actions builds the React app
- Webpack creates optimized bundle in
dist/ - GitHub Pages serves the static files
Workflow: .github/workflows/static.yml
# Build the app
npm run build
# Deploy dist/ folder to your hosting service- Dev: Hot reload, source maps, unminified
- Production: Minified, optimized, hashed filenames
- Assets: Automatic handling of images, fonts, styles
- Strict mode enabled
- Path aliases configured:
@/*βsrc/*@components/*βsrc/components/*@styles/*βsrc/styles/*@assets/*βsrc/assets/*
- Tree shaking for smaller bundles
- Code splitting for faster loads
- Asset optimization (images, fonts)
- CSS extraction and minification
- Smooth animations and transitions
- Responsive grid layouts
- Modern glassmorphism effects
- Gradient accents for visual interest
- Lazy loading where beneficial
- Optimized images
- Minimal dependencies
- Production build < 500KB
- Check common styles first - Use
.card,.grid-layout,.icon-containerbefore writing custom CSS - Create
.tsxfile insrc/components/ - Create
.scssfile ONLY for truly unique styles (import common:@use '../styles/common' as *;) - 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
}- Common styles:
src/styles/_common.scss(shared components) - Design tokens:
src/styles/_variables.scss(colors, spacing, shadows) - Component styles: Co-located
.scssfiles (use@use '../styles/common' as *;) - Prefer common classes over custom SCSS (see QUICK_REFERENCE.md)
- Place images in
src/assets/images/ - Import in component:
import myImage from '@assets/images/my-image.jpg';
- Use in JSX:
<img src={myImage} alt="Description" />
# Clear node_modules and reinstall
rm -rf node_modules package-lock.json
npm install- Check
tsconfig.jsonfor correct paths - Ensure all
.d.tsfiles are insrc/
- Verify all loaders are installed
- Check file extensions in imports
Copyright Β© 2024-2025 | RailNex
This is an open-source project. Contributions are welcome!
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
Made with β‘ for professional railroad simulation