{"id":44416488,"url":"https://github.com/adhupraba/go-discord","last_synced_at":"2026-02-12T08:34:36.797Z","repository":{"id":194847884,"uuid":"691423901","full_name":"adhupraba/go-discord","owner":"adhupraba","description":"An end-to-end fullstack and real-time discord clone, all with servers, channels, video calls, audio calls, editing and deleting messages as well as member roles.","archived":false,"fork":false,"pushed_at":"2025-01-04T07:23:20.000Z","size":899,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-04T07:33:08.890Z","etag":null,"topics":["clerk-auth","docker","docker-compose","golang","livekit","nextjs","postgresql","uploadthing"],"latest_commit_sha":null,"homepage":"https://discord.adhupraba.com","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/adhupraba.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2023-09-14T06:40:38.000Z","updated_at":"2025-01-04T07:23:25.000Z","dependencies_parsed_at":null,"dependency_job_id":"9261f663-b85c-497d-afae-1f6fa010e3fc","html_url":"https://github.com/adhupraba/go-discord","commit_stats":null,"previous_names":["adhupraba/discord-client","adhupraba/go-discord"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/adhupraba/go-discord","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adhupraba%2Fgo-discord","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adhupraba%2Fgo-discord/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adhupraba%2Fgo-discord/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adhupraba%2Fgo-discord/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/adhupraba","download_url":"https://codeload.github.com/adhupraba/go-discord/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adhupraba%2Fgo-discord/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29361819,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-12T01:03:07.613Z","status":"online","status_checked_at":"2026-02-12T02:00:06.911Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["clerk-auth","docker","docker-compose","golang","livekit","nextjs","postgresql","uploadthing"],"created_at":"2026-02-12T08:34:36.068Z","updated_at":"2026-02-12T08:34:36.792Z","avatar_url":"https://github.com/adhupraba.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Go Discord\n\nAn end-to-end fullstack and real-time discord clone, all with servers, channels, video\ncalls, audio calls, editing and deleting messages as well as member roles.\n\nThis project is live at: https://discord.adhupraba.com\n\nKey Features:\n\n- Real-time messaging using sockets\n- Send attachments as messages using UploadThing\n- Delete \u0026 Edit messages in real time for all users\n- Create Text, Audio and Video call Channels\n- 1:1 conversation between members\n- 1:1 video calls between members\n- Member management (Kick, Role change Guest / Moderator)\n- Unique invite link generation \u0026 full working invite system\n- Infinite loading for messages in batches of 10 (@tanstack/query)\n- Server creation and customization\n- Beautiful UI using TailwindCSS and ShadcnUI\n- Full responsivity and mobile UI\n- Light / Dark mode\n- Websocket fallback: Polling with alerts\n- Authentication with Clerk\n- High performance backend written in Go\n\n---\n\n## **Table of Contents**\n\n- [Setup Instructions](#setup-instructions)\n  - [Running with Docker](#running-with-docker)\n  - [Running Locally](#running-locally)\n    - [Backend Setup](#backend-setup-django-server)\n    - [Frontend Setup](#frontend-setup-react-client)\n- [Cross Site Cookies](#cross-site-cookies)\n- [API Access](#api-access)\n\n---\n\n## **Setup Instructions**\n\n### **Running with Docker**\n\nThe project includes a Docker setup for running both the client and server simultaneously.\n\n1. **Setup Environment Variables**:\n\n- In the project root, copy `.env.example` to `.env`:\n\n  ```bash\n  cp .env.client.example .env.client\n  cp .env.server.example .env.server\n  ```\n\n- Update the `.env.client` and `.env.server` files with appropriate values.\n\n2. **Connecting to local database from the Docker containers**:\n\n\u003e Note: Step 2 not needed if you are using a cloud hosted database/redis or a postgres/redis service in the compose file.\n\n- If you are using a local database and want to connect to the application, some changes to the env are needed.\n\n- Identify the `docker0` interface's ip address:\n\n  ```bash\n  ip addr show docker0\n  ```\n\n- Copy the `inet` ipv4 address. It will look like this `127.17.0.1`.\n\n- Update the `/etc/hosts` in the host machine.\n\n  ```bash\n  172.17.0.1 host.docker.internal\n  ```\n\n- Update the hostname of database in .env.server\n\n  ```bash\n  DB_URL=postgresql://\u003cuser\u003e:\u003cpassword\u003e@172.17.0.1:5432/\u003cdbname\u003e\n  ```\n\n3. **Adding new environment variables (Important)**:\n\nWhenever a new `NEXT_PUBLIC_` env needs to be added to the client, make sure to update the `dockerfile.dev.client` and `dockerfile.prod.client` with a placeholder value and add that env entry into `entrypoint.sh` so at runtime the placeholder is replaced with appropriate value taken from the supplied `.env.client` file to the docker compose file.\n\n4. **Build and Run the Docker Containers**:\n\n- From the project root directory, run:\n\n  ```bash\n  docker compose -f docker-compose.dev.yaml up --build\n  ```\n\n5. **Access the application**:\n\n- Frontend: `http://localhost:4600/`\n\n- Backend: `http://localhost:4601/gateway/`\n\n### **Running Locally**\n\n#### **Backend Setup (Go Server)**\n\n1. **Navigate to the Server Directory**:\n\n```bash\ncd server\n```\n\n2. **Install Dependencies**:\n\n```bash\ngo install github.com/pressly/goose/v3/cmd/goose@latest\ngo install github.com/go-jet/jet/v2/cmd/jet@latest\ngo install github.com/githubnemo/CompileDaemon@latest\ngo install github.com/sqlc-dev/sqlc/cmd/sqlc@latest\ngo mod tidy\n```\n\n3. **Setup Environment Variables**:\n\n- Copy `.env.example` to `.env`:\n\n  ```bash\n  cp .env.example .env\n  ```\n\n- Update the `.env` file with appropriate values\n\n4. **To generate SQL migrations**\n\n```bash\ngoose create \u003cmodel_name\u003e sql\n```\n\n5. **Apply Migrations**:\n\n```bash\nsh migrate.sh\n```\n\n6. **During development, to generate Go code for the SQL migrations and queries**:\n\n```bash\nsh gen.sh\n```\n\n7. **Start the dev server**:\n\n```bash\nCompileDaemon --command=\"./discord-server\"\n```\n\n8. **Build for production**:\n\n- General production build\n\n  - Generate build executable\n\n    ```bash\n    go build -tags netgo -ldflags '-s -w' -o discord-server\n    ```\n\n  - Run the server\n\n    ```bash\n    ./discord-server\n    ```\n\n- To produce a more compressed and efficient executable\n\n  - Install `upx` package from `apt`\n\n    ```bash\n    sudo apt install upx\n    ```\n\n  - Generate build executable\n\n    ```bash\n    go build -tags netgo -ldflags '-s -w' -o discord-server\n    ```\n\n  - Generate a `upx` executable\n\n    ```bash\n    upx --best --lzma -o discord-server.upx discord-server\n    ```\n\n  - Run the `upx` executable\n\n    ```bash\n    ./discord-server.upx\n    ```\n\n---\n\n#### **Frontend Setup (Next.js)**\n\n1. **Navigate to the Client Directory**:\n\n```bash\ncd client\n```\n\n2. **Install Dependencies**:\n\n```bash\nnpm install\n```\n\n3. **Setup Environment Variables**:\n\n- Copy `.env.example` to `.env`:\n\n  ```bash\n  cp .env.example .env\n  ```\n\n- Update the `.env` file with appropriate values\n\n4. **Start the Frontend Development Server**:\n\n```bash\nnpm run dev\n```\n\n5. **Build for production**\n\n```bash\nnpm run build\n```\n\n---\n\n## **Cross Site Cookies**\n\n\u003e Cross site cookies are cookies set in the client from a different domain. Client and server are under different domains. eg: Client - http://localhost:4600 or https://www.abc.com, Server - http://localhost:4601 or https://www.def.com\n\nNormally cross-site cookies are not sent to the server if server is in a different domain. So as a work around what is done is to implement a `api path rewrite` in the `next.config.js`\n\nAll backend requests from the ui are made to a dummy `\u003cfrontend_url\u003e/gateway/...` nextjs endpoint which in turn gets redirected to the actual backend api due to the rewrite rule.\n\n\u003e This backend api path rewrite is implemented only for local development. In production it is better to handle using a web server like `nginx` or `apache`.\n\nIn this way we are able to send our own cross site cookies to our server which was previously not possible\n\n---\n\n## **API Access**\n\nTo test backend endpoints, use tools like Postman or curl.\nExample endpoint for health check:\n\n```bash\nPOST http://localhost:4601/gateway/health/heartbeat/\n```\n\n---\n\nYou’re now ready to run and develop Discord locally or using Docker! 🚀\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadhupraba%2Fgo-discord","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fadhupraba%2Fgo-discord","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadhupraba%2Fgo-discord/lists"}