Let’s set up a local instance of the Realm Object Server, connect to it with a demo app, and monitor data sync with developer tools.
Get started by downloading the Object Server and demo app:
Starting Realm Object Server
Navigate to your downloads folder and open the “realm-mobile-platform” folder.
Start Realm Object Server by double-clicking the file
start-object-server.command. This file will open a terminal window and start Realm Object Server for you.
Starting the server will automatically open the Realm Dashboard (if it does not, please go to http://localhost:9080).
Create an admin user by entering your email and providing a password. After registering, you can log in using these credentials.
The Realm Dashboard will show you the status of the Realm Object Server, current activity and allow you to manage users.
RealmTasks is a simple task management app powered by the Realm Mobile Platform, inspired by Clear by Realmac Software. It’s available for iOS, macOS, and Android, with full source code available on GitHub.
Open the “Demo” folder inside “realm-mobile-platform”, then the “RealmTasks” folder. Launch the RealmTasks app inside; this is the macOS version.
When the app launches, you can log in as an existing user, or register a new user. Since this is your first time using the app, click “Register” and enter a username and password. (It can be anything; this is a local demo.)
Once you have logged in, the app is ready to use!
Things to Try
- Click the “+” button to add tasks
- Swipe left on a task to delete it
- Swipe right on a task to mark it “done”
- Tap, hold and drag to re-order tasks
These tasks are being added to your local Realm inside the app while being live-synchronized with the Object Server.
If you previously ran RealmTasks and need to reset its state, close the app, then run this command:
rm -rf ~/Library/Containers/io.realm.realmtasks.macos
The Realm Browser
To manage the Realms on the server, Realm includes a browser that allows you to explore and interact with them in realtime.
Open the macOS app named “Realm Browser” inside the “realm-mobile-platform” folder.
The app will open a panel with initial options. Click “Connect to Object Server”.
In the “Connect to Object Server” dialog box, enter
realm://127.0.0.1:9080 as the server URL.
In order to connect as admin we need an admin access token. In the terminal running the server, look for a line starting with
Your admin access token is:. Copy the long token key string, including the two trailing equals signs (
==). This is the admin access token for your Object Server.
A new dialog box will open, listing all the Realms on your server. If you only registered one user, there will be only one Realm. Select it to view the contents.
If you still have the RealmTasks app open, you can now try editing and reordering your tasks while seeing the changes live in the browser. Changes in the browser are reflected instantly in the app as well.
Now that you’ve set up your Object Server, and tried out the demo app, let’s try to compile and run a real mobile app.