A chat app demo for Windows made for practice and example purposes using WPF and Firebase Realtime Database with FireSharp.
More information about the techs used and images of the app as well as the database and project structure are listed below.
- Technology: Windows Presentation Foundation (.Net Framework 4.8) themed with MahApps.Metro.
- Choice Rationale: Opted for WPF due to its suitability for rapid development and lack of cross-platform requirements. Would consider Avalonia if cross-platform functionality were needed.
- Framework Version: Selected .Net Framework 4.8 for WPF as it's pre-installed on modern Windows machines, eliminating the need to package the runtime with the app. Utilized build tools/extensions for a compact build.
- Database: Used Firebase Realtime Database with FireSharp as the API.
- Implementation: Backend operations are mainly handled in a single class named ChatDatabase, a basic wrapper around FireSharp tailored for my usage, utilizing FireSharp API features such as
FirebaseConfig
,FirebaseClient
,Client.GetAsync
,Client.SetAsync
,Client.DeleteAsync
,Client.PushAsync
, andClient.OnAsync
. - Security Measures: Used Bcrypt.Net-Next for hashing and salting passwords before storage in the database, caring for security even in a demo environment.
You can see 2 messages sent by the currently logged in client. The username and the nickname is visible on the title.
You can also choose to set your nickname as "anonymous" on your messages if you want to. The actual senders username is still sent to the database.
I used the Grid control to scale up the height of the messages ListView when relevant so more messages can be viewed on fullscreen and made the app more responsive.
Also noticee this image is from another client with a different logged in account.
This screen is displayed if the connection with the database is not established.
The DatabaseTester class is made for console apps and I left it on the project as a reference.
Usernames are used as primary keys. Message keys are generated by Firebase/FireSharp itself when they are pushed into the Messages table.
- The secret key and database path are hardcoded.
- This setup suits my use case as I'm on a Spark (free) account; excess requests are simply denied by the server.
- Permissions are not configured, meaning anyone can manipulate data. Exercise caution and avoid using real passwords.
- The project lacks a proper commit history due to not starting with version control. In fact, almost all of the commit history is readme updates.
- Originally developed using Winforms, but due to compatibility issues with my custom DPI settings, I rewrote the app using WPF.
- I considered Avalonia when Winforms became problematic first, but with my knowledge of WPF/xaml/MVVM led to choosing WPF as it would be easier and Avalonia would simply be overkill.
- Opting for WPF also reduced the executable size to ~2.5 MB, which I find favorable.