__ _ _ _ ___ _ _ / /(_)_ __ | | _(_)_ __ / __\ |__ __ _| |_ / / | | '_ \| |/ / | '_ \ / / | '_ \ / _` | __| / /__| | | | | <| | | | | / /___| | | | (_| | |_ \____/_|_| |_|_|\_\_|_| |_| \____/|_| |_|\__,_|\__|
Linkin Chat is a TUI (Text User Interface) based chat application that uses HTTP and NATS for communication and broadcasting messages between the client and server.
- Table Of Content
- Tech Stack
- Prerequisites
- Development Workflow
- Deployment Workflow
- Installing the Client
- Creating a Release
- Additional Notes
- Features
- Known Issues
- Planned Improvements
- Test video
- Server
- Database
- Postgres
- Tools
- Docker
- Makefile
- Cache
- Redis
- Config
- Client
- UI: tview
- Release: Goreleaser
- CLI: Cobra
Before you begin, ensure you have the following tools installed:
- Docker: Install Docker
- Docker Compose: Included with Docker Desktop or install separately (Docker Compose Documentation)
- GoReleaser (optional, for release creation): Install GoReleaser
Make sure your project directory follows the structure defined in the Makefile (e.g., ./build/nats
, ./build/redis
, ./build/postgres
, and ./build/server
).
To spin up the development environment:
make dev_up
This will:
- Ensure the Docker network
linkin-chat-network
exists. - Start the development versions of NATS, Redis, and PostgreSQL containers defined in the
docker-compose.dev.yaml
files.
To start the development environment and stream logs to the console:
make dev_uplog
To stop and remove all running containers in the development environment:
make dev_down
To build or rebuild development containers:
make dev_build
To view logs from all containers in the development environment:
make dev_logs
To rebuild and restart containers for the development environment:
make dev_rebuild
To deploy the application in production:
make deploy
This will:
- Ensure the Docker network
linkin-chat-network
exists. - Start the production versions of NATS, Redis, PostgreSQL, and the server containers defined in the
docker-compose.prod.yaml
files.
To stop and remove all running containers in the production environment:
make deploy-down
To view logs from all containers in the production environment:
make deploy-logs
To view logs from a specific container in production:
make deploy-log CONTAINER=<container_name>
Replace <container_name>
with the name of the container.
To build or rebuild production containers:
make deploy-build
- Download the
.deb
file matching your architecture from the Releases Section:- For 64-bit systems:
linkin-chat_version-SNAPSHOT-x_linux_amd64.deb
- For ARM64 systems:
linkin-chat_version-SNAPSHOT-x_linux_arm64.deb
- For 32-bit systems:
linkin-chat_version-SNAPSHOT-x_linux_386.deb
- For 64-bit systems:
- Install the package using
dpkg
:sudo dpkg -i linkin-chat_*.deb
- Verify the installation:
linkin-chat --help
- Download the
.tar.gz
file matching your architecture from the Releases Section:- For ARM64:
linkin-chat_Darwin_arm64.tar.gz
- For x86_64:
linkin-chat_Darwin_x86_64.tar.gz
- For ARM64:
- Extract the archive:
tar -xzf linkin-chat_Darwin_*.tar.gz
- Move the binary to a directory in your PATH:
sudo mv linkin-chat /usr/local/bin/linkin-chat
- Verify the installation:
linkin-chat --help
- Download the
.zip
file matching your architecture from the Releases Section:- For 64-bit systems:
linkin-chat_Windows_x86_64.zip
- For 32-bit systems:
linkin-chat_Windows_i386.zip
- For ARM64:
linkin-chat_Windows_arm64.zip
- For 64-bit systems:
- Extract the archive using a tool like WinRAR or 7-Zip.
- Move the
linkin-chat.exe
file to a directory in your PATH (e.g.,C:\Program Files\LinkinChat
). - Add the directory to your system's PATH environment variable if not already set.
- Verify the installation:
linkin-chat.exe --help
To create a release snapshot using GoReleaser:
make create_release
This will generate a snapshot release of the project.
- The Makefile ensures that the Docker network
linkin-chat-network
exists before executing commands. This prevents network-related issues when starting containers. - For troubleshooting or customization, refer to the
Makefile
for exact command definitions and paths.
Linkin Chat provides the following core functionalities:
- Create User: Register a new user.
- Login User: Log in to the application with your credentials.
- Create Chatroom: Start a new chatroom for communication.
- Delete Chatroom: Remove an existing chatroom that you own.
- Join Chatroom: Join a chatroom to start chatting with others.
- Delete Your Chatroom: Remove the chatrooms you created.
Users can navigate through the interface using:
- Tab and Shift+Tab to move between objects.
- Arrow Keys (Up/Down) to select items in a list.
- Nats Authentication & Authorization
- Hardcoded Variables: Some variables in the code are hardcoded, which may cause inflexibility and potential errors.
- Logging systems for containers, servers, and clients.
- Integration of the zap logging library.
- Ban user feature.
- Cache queries.
This aspect required extensive effort to balance security, performance, and functionality within the limited timeframe.
Once the foundational features are stable, the following improvements and features are planned:
- Add a fully functional chatroom experience with message persistence.
- Implement logging systems for better observability.
- Add security enhancements for user authentication and NATS connections.
- Introduce the "ban user" feature for moderators to manage chatrooms.
- Refactor code to remove hardcoded variables and improve configurability.