{"id":27027949,"url":"https://github.com/mahesh5726/hackernews-server","last_synced_at":"2025-04-05T00:18:42.033Z","repository":{"id":286069683,"uuid":"955072562","full_name":"Mahesh5726/hackernews-server","owner":"Mahesh5726","description":"\"News Moves Fast. So Does This Backend.\" - Powered by HackerNews-Server","archived":false,"fork":false,"pushed_at":"2025-04-04T06:52:45.000Z","size":69,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-04T07:23:07.245Z","etag":null,"topics":["api-calls","hackernews-api","honojs","prisma-orm","supabase","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Mahesh5726.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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-26T04:11:17.000Z","updated_at":"2025-04-04T06:52:37.000Z","dependencies_parsed_at":"2025-04-04T07:23:12.159Z","dependency_job_id":"a114a66f-435c-46ee-900b-28937f32d469","html_url":"https://github.com/Mahesh5726/hackernews-server","commit_stats":null,"previous_names":["mahesh5726/hackernews-server"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mahesh5726%2Fhackernews-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mahesh5726%2Fhackernews-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mahesh5726%2Fhackernews-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mahesh5726%2Fhackernews-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Mahesh5726","download_url":"https://codeload.github.com/Mahesh5726/hackernews-server/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247266821,"owners_count":20910882,"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":["api-calls","hackernews-api","honojs","prisma-orm","supabase","typescript"],"created_at":"2025-04-05T00:18:41.375Z","updated_at":"2025-04-05T00:18:42.027Z","avatar_url":"https://github.com/Mahesh5726.png","language":"TypeScript","readme":"# HackerNews Server\n\nA social media-like backend service built using Node.js and Express with authentication, posts, likes, and comments.\n\n## 📖 Table of Contents\n- [Features](#-features)\n- [Pre-requisites](#-pre-requisites)\n- [Installation](#-installation)\n- [Password Hashing](#-password-hashing)\n- [Usage](#-usage)\n- [API Endpoints](#-api-endpoints)\n  - [Authentication](#authentication)\n  - [Users](#users)\n  - [Posts](#posts)\n  - [Likes](#likes)\n  - [Comments](#comments)\n- [Folder Structure](#-folder-structure)\n- [Contributing](#-contributing)\n- [License](#-license)\n\n## 🚀 Features\n- JWT-based authentication\n- CRUD operations for users, posts, likes, and comments\n- Middleware-based access control\n- Pagination for fetching users, posts, likes, and comments\n- sha256 password hashing for security\n\n## 🔧 Pre-requisites\nBefore running this project, ensure you have the following installed:\n- **Node.js** (latest LTS version recommended)\n- **TypeScript** (for type safety and better development experience)\n- **Supabase** (for authentication and database management)\n- **Prisma** (for ORM and database schema management)\n\n## 🛠️ Installation\n\n1. Clone the repository:\n   ```sh\n   git clone https://github.com/Mahesh5726/hackernews-server.git\n   ```\n2. Navigate to the project directory:\n   ```sh\n   cd hackernews-server\n   ```\n3. Install dependencies:\n   ```sh\n   npm install\n   ```\n4. Set up environment variables in a `.env` file:\n   ```env\n   PORT=3000\n   JWT_SECRET=your_secret_key\n   SUPABASE_URL=your_supabase_url\n   SUPABASE_KEY=your_supabase_key\n   ```\n\n\n## 🎮 Usage\n\nTo start the server in development mode:\n```sh\nnpm run dev\n```\n\nTo start the server in production mode:\n```sh\nnpm start\n```\n\nBy default, the server runs on `http://localhost:3000/`.\n\n## 📌 API Endpoints\n\n### Authentication\n- `GET /auth/sign-in` – Signs up a user (leverages JWT).\n- `GET /auth/log-in` – Logs in a user (leverages JWT).\n\n### Users\n- `GET /users/me` – Returns the current user's details (based on JWT token).\n- `GET /users` – Returns all users in alphabetical order (paginated).\n\n### Posts\n- `GET /posts` – Returns all posts in reverse chronological order (paginated).\n- `GET /posts/me` – Returns current user's posts (reverse chronological, paginated).\n- `POST /posts` – Creates a post (authored by the current user).\n- `DELETE /posts/:postId` – Deletes the post (if owned by the user).\n\n### Likes\n- `GET /likes/on/:postId` – Fetches likes on a post (reverse chronological, paginated).\n- `POST /likes/on/:postId` – Creates a like (one per user per post).\n- `DELETE /likes/on/:postId` – Deletes a user's like on a post.\n\n### Comments\n- `GET /comments/on/:postId` – Fetches comments on a post (reverse chronological, paginated).\n- `POST /comments/on/:postId` – Creates a comment on a post.\n- `DELETE /comments/:commentId` – Deletes a user's comment.\n- `PATCH /comments/:commentId` – Updates a user's comment.\n\n\n## 🤝 Contributing\n\n1. Fork the repository.\n2. Create a new branch (`git checkout -b feature-branch`).\n3. Make your changes and commit (`git commit -m 'Add new feature'`).\n4. Push to the branch (`git push origin feature-branch`).\n5. Open a Pull Request.\n\n## 📜 License\n\nThis project is licensed under the MIT License - see the [LICENSE](./LICENSE.txt) file for details.\n\n---\n\n🌐 \"Because every great discussion starts with a rock-solid backend—engineered for the front page!\"\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmahesh5726%2Fhackernews-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmahesh5726%2Fhackernews-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmahesh5726%2Fhackernews-server/lists"}