{"id":17972664,"url":"https://github.com/vasanthv/ahey","last_synced_at":"2025-05-16T12:12:38.346Z","repository":{"id":274559919,"uuid":"923311571","full_name":"vasanthv/ahey","owner":"vasanthv","description":"a simple pub-sub over web push","archived":false,"fork":false,"pushed_at":"2025-02-07T22:03:29.000Z","size":2039,"stargazers_count":348,"open_issues_count":2,"forks_count":17,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-09T05:07:22.651Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://ahey.io","language":"JavaScript","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/vasanthv.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":"2025-01-28T02:06:16.000Z","updated_at":"2025-03-27T18:58:35.000Z","dependencies_parsed_at":"2025-01-28T03:22:18.365Z","dependency_job_id":"f3229186-e37e-482e-89ef-3e8b91102ae4","html_url":"https://github.com/vasanthv/ahey","commit_stats":null,"previous_names":["vasanthv/ahey"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vasanthv%2Fahey","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vasanthv%2Fahey/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vasanthv%2Fahey/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vasanthv%2Fahey/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vasanthv","download_url":"https://codeload.github.com/vasanthv/ahey/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254527099,"owners_count":22085919,"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":[],"created_at":"2024-10-29T16:24:34.834Z","updated_at":"2025-05-16T12:12:33.325Z","avatar_url":"https://github.com/vasanthv.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# Ahey.io\n\nAhey.io is a simple pub-sub system over web push. It allows users to subscribe to channels and receive messages directly to their browser without the need for an account. Publishers can send messages to regular channels after logging in, while user channels are personal and only the user who created the channel can publish to them.\n\n## Features\n\n- Subscribe to channels without an account.\n- Publish to regular channels if authenticated.\n- Personal user channels (in the `@username` format).\n- Messages stored for 24 hours.\n- Open-source and free to use.\n\n### Channel Types\n\nAhey.io supports two types of channels:\n\n1. **Regular Channels**: Any authenticated user can publish messages to these channels.\n2. **User Channels**: These are personal channels in the format `@username`. Only the user who created the channel can publish to it, but anyone can subscribe.\n\n## API Documentation\n\n### Authentication\n\nTo interact with the API and publish to a channel, you must log in and obtain an API key. The API key will be used for authentication in subsequent requests.\n\n### API Endpoints\n\n#### 1. `/push/:channel` - Send a push notification to a channel\n\n- **Method:** `POST`\n- **Description:** Sends a push notification to a specific channel.\n- **Authentication**: Requires an API key passed in the X-API-KEY header.\n- **URL Format:** `/push/:channel` where `:channel` is the channel name.\n- **Body Example:**\n\n  ```json\n  {\n  \t\"body\": \"Your push content\"\n  }\n  ```\n\n- **Response Example:**\n\n  ```json\n  {\n  \t\"message\": \"Pushed successfully\"\n  }\n  ```\n\n  ```bash\n  curl -X POST \"https://ahey.io/api/push/channel-name\" \\\n      -H \"X-API-KEY: your-api-key\" \\\n      -H \"Content-Type: application/json\" \\\n      -d '{\"body\": \"Your push content\"}'\n  ```\n\n#### 2. `/pull/:channel` - Retrieve the latest pushes from a channel\n\n- **Method:** `GET`\n- **Description:** Retrieves the latest 50 messages from a specific channel.\n- **Authentication**: Requires an API key passed in the X-API-KEY header.\n- **Query Parameter:**\n  - `skip` (optional) - Skips the first `n` messages in the channel (useful for pagination).\n- **URL Format:** `/pull/:channel` where `:channel` is the channel name.\n- **Response Example:**\n\n  ```json\n  {\n  \t\"pushes\": [\n  \t\t{\n  \t\t\t\"from\": { \"username\": \"john\" },\n  \t\t\t\"body\": \"Hello, world!\",\n  \t\t\t\"channel\": \"test-channel\",\n  \t\t\t\"date\": \"2025-01-28T19:07:40.011Z\"\n  \t\t}\n  \t],\n  \t\"subscribers\": 10\n  }\n  ```\n\n  ```bash\n  curl -X GET \"https://ahey.io/api/pull/channel-name?skip=0\" \\\n      -H \"X-API-KEY: your-api-key\"\n  ```\n\n#### 3. `/me` - Get current user's details\n\n- **Method:** `GET`\n- **Description:** Returns details of the currently authenticated user.\n- **Authentication**: Requires an API key passed in the X-API-KEY header.\n- **Response Example:**\n\n  ```json\n  {\n  \t\"username\": \"john_doe\",\n  \t\"email\": \"john@example.com\",\n  \t\"joinedOn\": \"2025-01-01T12:00:00Z\",\n  \t\"savedChannels\": [\"channel-1\", \"channel-2\"]\n  }\n  ```\n\n  ```bash\n  curl -X GET \"https://ahey.io/api/me\" \\\n      -H \"X-API-KEY: your-api-key\"\n  ```\n\n## Local Development\n\nTo get started with Ahey locally, follow these steps:\n\n### 1. Clone the repository\n\nStart by cloning the Ahey repository to your local machine:\n\n```bash\ngit clone https://github.com/vasanthv/ahey.git\ncd ahey\n```\n\n### 2. Install dependencies\n\nInstall the necessary dependencies for the project, including the MongoDB package:\n\n```bash\nnpm install\n```\n\nMake sure you have MongoDB running locally or use a MongoDB cloud service like [MongoDB Atlas](https://www.mongodb.com/cloud/atlas).\n\n### 3. Generate VAPID credentials\n\nRun the following command to generate your VAPID credentials, which are required for push notifications:\n\n```bash\nnpm run gen:vapid\n```\n\nMake sure to store the generated credentials safely, as you'll need them for production.\n\n### 4. Configure\n\nUpdate the `server/config.js` file with your MongoDB connection string \u0026 vapid details.\n\n- Open `server/config.js` in the root directory.\n- Update the `MONGODB_URI` variable with your local MongoDB URI or connection string from MongoDB Atlas.\n- Update your vapid details.\n\n### 5. Start the development server\n\nLaunch the development server with:\n\n```bash\nnpm start\n```\n\nBy default, the server will run on [http://localhost:3000](http://localhost:3000). You can now access your local instance of Ahey!\n\n## Contributing\n\nPlease read [CONTRIBUTIONS.md](CONTRIBUTIONS.md)\n\n## License\n\nAhey.io is open-source and released under the [MIT License](LICENSE).\n\n## Contact\n\nFor any inquiries or issues, please contact us at [hello@ahey.io](mailto:hello@ahey.io).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvasanthv%2Fahey","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvasanthv%2Fahey","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvasanthv%2Fahey/lists"}