66
77Stop fighting with PDF libraries. Write HTML templates, get PDFs back.
88
9+ ![ DocForge Demo] ( docs/demo.gif )
10+
911DocForge is a .NET 8 API + React frontend for generating PDFs from templates. You write HTML with Handlebars variables, POST your JSON data, get a PDF. That's it.
1012
1113Good for invoices, reports, certificates - anything where the layout stays the same but the data changes.
1214
13- ## Architecture
14-
15- DocForge follows a clean architecture pattern with ** 4 projects** :
16-
17- ```
18- DocForge/
19- ├── DocumentGenerator.API/ # Web API layer (Controllers, endpoints)
20- ├── DocumentGenerator.Core/ # Business logic (Entities, DTOs, Validators)
21- ├── DocumentGenerator.Infrastructure/ # Data access & services (EF Core, PDF generation)
22- └── DocumentGenerator.Tests/ # Unit and integration tests
23- └── DocumentGenerator.Client/ # React frontend (separate folder)
24- ```
25-
26- - ** API** : Web controllers, authentication, Swagger documentation
27- - ** Core** : Domain models, business rules, validation logic
28- - ** Infrastructure** : Entity Framework, PuppeteerSharp PDF generation, external services
29- - ** Tests** : xUnit tests with in-memory database for integration testing
30-
3115## When to use DocForge
3216
3317✅ You need PDFs with consistent layouts (invoices, certificates, reports)
@@ -65,9 +49,11 @@ curl -X POST http://localhost:5257/api/documents/generate \
6549 "total": "250.00"
6650 }
6751 }'
52+
53+ # Response: {"id": "abc-123", "downloadUrl": "/api/documents/abc-123/download"}
6854```
6955
70- ** Result:** A formatted PDF invoice in the response .
56+ ** Result:** A formatted PDF invoice ready to download .
7157
7258![ Dashboard] ( docs/images/dashboard.png )
7359
@@ -128,7 +114,23 @@ chmod +x docforge.sh && ./docforge.sh
128114- ** Multi-user ready** - JWT auth built in, not bolted on later
129115- ** Docker support** - API runs in container, frontend runs locally (Vite)
130116
117+ ## Architecture
118+
119+ DocForge follows a clean architecture pattern with ** 4 projects** :
120+
121+ ```
122+ DocForge/
123+ ├── DocumentGenerator.API/ # Web API layer (Controllers, endpoints)
124+ ├── DocumentGenerator.Core/ # Business logic (Entities, DTOs, Validators)
125+ ├── DocumentGenerator.Infrastructure/ # Data access & services (EF Core, PDF generation)
126+ ├── DocumentGenerator.Tests/ # Unit and integration tests
127+ └── DocumentGenerator.Client/ # React frontend (separate folder)
128+ ```
131129
130+ - ** API** : Web controllers, authentication, Swagger documentation
131+ - ** Core** : Domain models, business rules, validation logic
132+ - ** Infrastructure** : Entity Framework, PuppeteerSharp PDF generation, external services
133+ - ** Tests** : xUnit tests with in-memory database for integration testing
132134
133135## Template Syntax
134136
@@ -179,26 +181,11 @@ Test your templates in the frontend editor first - it catches syntax errors befo
179181
180182## Tech Stack
181183
182- ** Backend:**
183- - .NET 8 Web API with clean architecture
184- - Entity Framework Core 8.0.0 (SQLite for dev, PostgreSQL/SQL Server ready)
185- - PuppeteerSharp (headless Chrome for PDF generation)
186- - Handlebars.NET (templating engine)
187- - FluentValidation (input validation)
188- - AutoMapper (object mapping)
189- - Serilog (structured logging)
190- - BCrypt.Net-Next (password hashing)
191- - JWT authentication with refresh tokens
192- - xUnit + FluentAssertions + Moq for testing
193-
194- ** Frontend:**
195- - React 19.2.0 with Vite 7.2.2
196- - React Router DOM 7.9.6 for navigation
197- - Axios for API calls with JWT interceptors
198- - @dnd-kit 6.3.1 for drag-and-drop template editor
199- - Lucide React for icons
200- - Vitest 4.0.14 + Testing Library for testing
201- - Vanilla CSS with Google Fonts (Inter)
184+ ** Backend:** .NET 8 API, Entity Framework Core (SQLite), PuppeteerSharp (headless Chrome), Handlebars.NET, JWT auth with refresh tokens
185+
186+ ** Frontend:** React 19, Vite, drag-and-drop editor with @dnd-kit , Vitest for testing
187+
188+ Full dependency versions in ` package.json ` and ` .csproj ` files.
202189
203190## API Endpoints
204191
@@ -260,74 +247,20 @@ ASPNETCORE_ENVIRONMENT=Development
260247
261248## Testing
262249
263- ### Backend Testing (.NET)
264-
265- Run all backend tests:
266- ``` bash
267- dotnet test
268- ```
269-
270- Run tests with coverage:
271- ``` bash
272- dotnet test --collect:" XPlat Code Coverage"
273- ```
274-
275- ** Testing Stack:**
276- - ** xUnit** 2.9.3 - Test framework
277- - ** FluentAssertions** 8.8.0 - Readable assertions
278- - ** Moq** 4.20.72 - Mocking framework
279- - ** Microsoft.AspNetCore.Mvc.Testing** - Integration testing
280- - ** Entity Framework Core InMemory** - Database testing
281- - ** Coverlet Collector** 6.0.4 - Code coverage
282-
283- ** Test Structure:**
284- - Unit tests for business logic in Core layer
285- - Integration tests for API endpoints
286- - In-memory database for isolated testing
287- - JWT authentication testing
288-
289- ### Frontend Testing (React)
290-
291- Run frontend tests:
292- ``` bash
293- cd DocumentGenerator.Client
294- npm test
295- ```
296-
297- Run tests in watch mode:
298- ``` bash
299- npm run test:watch
300- ```
301-
302- Generate coverage report:
303- ``` bash
304- npm run test:coverage
305- ```
306-
307- ** Testing Stack:**
308- - ** Vitest** 4.0.14 - Fast test runner
309- - ** Testing Library** 16.2.0 - React component testing
310- - ** Testing Library User Event** 14.6.1 - User interaction simulation
311- - ** Jest DOM** 6.6.3 - Custom DOM matchers
312- - ** jsdom** - Browser environment simulation
313-
314- ** Test Structure:**
315- - Component testing for UI elements
316- - Hook testing for state management
317- - Integration testing for user workflows
318- - API mocking for isolated testing
319-
320- ### Running All Tests
321-
322- Run complete test suite (both frontend and backend):
323250``` bash
324251# Backend
325252dotnet test
326253
327- # Frontend (in separate terminal)
254+ # Frontend
328255cd DocumentGenerator.Client && npm test
256+
257+ # With coverage
258+ dotnet test --collect:" XPlat Code Coverage"
259+ cd DocumentGenerator.Client && npm run test:coverage
329260```
330261
262+ Backend uses xUnit + FluentAssertions + Moq with in-memory SQLite. Frontend uses Vitest + Testing Library.
263+
331264## Security Notes
332265
333266- Passwords hashed with BCrypt (cost factor 12)
@@ -344,7 +277,7 @@ See [open issues](https://github.com/jonmartin721/docforge-api/issues) for curre
344277
345278Planned features (contributions welcome):
346279- Template versioning (save history)
347- - ~~ Bulk generation (process 100s of PDFs from a CSV) ~~ - Done! Use ` /api/documents/generate-batch `
280+ - ✅ Bulk generation - Use ` /api/documents/generate-batch `
348281- Cloud storage (S3/Azure instead of local disk)
349282- Template sharing (if there's interest)
350283
0 commit comments