Back to build log

What I learned building an event platform

·6 min read

What I learned building an event platform

After months of building an event management platform, here are the lessons that stuck with me.

Real-time is harder than you think

When multiple users try to register for limited spots simultaneously, things get interesting.

// Naive approach - race condition!
const spots = await getAvailableSpots(eventId);
if (spots > 0) {
  await registerUser(eventId, userId);
}

// Better - use database transactions
await db.transaction(async (tx) => {
  const event = await tx.query(
    'SELECT spots FROM events WHERE id = $1 FOR UPDATE',
    [eventId]
  );
  if (event.spots > 0) {
    await tx.query('UPDATE events SET spots = spots - 1 WHERE id = $1', [eventId]);
    await tx.query('INSERT INTO registrations ...');
  }
});

The importance of optimistic UI

Users don't want to wait. Show them success immediately, then reconcile with the server.

What I'd do differently

1. **Start with a queue** - Process registrations asynchronously

2. **Build admin tools first** - You'll need them more than you think

3. **Plan for cancellations** - They happen more often than signups