WhutzApp is a realtime chat application built with Next JS (Node JS + React), tRPC, SQLite, Tailwind CSS, Pusher and other technologies. This chat app was designed originally for the web, but can also work on mobile devices.
- 🗝 Sign up or sign in with Google
- 🗨 Create 1-on-1 conversations
- 📬 Send text and images, reply to messages, and react with emojis
- 🔔 Get sound notifications for new unseen messages that arrive (feature added by Dmitry Kulakov)
React
Next JS (full-stack framework)
tRPC (API)
SQLite (Database)
AWS S3 (object storage)
Tailwind CSS (styling)
Pusher (websocket service)
While completing this project, I deepened my understanding of how to write maintainable code for more complex systems.
- Single Responsibility Principle: Creating reusable hooks gave me an appreciation for how to build complex front-end systems by encapsulating reusable logic. For example, I created the
usePusher
hook which allowed for connecting to the Pusher (websocket service) client on the front-end and theuseScrollToBottomOfChat
hook which allowed for scrolling to the bottom of the chat thread when new messages arrived over websocket events.
- AWS S3: Over the course of the project, I learned about how to create S3 bucket policies, create pre-signed URLs with upload conditions as well as using multipart form uploads on the front-end to directly upload to S3 servers.
- Jotai: As the project became more complex, using local state within React would require too much prop-drilling and React Context would force unnesssary re-renders of the entire application. So I reached for Jotai, a minimal global state management solution, which helped solve the problem of global state management without the extra re-renders that would come with React context.
- tRPC: This application uses tRPC as the API framework responsible for communicating between the front-end and back-end. Using tRPC made me really appreciate the power of typescript because I was able to validate my code from the database layer all the way to my front-end. This allowed me to move fast and make sweeping changes without having to worry about regressions.
In terms of technical design, I'm currently in the process of refactoring my code to fully implement the clean architecture principles popularized by Robert Martin. My goal is to make sure I have clear layers of separation in my backend code for my entities, business logic (use cases), database access and other framework code.
In terms of functionality, I would love to add the ability to have group chats and send voice messages using the app.
If you would like to contribute to the project or run it locally, you will need to:
- Create a turso account for the DB url
- Get a Google client id and secret from the google console
- Get Pusher credentials for the front-end and back-end
After these services are setup you can run:
git clone https://github.com/abdulqshabbir/whutz-app.git
(clone repo)cd whutz-app
(move into project directory)- Add a
.env
file to the project with all secrets from the steps above (see.env.example
for examples) yarn
(install dependencies)yarn dev
(start development server)- Navigate to
http://localhost:3000
andhttp://localhost:3000/signup
to see the project running - Open a new terminal window and run
yarn studio
and click the link in the terminal to open up a GUI for interacting with the database
Please get in touch if you would like help running it locally. Ultimately, I would like to dockerize the application so it is easier to run in a local environment.