{"id":28531130,"url":"https://github.com/devgauravjatt/best-blog-data","last_synced_at":"2025-06-10T16:03:35.151Z","repository":{"id":297129924,"uuid":"995760849","full_name":"devgauravjatt/best-blog-data","owner":"devgauravjatt","description":"A powerful and lightweight npm package for working with structured blog post data, featuring 200+ dummy posts out of the box. Includes built-in pagination, categorization, fuzzy search, and full TypeScript support. Perfect for static blogs, CMS backends, or frontend demos.","archived":false,"fork":false,"pushed_at":"2025-06-08T17:52:13.000Z","size":1431,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-06-09T15:09:27.756Z","etag":null,"topics":["astrojs","blog","blog-api","blog-post","dummy-data","fuzzy-search","json","json-server","mock-data","mock-data-generator","mock-server","pagination","posts","vite"],"latest_commit_sha":null,"homepage":"https://npmjs.com/package/best-blog-data","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/devgauravjatt.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,"zenodo":null}},"created_at":"2025-06-04T01:13:49.000Z","updated_at":"2025-06-08T17:52:14.000Z","dependencies_parsed_at":"2025-06-09T15:09:27.828Z","dependency_job_id":null,"html_url":"https://github.com/devgauravjatt/best-blog-data","commit_stats":null,"previous_names":["devgauravjatt/best-blog-data"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devgauravjatt%2Fbest-blog-data","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devgauravjatt%2Fbest-blog-data/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devgauravjatt%2Fbest-blog-data/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devgauravjatt%2Fbest-blog-data/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/devgauravjatt","download_url":"https://codeload.github.com/devgauravjatt/best-blog-data/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devgauravjatt%2Fbest-blog-data/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259106576,"owners_count":22805929,"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":["astrojs","blog","blog-api","blog-post","dummy-data","fuzzy-search","json","json-server","mock-data","mock-data-generator","mock-server","pagination","posts","vite"],"created_at":"2025-06-09T15:09:24.889Z","updated_at":"2025-06-10T16:03:35.140Z","avatar_url":"https://github.com/devgauravjatt.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 📚 Best-blog-data\n\nA powerful and lightweight npm package for working with structured blog post data, featuring 200+ dummy posts out of the box. Includes built-in pagination, categorization, fuzzy search, and full TypeScript support. Perfect for static blogs, CMS backends, or frontend demos.\n\n\u003e [!NOTE]\n\u003e 😍 200+ Posts and 30 Categories with Seo Meta!\n\n---\n\n## ✨ Features\n\n- 📄 **Pagination** – Retrieve posts with configurable page size and pagination\n- 🏷️ **Category Filtering** – Organize and access posts by categories\n- 🔍 **Search** – Fuzzy search powered by [Fuse.js](https://fusejs.io/)\n- 🔗 **Post Slug Lookup** – Quickly fetch posts by slug\n- 🧩 **Modular API** – Simple, composable utilities\n- ⚡ **Lightweight** – Zero bloat, minimal dependencies\n- 🧠 **Fully Typed** – Built with TypeScript for great DX\n\n---\n\n## 📦 Installation\n\n```bash\nnpm install best-blog-data\n```\n\nor\n\n```bash\npnpm add best-blog-data\n```\n\n---\n\n## 🚀 Quick Start\n\n### Import Functions\n\n```ts\nimport {\n  getAllCategories,\n  getFullPostBySlug,\n  getPosts,\n  getPostsByCategory,\n  getPostsBySearch,\n} from 'best-blog-data';\n```\n\n---\n\n### 📄 Get Paginated Posts\n\n```ts\nconst { posts, nextPageAvailable } = getPosts(); // Defaults to page 1\nconsole.log(posts.length); // Up to 10 posts\n```\n\n```ts\nconst page2 = getPosts(2);\nconsole.log(page2.posts.length);\n```\n\n---\n\n### 🔗 Get Full Post by Slug with html content\n\n```ts\nconst post = getFullPostBySlug('my-blog-post-slug');\nif (post) {\n  console.log(post.title);\n}\n```\n\n---\n\n### 🏷️ Filter Posts by Category\n\n```ts\nconst { posts, nextPageAvailable, categoryFound } =\n  getPostsByCategory('technology');\nif (categoryFound) {\n  console.log(posts);\n}\n```\n\n```ts\nconst reactPostsPage2 = getPostsByCategory('react', 2);\n```\n\n---\n\n### 📚 Get All Categories\n\n```ts\nconst categories = getAllCategories();\nconsole.log(categories);\n// [\n//   { slug: 'react', name: 'React' },\n//   { slug: 'ai', name: 'Artificial Intelligence' },\n//   ...\n// ]\n```\n\n---\n\n### 🔍 Fuzzy Search Posts\n\n```ts\nconst searchResults = getPostsBySearch('AI content');\nsearchResults.forEach(({ item, score }) =\u003e {\n  console.log(`${item.title} (score: ${score})`);\n});\n```\n\n---\n\n## 📘 API Reference\n\n### `getPosts(pageIndex?: number): { posts: Post[], nextPageAvailable: boolean }`\n\nReturns paginated posts (10 per page by default).\n\n---\n\n### `getPostsBySlug(slug: string): Post | undefined`\n\nFetch a single post by its unique slug.\n\n---\n\n### `getPostsByCategory(categorySlug: string, pageIndex?: number): { posts: Post[], nextPageAvailable: boolean, categoryFound: boolean }`\n\nRetrieve posts filtered by a category slug.\n\n---\n\n### `getAllCategories(): Category[]`\n\nReturns a list of all unique categories found in posts.\n\n---\n\n### `getPostsBySearch(query: string): FuseResult\u003cPost\u003e[]`\n\nPerforms fuzzy search across post titles. Returns max 10 results with match scores.\n\n---\n\n## 🧱 Data Structure\n\n### `Post`\n\n```ts\ninterface Post {\n  slug: string;\n  title: string;\n  content?: string;\n  date: string;\n  image: string;\n  categorie: {\n    slug: string;\n    name: string;\n  };\n  meta_seo: {\n    title: string;\n    description: string;\n    image: string;\n    url: string;\n  };\n}\n```\n\n### `Category`\n\n```ts\ninterface Category {\n  slug: string;\n  name: string;\n}\n```\n\n---\n\n## 🔧 Search Configuration (Fuse.js)\n\n- **Threshold**: `0.3`\n- **Search Keys**: `['title']`\n- **Limit**: `10 results`\n\n---\n\n## 📦 Dependency\n\n- [`fuse.js`](https://fusejs.io/) — Fuzzy search engine\n\n---\n\n## 💡 Use Cases\n\n- Build static blog websites\n- Power blog UIs with real or mock content\n- CMS \u0026 content preview tools\n- Search-enabled article listings\n- Prototyping frontend blog layouts\n\n---\n\n## 🧠 TypeScript Support\n\nThis package is fully typed with built-in definitions, ensuring IntelliSense and compile-time safety in modern editors and TypeScript projects.\n\n---\n\n## 🤝 Contributing\n\nFound a bug or have a feature idea? PRs and issues are welcome!\n\n```bash\ngit clone https://github.com/devgauravjatt/best-blog-data\n```\n\n---\n\n## 📄 License\n\nMIT © [devgauravjatt](https://github.com/devgauravjatt)\n\n---\n\n## 🔍 Keywords\n\n`blog`, `cms`, `posts`, `pagination`, `search`, `categories`, `typescript`, `fuse`, `content`, `npm-package`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevgauravjatt%2Fbest-blog-data","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevgauravjatt%2Fbest-blog-data","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevgauravjatt%2Fbest-blog-data/lists"}