





Daily weigh-ins via photo submission are the core of the game, so the competition server, not the phone, decides which day a weigh-in counts toward.
Notifications are sent by the group's clock as well. Scheduled jobs run every ten minutes and look for the groups where it is the right hour:
Two other jobs complete the set: one stops the daily reminders once the competition has ended, and one invites users without a group to join one on Saturdays.
Some notifications are triggered by a weigh-in. When a member weighs in, their opponent gets a push notification about it. After a user's first photo weigh-in, they get a push notification asking them to review the app.
Once the admin picks a start date, the competition server does the bookkeeping that a group would otherwise keep in a spreadsheet.
At the start of a competition the server creates the matchups for all weeks at once, rotating members so that they meet different opponents, and builds the prize table from the pool. We set this up as scheduled tasks that are stored on the server, so the start does not depend on the server being up at that exact minute. A task is created when the admin schedules the competition, runs when its time comes and is then marked as finished, and finished tasks are skipped on later runs. A separate job checks that each competition that has not started yet has its tasks and recreates a missing one. Cancelling a competition removes its pending tasks.
Over the whole competition, part of the pool is shared across the weekly matchups and a smaller part across the weekly biggest losers. At the end, the largest share goes to the competition winner and a smaller one to the runner-up.
At 8 AM group time after a week ends, the server settles that week:
The server records each prize in the member's winnings and sends the results to the group. The final prizes are recorded eight hours after the competition ends.


Group chat keeps members accountable, and we replaced the old one with our own chat service. The app sends a message to the service, which stores it and delivers it to the members who have the chat open over a persistent connection. Members can post text and photos, the history loads 50 messages at a time, and the other members of the group get a push notification with the sender's name.
The chat also follows the competition. A background job picks up the result announcements the competition server has sent out and posts them to the group's chat as system messages: the matchup winners, the week's biggest loser and the competition winner. Members can find the results in the chat even if they missed the notification. The chat also reports when someone joins, leaves or is removed, when the competition is scheduled, and when the admin cancels it. A cancellation goes out both as a chat message and as a push notification.
The chat service keeps its own database of groups, members and messages. The competition server tells it when a group is created and when a member joins or leaves, and scripts that run at startup brought the groups and members that already existed into the chat.
The app is free and shows full-screen ads through Google AdMob after a weigh-in and at launch. We added ad-free subscriptions for 4, 8 or 12 weeks on iOS. They do not renew automatically.
While a subscription is active, the app does not load ads, and the account screen shows the date the ad-free period ends. Google Play purchases from the Android app are acknowledged on the server side through Google's API.


Weigh-in photos and avatars used to live inside the database. We switched photo storage to Amazon S3: a migration script copied each avatar and weigh-in photo out of the database, compressed it to a 720 px high JPEG and uploaded it. New photos, including chat photos, are saved to S3 by the chat service, and each environment has its own bucket. When a user replaces a solo weigh-in photo, the old one is deleted.
Old photos that no group needs are cleaned up without manual work. A daily job finds photos older than 90 days that do not belong to a group with members and deletes them from both the database and S3 in batches of 100. When a user deletes their account in the app, the competition server removes them from their group and matchups and deletes their weigh-ins, photos, winnings records and purchases.
Group admins set the name, location, buy-in and length, and can choose to hide members' weights so that the group sees only percentages. The location determines the group's time zone. Each group gets a short invite code, which the admin shares from the app so friends can find the group and join.
The leaderboard shows the current week, past weeks and cumulative results with each member's weight loss percentage and winnings. A personal chart shows a user's weight over a week, a month, three months, a year or all time with a trend line, and a competition chart shows each member's progress week by week. Tapping a point on a chart opens the weigh-in photo for that day. Each user chooses whether the app shows weights in pounds or kilograms.


We built a global activity feed on Stream: text and photo posts with link previews, likes and comments. The chat service issues each user a token, so the app connects to Stream directly. The latest iOS version we worked on ships with the feed switched off.
We put the backend into Docker and set up GitLab CI. Each of five branches deploys automatically to its own environment (development, test, demo, pre-production or production), each with its own databases and push notification credentials. The chat service's API is described in an OpenAPI document that the service publishes as an interactive reference, and the chat service checks incoming request data against the expected format before processing it.
On iOS, test and demo builds are assembled with one command and sent to testers through App Center. Crash and usage reports from App Center and Firebase show the team how the app behaves on users' phones.


