flutter_supabase_chat_core 0.0.1 copy "flutter_supabase_chat_core: ^0.0.1" to clipboard
flutter_supabase_chat_core: ^0.0.1 copied to clipboard

Actively maintained, community-driven Supabase BaaS for chat applications with an optional chat UI.


Flyer Chat logo

Flutter Supabase Chat Core

This project is an implementation of the flutter_chat_types, flutter_chat_ui packages based on a backend created with Supabase.


Actively maintained, community-driven Supabase BaaS for chat applications with an optional chat UI.


⚠️⚠️ Recommended for small or PoC projects, might not be optimized for large amounts of data. I suggest to use this on a free plan, otherwise be extremely cautious. ⚠️⚠️


Pub Build Status CodeFactor


Chat Image


Flyer Chat is a platform for creating in-app chat experiences using Flutter or React Native. This repository contains Supabase BaaS implementation for Flutter. We are also working on our more advanced SaaS and self-hosted solutions.

  • Free, open-source and community-driven. We offer no paid plugins and strive to create an easy-to-use, almost drop-in chat experience for any application. Contributions are more than welcome! Please read our Contributing Guide.

  • Chat UI agnostic. You can choose the chat UI you prefer. But if you don't have one, we provide our own free and open-source Flutter Chat UI, which can be used to create a working chat in minutes.

  • Easy to use. Returns streams of data for messages, rooms and users. Supabase Security Rules control access to the data. Check our documentation for the info.

Getting Started #

The example project that you find in the package repository allows you to have a cross-platform chat app in just a few minutes.

Requirements #

Dart >=2.19.0 and Flutter >=3.0.0, Supabase project.

Prepare Supabase project

Inside the example project (example/utils) there is a script, running the latter will automatically configure the Supabase project, creating tables, security rules, buckets and everything that is necessary for the example project to function.

In order to run the script you need to be aware of the following information about your Supabase project:

  • host : Project host
  • port : Database port
  • database : Database name
  • user : Database user
  • password : Database password

This information, with the exception of the password which is provided only during the creation of the database (if necessary, you can use the password reset function of your database to obtain it), can be found very easily from the Dashboard of your Supabase project:

Supabase dashboard database info

Running prepare script

Below are the commands for running the scripts (During execution you will be asked for the password for your database user):

Linux

cd ./example/utils/
./prepare.sh -h "your-postgres-host" -p your-postgres-port -d "your-postgres-database-name" -U "your-postgres-user"

Windows

cd .\example\utils\
.\prepare.ps1 -hostname "your-postgres-host" -port your-postgres-port -database "your-postgres-database-name" -user "your-postgres-user"

Read our documentation or see the example project. To run the example project you need to have your own Supabase project and then follow Add Supabase to your Flutter app, override example/lib/supabase_options.dart, don't commit it though 😉

After all of this is done you will need to register a couple of users and the example app will automatically suggest email and password on the register screen, default password is Qawsed1-. To set up Supabase Security Rules so users can see only the data they should see, continue with our documentation.

Contributing #

Please read our Contributing Guide before submitting a pull request to the project.

Code of Conduct #

Flyer Chat has adopted the Contributor Covenant as its Code of Conduct, and we expect project participants to adhere to it. Please read the full text so that you can understand what actions will and will not be tolerated.

License #

Licensed under the Apache License, Version 2.0

Example project progress #

Below are the features implemented for each platform:

Feature Web Android iOS Windows macOS Linux
Signup
Signin
Rooms list screen
Create direct room
Create group room
Create channel room
Chat screen
Search room
Upload image
Preview image message
Upload file
Download file

RLS (Row level security) #

The preparation script automatically configures the security rules on the database tables and storage buckets, below is a summary of the rules that are applied:

Tables #

Table chats.users

  • INSERT : Nobody, this table is populate by trigger on auth.users.
  • SELECT : All users authenticated.
  • UPDATE : Only the user himself.
  • DELETE : Nobody.

Table chats.rooms

  • INSERT : All users authenticated.
  • SELECT : All users who are members of the chat room.
  • UPDATE : All users who are members of the chat room.
  • DELETE : All users who are members of the chat room.

Table chats.messages

  • INSERT : All users who are members of the chat room.
  • SELECT : All users who are members of the chat room.
  • UPDATE : All users who are members of the chat room.
  • DELETE : All users who are members of the chat room.

Storage buckets #

Bucket chats_assets

  • INSERT : All users who are members of the chat room.
  • SELECT : All users who are members of the chat room.
  • UPDATE : All users who are members of the chat room.
  • DELETE : All users who are members of the chat room.

Bucket chats_user_avatar

  • INSERT : Only the user himself.
  • SELECT : All users authenticated.
  • UPDATE : Only the user himself.
  • DELETE : Only the user himself.

Activities to complete (Roadmap) #

Below are some activities to complete to have a more complete and optimized project also for use cases in larger projects.

  1. Check the correct functioning of the RLS security rules
  2. Add the missing triggers
  3. Optimization of the join of users who are part of a chat room. At the moment every time you want to get a chat room a SELECT is performed to get the users of the chat room. It does not perform as the chat rooms or users present in them grow.
  4. Error handling
  5. Chat room groups
  6. Chat room channels
  7. Sending audio messages
  8. Improve documentation
14
likes
0
pub points
62%
popularity

Publisher

verified publisherinsideapp.it

Actively maintained, community-driven Supabase BaaS for chat applications with an optional chat UI.

Homepage
Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

dio, flutter, flutter_chat_types, meta, supabase_flutter

More

Packages that depend on flutter_supabase_chat_core