Flutter Chat App with Node.js, WebSockets and MySQL
A Flutter Chat App that supports live video and audio calls streaming with WebRTC, built with Node.js, MySQL, and WebSockets.
This is a Flutter Chat App without Firebase, but if it doesn’t fit for you, it can still be an example of a template to build your Flutter Chat UI
The Node.js server uses Askless for streaming data changes to the Flutter App through WebSockets, so the Flutter widgets are updated in realtime.
Because this project uses TypeORM, you can easily change the database to make this a Flutter Chat App with PostgreSQL, rather than with MySQL
The text messages are also saved in the user device with Hive, so the user doesn’t need to be connected to the internet to see his received messages.
🔊 The video above contains audio, click on the right side to turn it on
Getting started
- Go to
nodejs_websocket_backend
and install the dependencies by runningnpm install
- The Node.js server uses TypeORM, TypeORM supports several databases like MySQL, PostgreSQL, MariaDB, SQLite, MS SQL Server, Oracle, SAP Hana and WebSQL. So the first step is to configure the database of your choice. Add your database configuration on
nodejs_websocket_backend/src/environment/db.ts
, don’t commit this file to your repository - In
nodejs_websocket_backend/src/environment/jwt-private.key
, replace the JWT private key with your own random text, don’t also commit this file to your repository - Start your node.js backend server by running the command
npm run dev
, it will print its URL in the console (local network). - Go to the App created with Flutter on
flutter_app/lib/core/data/data_sources/connection_remote_ds.dart
and replace theserverUrl
with the URL and port that your node.js backend is running - Go to
flutter_app/lib/environment.dart
and replace thelocalStorageEncryptionKey
with your own random text. don’t commit this file to your repository as well. - Run
flutter pub get
to get the Flutter dependencies - Run the Flutter project on your device 🙂
Issues
Feel free to open an issue about:
- ❔ questions
- 💡 suggestions
- 🐜 potential bugs