AfCircle’s frontend gets most of the spotlight, but the Flutter app would sag without the Laravel backend humming in the background. I built that API as a one-person backend crew, juggling real-time chat, media uploads, notifications, and moderation. This is the architecture I shipped and the battle scars I earned.
Why Laravel, Why Me
Founders needed a stack that could move fast, pair nicely with Flutter, and let us lean on familiar tooling when something exploded at 2 a.m. Laravel 9.x hit the sweet spot: expressive, batteries-included, and hackable when you need to squeeze extra performance from queues.
- Runtime: PHP 8.1 with Laravel Octane for hot paths.
- Data: MySQL for transactional storage, Redis for ephemeral state and job queues.
- Storage: S3 handles uploads; DigitalOcean Spaces sits ready as a cold failover.
- Messaging: Firebase Cloud Messaging for push, AWS SES + Postmark templates for email, plus an internal table for in-app alerts.
- Realtime: Agora RTC for audio spaces, socket servers backed by Redis pub/sub for chat.
How the Features Hang Together
Media Without Meltdowns
Creators upload long-form reels, so I built a chunked pipeline around video_upload_sessions
. Each chunk lands in S3, a Laravel job reassembles and transcodes, and Elastic indexes the metadata for search. A retry-friendly queue kept completion rates above 99% even on shaky networks.
Audio Spaces
A SpaceService
issues Agora tokens on demand, enforces host/moderator roles, and tears down rooms cleanly when the host bounces. Sentry captures join/leave metrics so we can spot when room quality drifts.
Search That Feels Instant
/search
merges user and room results with relevance weighting tuned from real usage. Redis caches popular queries, while Elastic handles deeper filters. Average response time settled around 150 ms.
Notifications That Actually Arrive
Every notification request flows through a dispatcher job. It fans out to push, email, and in-app channels, reusing Markdown templates so copy edits don’t require shipping code. A simple exponential backoff keeps delivery reliable even when SES throttles.
Hard Numbers
- Comment endpoints dropped from 2–4 s to sub-500 ms after I rewrote the Eloquent relationships and added covering indexes.
- Load tests with 1,200 virtual users kept critical requests under 200 ms and error rates under 0.3%.
- Video uploads now succeed 99% of the time thanks to resumable chunks and S3 multi-part APIs.
Tooling I Refuse to Ship Without
artisan redis:diagnose
andmemory:profile
scripts for quick fire drills.VIDEO_UPLOAD_OPTIMIZATION_GUIDE.md
andUNIFIED_SEARCH_API_GUIDE.md
living inside the repo so future engineers don’t hunt through Slack history.- A shared
.env.example
with sample secrets and seed commands to spin up staging in 10 minutes.
Lessons for Other Founders
- Queues and caches first, not later. They’re cheaper to wire in at the start than after you’ve disappointed your first cohort.
- Make operations boring. Documented runbooks beat tribal knowledge, especially when you’re hiring contractors across time zones.
- Keep the backend opinionated. Guardrails around validation, rate limiting, and monitoring kept the Flutter team (me) moving fast without breaking production.
If you’re chasing a media-heavy product and need backend muscle without building a full team, I’m happy to embed and ship the stack with you.