This repository contains the backend code for a realtime chat application. The backend is written in Go and uses WebSockets for real-time communication and Redis for data storage. This project was developed as part of my learning journey in software development, and while it implements basic functionality, it may not follow all best practices.
The app right now is deployed with docker(docker-compose file that setups the frontend, backend and the redis database) and runs in a cloud vm hosted on digital ocean. The following link may be available for testing: http://app.chatluiz.tech
- User Handling and Authentication: Basic user management and authentication mechanisms.
- Message Saving: Stores chat messages for retrieval.
- WebSocket Communication: Real-time messaging using WebSockets.
- Redis Integration: Uses Redis for data storage.
- Docker Deployment: Easily deployable locally using Docker.
main.go: Entry point of the application. Sets up routes and starts the server.pkg/websocket/: Contains the WebSocket implementation.client.go: Manages individual WebSocket connections.helpers.go: Utility functions for WebSocket operations.pool.go: Manages a pool of WebSocket connections.structs.go: Defines data structures used in WebSocket communication.websocket.go: Initializes WebSocket connections and handles incoming requests.
Dockerfile: Docker configuration for building and running the application locally.go.mod: Go module file listing dependencies.
- Go 1.17 or later
- or Docker
-
Clone the repository:
git clone https://github.com/luque667788/chatapp-backend.git cd chatapp-backend -
Build and run using Docker:
docker build -t chatapp-backend . docker run -p 8080:8080 chatapp-backend -
Remeber to have the frontend repo and the redis server running
- This project was developed early in my learning curve as a software developer. As such, it may not follow all best practices.
- There is a frontend repository available that complements this backend. You can find it here.
Feel free to fork this repository and submit pull requests. Any contributions to improve the code quality and add new features are welcome!
This project is licensed under the MIT License.
Thank you for checking out this project! If you have any questions or feedback, feel free to open an issue or contact me directly. https://www.linkedin.com/in/luiz-henrique-salles-de-oliveira-mendon%C3%A7a-3963b928b/