Best approach for creating REST API backend for mobile app

Hey everyone! I need some advice on building a backend system for my mobile app. The app needs to pull data from a database when users load pages and also handle push notifications.

I’m planning to use PHP with MySQL and return JSON responses. I’ve been thinking about two different ways to structure this:

Option 1: Build one main PHP file that takes different parameters or action types, processes them, and returns the appropriate data

Option 2: Create separate PHP files for each type of request the app might make

Which approach would you recommend? I’m also open to completely different suggestions if you think there’s a better way to handle this.

The backend will mainly be used for database queries and sending push notifications to users. If anyone has experience with specific frameworks or even different programming languages that work well for mobile backends, I’d love to hear your thoughts!

Thanks in advance for any help!

I’ve built several mobile backends and here’s what I learned: skip custom PHP files and go straight to a proper REST framework. I started with single files using parameter switching - huge mistake. Maintenance was a nightmare once the app grew. Separate files are better but still messy without structure. I switched to Express.js with Node.js and haven’t looked back. It handles JSON natively, plays nice with push services, and the routing is clean. Plus middleware support rocks and MySQL works great with packages like mysql2. If you’re stuck on PHP, try Slim Framework - gives you proper REST routing without the bloat. Trust me, when you need to integrate FCM or other push services, dedicated endpoints beat parameter switching every time.

definitely option 2! I find it way easier to debug separate files. plus, if you ever need to scale, it won’t mess with everything else. oh, and u might wanna look into frameworks like laravel or slim - they really simplify routing and json responses!

hey lucas! curious about your user count. also, what kind of push notifications are you aiming for? those things can impact your tech choice, especially when comparing php to node.js. have you thought about using firebase for push notifications? sounds like it could fit nicely!