{"id":26746687,"url":"https://github.com/florianpfleiderer/mini_chat_server","last_synced_at":"2025-10-24T17:10:07.477Z","repository":{"id":284818474,"uuid":"956165954","full_name":"florianpfleiderer/mini_chat_server","owner":"florianpfleiderer","description":"A minimal chat server built with Erlang/OTP. Demonstrates lightweight processes, message passing, supervision, and OTP application structure. ","archived":false,"fork":false,"pushed_at":"2025-03-27T20:05:52.000Z","size":8,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-27T21:23:07.089Z","etag":null,"topics":["concurrent-programming","distributed-systems","erlang","erlang-otp"],"latest_commit_sha":null,"homepage":"","language":"Erlang","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/florianpfleiderer.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-03-27T20:01:19.000Z","updated_at":"2025-03-27T20:20:45.000Z","dependencies_parsed_at":"2025-03-27T21:23:11.609Z","dependency_job_id":"baba0eae-e019-40f9-ae09-9c94930f1433","html_url":"https://github.com/florianpfleiderer/mini_chat_server","commit_stats":null,"previous_names":["florianpfleiderer/mini_chat_server"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/florianpfleiderer%2Fmini_chat_server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/florianpfleiderer%2Fmini_chat_server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/florianpfleiderer%2Fmini_chat_server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/florianpfleiderer%2Fmini_chat_server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/florianpfleiderer","download_url":"https://codeload.github.com/florianpfleiderer/mini_chat_server/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245999620,"owners_count":20707572,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["concurrent-programming","distributed-systems","erlang","erlang-otp"],"created_at":"2025-03-28T09:15:04.866Z","updated_at":"2025-10-24T17:10:02.455Z","avatar_url":"https://github.com/florianpfleiderer.png","language":"Erlang","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 📡 mini_chat – A Minimal Chat Server in Erlang\n\n**mini_chat** is a simple OTP-style Erlang application that demonstrates how to build a basic chat server using:\n\n- `gen_server` for process behavior  \n- `supervision` for fault-tolerance  \n- `application` for structured startup  \n\nEach chat user runs in their own Erlang process and can send or receive messages. The chat server also acts as a central dispatcher for general messages.\n\n---\n\n## 📁 Project Structure\n\n```\nmini_chat/\n├── ebin/                      # Compiled .beam files + .app file\n│   ├── mini_chat.app\n├── src/                       # Erlang source files\n│   ├── mini_chat_app.erl      # Application entry point\n│   ├── mini_chat_sup.erl      # Supervisor\n│   ├── mini_chat_server.erl   # Chat server process\n│   ├── mini_chat_user.erl     # User process module\n├── mini_chat.app.src          # Application spec\n```\n\n---\n\n## 🛠️ Setup \u0026 Compilation\n\nMake sure you have Erlang installed (OTP 21 or later).\n\n### 1. Compile all `.erl` source files\n\n```bash\nerlc -o ebin src/*.erl\n```\n\n### 2. Start the Erlang shell with code path\n\n```bash\nerl -pa ebin\n```\n\n---\n\n## 🚀 Running the Application\n\nIn the Erlang shell:\n\n```erlang\n1\u003e application:load(mini_chat).\n2\u003e application:start(mini_chat).\n```\n\nYou should see:\n\n```erlang\n{ok,mini_chat}\n```\n\n---\n\n## 💬 Using the Chat System\n\n### Start users\n\n```erlang\n3\u003e mini_chat_user:start_link(alice).\n4\u003e mini_chat_user:start_link(bob).\n```\n\n### Send a message to a user\n\n```erlang\n5\u003e mini_chat_user:send(alice, \"Hello from Bob!\").\n```\n\n**Output:**\n```\n[alice] received: \"Hello from Bob!\"\n```\n\n### Send a message to the server\n\n```erlang\n6\u003e mini_chat_server:send_msg(bob, \"This is a global server message\").\n```\n\n**Output:**\n```\nbob says: \"This is a global server message\"\n```\n\n---\n\n## 🧠 What This App Demonstrates\n\n- How to structure OTP applications\n- How to use `gen_server` to encapsulate logic and state\n- How to supervise components for reliability\n- How to pass messages between processes\n\n---\n\n## 🛡️ Fault Tolerance\n\nIf any supervised process crashes, it will be automatically restarted by `mini_chat_sup`, preserving the system’s availability.\n\n---\n\n## 📚 Learn More\n\n- [Erlang OTP Design Principles](https://www.erlang.org/doc/design_principles/des_princ.html)\n- [The `gen_server` Behaviour](https://www.erlang.org/doc/man/gen_server.html)\n- [Supervisors in OTP](https://www.erlang.org/doc/design_principles/sup_princ.html)\n\n---\n\n## 📦 Future Ideas\n\n- Add a registry for active users\n- Allow users to broadcast messages\n- Persist chat history in ETS or Mnesia\n- Turn into a distributed chat across nodes!\n\n---\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflorianpfleiderer%2Fmini_chat_server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fflorianpfleiderer%2Fmini_chat_server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflorianpfleiderer%2Fmini_chat_server/lists"}