{"id":26616493,"url":"https://github.com/raniellimontagna/pdf-generator","last_synced_at":"2026-05-19T04:36:09.870Z","repository":{"id":283658755,"uuid":"952485577","full_name":"RanielliMontagna/pdf-generator","owner":"RanielliMontagna","description":"This POC showcases PDF generation using Fastify, TypeBox, and PDFKit. It validates input with TypeBox, processes requests with Fastify, and returns PDFs generated by PDFKit. The goal is a fast and type-safe API for document creation.","archived":false,"fork":false,"pushed_at":"2025-04-04T11:10:44.000Z","size":118,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-11T11:57:58.318Z","etag":null,"topics":["fastify","pdf-kit","swagger","typebox","typescript"],"latest_commit_sha":null,"homepage":"","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/RanielliMontagna.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,"zenodo":null}},"created_at":"2025-03-21T11:02:45.000Z","updated_at":"2025-04-04T11:10:47.000Z","dependencies_parsed_at":"2025-06-06T13:07:34.181Z","dependency_job_id":"3edcd1de-5c5f-4190-813d-44f280da0cf1","html_url":"https://github.com/RanielliMontagna/pdf-generator","commit_stats":null,"previous_names":["raniellimontagna/pdf-generator"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/RanielliMontagna/pdf-generator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RanielliMontagna%2Fpdf-generator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RanielliMontagna%2Fpdf-generator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RanielliMontagna%2Fpdf-generator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RanielliMontagna%2Fpdf-generator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RanielliMontagna","download_url":"https://codeload.github.com/RanielliMontagna/pdf-generator/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RanielliMontagna%2Fpdf-generator/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33201967,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-18T09:27:30.708Z","status":"online","status_checked_at":"2026-05-19T02:00:06.763Z","response_time":58,"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":["fastify","pdf-kit","swagger","typebox","typescript"],"created_at":"2025-03-24T07:36:42.627Z","updated_at":"2026-05-19T04:36:09.855Z","avatar_url":"https://github.com/RanielliMontagna.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PDF Generator\n\nThis project is a PDF generator API built with Fastify and TypeScript. It provides a simple and efficient way to generate PDF documents from various input formats. The API is designed to be fast, type-safe, and easy to use.\n\n## Features\n\n- [Fastify](https://www.fastify.io/) - Fast and low overhead web framework\n- [TypeScript](https://www.typescriptlang.org/) - Type safety and modern JavaScript features\n- [TypeBox](https://github.com/sinclairzx81/typebox) - JSON Schema Type Builder with static type resolution\n- [Swagger UI](https://swagger.io/tools/swagger-ui/) - API documentation and testing interface\n- Request/Response validation out of the box\n- Built-in test setup using Node's test runner\n- Docker support for containerized deployment\n\n## Getting Started\n\n### Prerequisites\n\n- Node.js 18+ (for test runner support)\n- npm or yarn\n- Docker (optional, for containerization)\n\n### Installation\n\n```bash\n# Clone the repository\ngit clone pdf-generator\n\n# Install dependencies\nnpm install\n```\n\n### Development\n\n```bash\n# Start development server\nnpm run dev\n\n# Run tests\nnpm test\n\n# Generate OpenAPI documentation\nnpm run generate-openapi\n```\n\nThe server will start at `http://localhost:3000`. Visit `http://localhost:3000/docs` for the Swagger UI.\n\n### Docker\n\n```bash\n# Build the Docker image\ndocker build -t pdf-generator .\n\n# Run the container\ndocker run -p 3000:3000 pdf-generator\n```\n\nThe containerized application will be available at `http://localhost:3000`.\n\n## Adding New Endpoints\n\n1. Define your request/response types in `types/`:\n\n```typescript\n// types/MyRequest.ts\nimport { Type, Static } from '@sinclair/typebox'\n\nexport const MyRequestSchema = Type.Object(\n  {\n    field: Type.String(),\n  },\n  { description: 'My request schema' },\n)\n\nexport type MyRequest = Static\u003ctypeof MyRequestSchema\u003e\n```\n\n2. Add your route in `api/routes.ts`:\n\n```typescript\nfastify.post\u003c{ Body: MyRequest; Reply: MyResponse }\u003e(\n  '/my-endpoint',\n  {\n    schema: {\n      description: 'My endpoint',\n      body: MyRequestSchema,\n      response: {\n        200: MyResponseSchema,\n        400: ErrorResponseSchema,\n        500: ErrorResponseSchema,\n      },\n    },\n  },\n  async (request, reply) =\u003e {\n    // Your handler logic\n  },\n)\n```\n\n## Testing\n\nThe template includes a test setup using Node's built-in test runner. Tests are located in `*.test.ts` files.\n\n```typescript\nimport { test } from 'node:test'\nimport assert from 'assert'\nimport { buildServer } from './server'\n\ntest('my test', async () =\u003e {\n  const server = await buildServer()\n  const response = await server.inject({\n    method: 'POST',\n    url: '/my-endpoint',\n    payload: { field: 'value' },\n  })\n  assert.strictEqual(response.statusCode, 200)\n})\n```\n\n## API Documentation\n\nThe API documentation is automatically generated from your TypeBox schemas and is available at `/docs` when the server is running. You can also generate a static OpenAPI JSON file:\n\n```bash\nnpm run generate-openapi\n```\n\n## Error Handling\n\nThe template includes standardized error responses. All endpoints automatically include 400 and 500 error responses in their documentation.\n\n## License\n\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Franiellimontagna%2Fpdf-generator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Franiellimontagna%2Fpdf-generator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Franiellimontagna%2Fpdf-generator/lists"}