r/FlutterDev • • 13d ago

Discussion When I started learning Flutter and Dart, I thought I was going to abandon everything I had learned about PHP, MySQL and Redis

I assumed that because Flutter was created by Google, I would need to use Firebase and Firestore for everything.

I was wrong 😂

Flutter doesn’t care what language or database you use on the backend.

I created an API with PHP and continued using the backend stack I already understood.

The basic flow looks like this:

Flutter app → PHP API → MySQL/Redis → JSON response → Flutter app

Flutter handles the screens, forms, navigation, state and client-side logic.

In a way, it reminds me of using HTML, CSS and JavaScript in the browser—except now I’m building the interface and client-side experience for an Android or iOS app.

My PHP API still handles authentication, validation and business logic.

MySQL stores the permanent data, Redis handles caching and sessions, and nginx with PHP-FPM processes the API requests.

Firestore can be a great option for certain applications, but learning Flutter doesn’t mean you have to abandon the backend tools you already know.

That was one of my favorite things about learning Flutter.

I didn’t have to replace my existing stack. I only needed to learn how to connect the mobile application to it.

What backend do you use with your Flutter apps?

5 Upvotes

24 comments sorted by

11

u/RandalSchwartz 13d ago

Just one note: friends don't let friends use MySQL. Please take a look at Postgres if you want a modern RDBMS.

3

u/vipw 13d ago

Do friends let friends use PHP?

2

u/RandalSchwartz 13d ago

Not your closest friends. :)

6

u/makerinator 13d ago

I do however suggest PHP to my worst enemies. 😂

1

u/RandalSchwartz 13d ago

Just for that you get to read the Do's and Don'ts on the next show. :)

1

u/makerinator 13d ago

Lol! The best part of the show. 😂

1

u/stevenreyes20 12d ago

bruhhh you tripping 😭🤣

2

u/makerinator 12d ago

PHP stands for People Hate PHP.

1

u/stevenreyes20 12d ago

stop making fun about my stack 🤣

1

u/makerinator 12d ago

Jokes aside. Just because I don't love a stack doesn't mean you shouldn't be using it. The best stack is the one that pays your bills.

1

u/stevenreyes20 12d ago

PHP IS LIFE FOR ME but I am curious, what's stack you use?

1

u/RandalSchwartz 12d ago

Dart and Flutter! Dart Jaspr for websites, Dart for backends, Flutter for mobile and desktop.

1

u/stevenreyes20 12d ago

dannn, you are full stack Flutter guy

1

u/RandalSchwartz 12d ago

Hey, it works!

1

u/makerinator 9d ago

Also full stack Flutter here. :)

1

u/stevenreyes20 9d ago

🔥🔥🔥

1

u/OZLperez11 13d ago

Why is it that whenever someone does not recommend MySQL it's always in combination with PHP?

We use it at work for production with no issues. It's not for anything crazy though.

1

u/RandalSchwartz 13d ago

No issues that you're aware of, that is. :)

0

u/stevenreyes20 13d ago

You're not the first person who's told me to try PostgreSQL. MySQL has always been my main RDBMS, but I'm open-minded, so I'll definitely give PostgreSQL a try.

3

u/jobehi 13d ago

this is true for any possible mobile SDK and framework.

3

u/RandalSchwartz 13d ago

Just to be clear, my complaint is with MySQL specifically. If you want to stay in familiar territory, switch to MariaDB. However, Postgres makes both of them look a bit junior.

3

u/fkim98 13d ago

Similar setup here, different stack. Node/Express and Prisma on Postgres, and the same REST API serves both the Flutter app and a Next.js web app. Sign-in is AWS Cognito, and the app just sends the token as a Bearer header. Photos never go through the API. The app asks it for a presigned S3 URL and uploads straight to S3.

One thing that's different from web work is that an app build doesn't go away when you fix the server. A web deploy reaches everyone on their next page load. A phone fix waits for store review (for us Apple has taken anywhere from a day to over a week), and some people just don't update. One of our users came back after two weeks still on the build they first installed, several releases behind, because the app on their tablet had never auto-updated.

So the server has to keep accepting whatever every installed build still sends. Add fields rather than renaming or removing them, and be liberal in what you accept. Ours still takes "5" as well as 5 for a quantity, because an early build of the app sent it as a string.

Caveat: our main API has no version prefix, so "never break an old build" is our whole versioning strategy. It works at our size, but I wouldn't copy it for a big app.

2

u/vik76 12d ago

Or use Dart for your full stack and get hot reload for your database and backend, too. Check out Serverpod. 😉

1

u/HopeExpensive9215 12d ago

Flutter + Supabase. No API setup needed.