Overview
Routing drives your application’s user interface based on URLs. In client-rendered Meteor apps, routing happens on the client side, allowing for instant navigation without server round-trips while maintaining browser features like bookmarking, back/forward buttons, and sharing links.Why Client-Side Routing?
Unlike traditional server-rendered apps where each URL change triggers a server request, Meteor apps:- Load once and update the UI based on URL changes
- Navigate instantly without page reloads
- Maintain state across navigation
- Still support all browser URL features
The URL represents linkable state - the parts of your application that users should be able to bookmark, share, or navigate to directly.
Flow Router
The recommended routing package for Meteor is Flow Router Extra:waitOn for handling subscriptions and built-in template context.
Defining Routes
Basic Route
Route with Parameters
URL Pattern Matching
Rendering Templates with Blaze
Using Blaze Layout
Install the Blaze Layout package:Define a Layout Template
Render Templates on Route Changes
Page Components
Page components are top-level templates that:- Collect route information
- Subscribe to data
- Fetch data from collections
- Pass data to child components
Accessing Route Information
Current Route
Reactive Route Helpers
Navigation
Programmatic Navigation
Generate URLs
HTML Links
Active Route Highlighting
ActiveRoute (built into Flow Router Extra):
Route Groups
Organize routes with common properties:Route Triggers
Execute code when entering or exiting routes:Not Found (404) Routes
Using with React
Query Parameters
Reading Query Params
Setting Query Params
Best Practices
Keep URLs Linkable
Subscribe in Page Components
Use Named Routes
Related Resources
- Flow Router Extra Documentation
- Data Loading Guide
- Blaze Guide
- React Router - Alternative for React apps