diff options
author | Santo Cariotti <santo@dcariotti.me> | 2025-04-22 10:54:15 +0200 |
---|---|---|
committer | Santo Cariotti <santo@dcariotti.me> | 2025-04-22 10:54:15 +0200 |
commit | 0f9edf2a87b068183016e8553dee5bb8b8dc4803 (patch) | |
tree | 31326b3a01f1daa02fad5bb09de066e976d8ad21 | |
parent | 71520594ca2ae593b64039a765a9d908565968c8 (diff) |
Add README and LICENSE
-rw-r--r-- | LICENSE.md | 28 | ||||
-rw-r--r-- | README.md | 69 | ||||
-rw-r--r-- | assets/demo.mp4 | bin | 0 -> 526181 bytes | |||
-rw-r--r-- | assets/demo.png | bin | 115008 -> 0 bytes |
4 files changed, 96 insertions, 1 deletions
diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..e1e0522 --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,28 @@ +BSD 3-Clause License + +Copyright (c) 2025, Santo Cariotti + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. @@ -1,3 +1,70 @@ # Rahanna - +A peer-to-peer (P2P) chess game with a Terminal User Interface (TUI). + +[video.mp4](https://raw.githubusercontent.com/boozec/rahanna/main/assets/demo.mp4) + +> _Disclaimer:_ +> This project is a university exercise for a Distributed Systems class. While it seems to function correctly, Rahanna is not intended for production use. The UI opens network ports that should not be exposed in secure environments. + +--- + +Rahanna enables two players to play chess directly via a TCP connection — no centralized server manages the game state. Moves are sent in real time over the network, and only the final outcome is stored. + +- P2P gameplay over TCP. +- TUI-based interface. +- Lightweight REST API for user authentication and matchmaking. +- No need to know your opponent's IP address - just the unique game name. + +Even though Rahanna is a P2P application, it relies on a central Rahanna API for: + +- User authentication and registration. +- Match discovery. + +No gameplay data is stored centrally — only metadata (e.g., game outcomes). + +## Build + +Make sure you have Go 1.24+ and Git installed. + +``` +$ git clone github.com/boozec/rahanna.git +$ # make all or +$ go build -o rahanna-ui cmd/ui/main.go +``` + +If you want to also makes up an API server, run + +``` +$ go build -o rahanna-api cmd/api/main.go +``` + +## Run + +Now, you can just run the one (or two) executables you just builded after an environment setup: + +``` +export API_BASE="http://localhost:8080" +``` + +Or, if you also want to make up the API: + +``` +export POSTGRES_USER=postgres +export POSTGRES_DB=rahanna +export POSTGRES_PASSWORD=password +export DATABASE_URL="host=localhost user=postgres password=password dbname=rahanna port=5432" +export JWT_TOKEN="..." +export RAHANNA_API_ADDRESS=":8080" +export DEBUG=1 +``` + +If you are more lazy, you just can make everything up thanks to Docker. + +``` +# Start the API and database +docker compose -f docker/api/docker-compose.yml up + +# In another terminal, run the UI +docker run -e API_BASE=http://0.0.0.0:8080 -it --network host rahanna-ui:latest +``` diff --git a/assets/demo.mp4 b/assets/demo.mp4 Binary files differnew file mode 100644 index 0000000..995ab3e --- /dev/null +++ b/assets/demo.mp4 diff --git a/assets/demo.png b/assets/demo.png Binary files differdeleted file mode 100644 index ad55d0d..0000000 --- a/assets/demo.png +++ /dev/null |