Skip to main content

What You’ll Build

In this comprehensive tutorial, you’ll build a fully-functional To-Do application with:
  • ✅ Real-time task synchronization across clients
  • ✅ User authentication and private tasks
  • ✅ Task filtering (all, active, completed)
  • ✅ Add, update, and delete operations
  • ✅ Responsive UI with React
  • ✅ Production-ready deployment
This tutorial follows the official Meteor React tutorial structure, adapted from the source at v3-docs/docs/tutorials/react/.

Prerequisites

  • Basic JavaScript and React knowledge
  • Meteor installed (Installation Guide)
  • A code editor (VS Code, Sublime, etc.)

1. Creating the App

1

Install Meteor

If you haven’t already:
2

Create Your Project

The easiest way to set up Meteor with React is using the --react option:
Meteor 3.4+ uses Rspack by default for faster builds and built-in Hot Module Replacement (HMR).
3

Start the Development Server

Your app will be available at http://localhost:3000.
4

Create the Task Component

Create imports/ui/Task.jsx:
5

Create Sample Tasks

Add sample data to imports/ui/App.jsx:

2. Collections - Connecting to MongoDB

Meteor uses MongoDB for data storage. Let’s create a collection for our tasks.
1

Create the Tasks Collection

Create imports/api/TasksCollection.js:
This single line creates a MongoDB collection on the server and an in-memory Minimongo cache on the client.
2

Initialize with Sample Data

Update server/main.js to seed the database:
3

Render Collection Data

Update imports/ui/App.jsx to use real data:
useTracker is a React hook that creates a reactive computation. When the collection changes, the component re-renders automatically.

3. Forms and Events

Let’s add the ability to create new tasks.
1

Create the Task Form

Create imports/ui/TaskForm.jsx:
2

Add Form to App

Update imports/ui/App.jsx:
Notice you’re calling insertAsync directly from the client. This works during development, but we’ll secure it later with methods and publications.

4. Update and Remove Tasks

1

Add Toggle and Delete Functions

Update imports/ui/Task.jsx:

5. Styling Your App

1

Add CSS

Create client/main.css (or update if it exists):
2

Apply CSS Classes

Update imports/ui/Task.jsx to add the checked class:

6. Filter Tasks

1

Add Filter State

Update imports/ui/App.jsx to add filtering:

7. Adding User Accounts

1

Add Account Packages

2

Create Default User

Update server/main.js:
3

Create Login Form

Create imports/ui/LoginForm.jsx:
4

Add Authentication to App

Update imports/ui/App.jsx:
5

Associate Tasks with Users

Update the TaskForm to include user ID:

8. Security with Methods and Publications

By default, Meteor apps have insecure and autopublish packages that allow full client access to the database. Remove these before deploying!
1

Remove Insecure Packages

2

Create Methods

Create imports/api/tasksMethods.js:
Import this file in server/main.js:
3

Create Publications

Create imports/api/tasksPublications.js:
Import in server/main.js:
4

Update Components to Use Methods

Update imports/ui/TaskForm.jsx:
Update imports/ui/Task.jsx:

9. Deploying Your App

What You’ve Learned

Congratulations! You’ve built a complete Meteor application with:

Collections

MongoDB integration with reactive queries

Real-Time Sync

Automatic data synchronization across clients

Authentication

User accounts with secure login

Security

Methods and publications for data access control

React Integration

useTracker and useSubscribe hooks

CRUD Operations

Create, read, update, and delete tasks

Next Steps

Testing

Add tests with TinyTest or Jest

Deployment

Deploy to production with Galaxy or your own server

Advanced Patterns

Learn advanced methods, optimistic UI, and more

Mobile Apps

Build iOS and Android apps with Cordova

Additional Resources

Source Code: The complete tutorial code is available on GitHub:

Forums

Community support and discussions

Discord

Real-time chat with developers

API Docs

Complete API reference