Documentation Index
Fetch the complete documentation index at: https://mintlify.com/meteor/meteor/llms.txt
Use this file to discover all available pages before exploring further.
Directory Structure
Meteor uses a convention-based file structure that determines where code runs and how it’s loaded.Standard Layout
A typical Meteor project follows this organization:Load Order Rules
Meteor loads files in a specific order based on their location:1. Special Directories
client/ - Browser Only
client/ - Browser Only
Files in
client/ run only in the browser. Meteor automatically excludes this code from the server bundle.client/main.js
server/ - Server Only
server/ - Server Only
Files in
server/ run only on the server (Node.js). This is where you put sensitive logic, API keys, and database operations.server/main.js
imports/ - Lazy Loading
imports/ - Lazy Loading
Files in
imports/ are not loaded automatically. You must explicitly import them. This enables code splitting and lazy loading.imports/api/tasks.js
public/ - Static Assets
public/ - Static Assets
Files in
public/ are served as static assets. They’re accessible at the root URL.private/ - Server Assets
private/ - Server Assets
Files in
private/ are accessible only to server code via the Assets API.tests/ - Test Files
tests/ - Test Files
Files matching
*.test.js, *.tests.js, or inside tests/ are excluded from production builds.tasks.test.js
2. Load Priority
Within each directory, files load in this order:- Files in subdirectories load before files in parent directories
- Files are sorted alphabetically by name
main.*files load last- Files in
lib/directories load first
File Architecture Patterns
Module Pattern (Recommended)
Use theimports/ directory with explicit imports:
Split by Feature
Organize code by feature rather than by type:The .meteor Directory
The.meteor/ directory contains Meteor-specific configuration:
packages
Lists Meteor packages used by your app:versions
Locks exact package versions (likepackage-lock.json for npm):
release
Specifies the Meteor version:Build Output Structure
When you build a Meteor app, it generates a “star” archive with this structure:Star Archive Layout
star.json
Describes the build output:program.json
Each program has aprogram.json describing its resources:
Web Program:
Best Practices
Use imports/ for Everything
Use imports/ for Everything
Put all application code in
imports/ and explicitly import it. This gives you:- Explicit dependency graph
- Better code splitting
- Easier testing
- No reliance on load order
Minimal Entry Points
Minimal Entry Points
Keep
client/main.js and server/main.js minimal - just imports:client/main.js
server/main.js
Feature-Based Organization
Feature-Based Organization
Organize by feature, not by file type:✅ Good:❌ Avoid:
Shared Code
Shared Code
Repository Structure
The Meteor source code itself follows this structure:Learn More
Explore how Meteor’s package system works and how packages are structured