|
4 | 4 | git clone https://github.com/moofoo/nestjs-jsreport-examples && cd nestjs-jsreport-examples && yarn && yarn start:dev |
5 | 5 | ``` |
6 | 6 |
|
7 | | -This repo demonstrates (very basic) NestJS + JSReport integration. The app has six endpoints which generate different reports, taken from the [JSReport Playground](https://playground.jsreport.net/). The goal here is not to present a robust JSReports module, but demonstrate the basics of initializing JsReports and generating reports from templates and data, in addition to covering some of the 'gotchas' and configuration quirks involved. |
| 7 | +This repo demonstrates NestJS + JSReport integration. I've replicated all of the JSReport "[showcase](https://jsreport.net/showcases/)" reports minus the "PDF Stock Report", due to it's complexity. Like seriously, they went to town with that one. I also did a few of the simpler example reports from the [JSReport Playground](https://playground.jsreport.net/), just because. |
8 | 8 |
|
9 | | -The following 'Recipes' are used: |
| 9 | +The goal here is not to present a complete and self-contained JSReports module that others can import and use, though that might happen eventually. Rather, I wanted to |
10 | 10 |
|
11 | | -- [DocX](https://jsreport.net/learn/docx) |
12 | | -- [Chrome PDF](https://jsreport.net/learn/chrome-pdf) (html-to-pdf using headless chromium) |
13 | | -- [Xlsx](https://jsreport.net/learn/xlsx) |
14 | | -- [Html-to-Xlsx](https://jsreport.net/learn/html-to-xlsx) |
| 11 | +- Show that the integration is possible and its potential, |
| 12 | +- Work through the expected 'gotchas', quirks and pain points that come with the territory, so that future templating/report work that I'm actually getting paid for will be hella easy, |
| 13 | +- I also want to show off how powerful and fully-featured the core JSReport framework is, to anyone paying attenntion. JSReport is literally the only business reports company that has their entire code base, top to bottom, open source and free for anyone to use, and it's fucking **legit** |
15 | 14 |
|
16 | | -## Report Endpoints |
| 15 | +Software like this deserves attention and love, especially given how ridiculously costly and frankly predatory so many SaaS services in the space are. |
| 16 | + |
| 17 | +# |
| 18 | + |
| 19 | +## Implemented Reports and Endpoints |
| 20 | + |
| 21 | +<hr> |
| 22 | + |
| 23 | +# |
| 24 | + |
| 25 | +### [http://localhost:3333/reports/pdf-dashboard](http://localhost:3333/reports/pdf-dashboard) |
| 26 | + |
| 27 | +-  |
| 28 | + |
| 29 | +- Chrome PDF |
| 30 | +- [Playground Link](https://playground.jsreport.net/w/admin/cBFKE3RY) |
| 31 | + |
| 32 | +# |
| 33 | + |
| 34 | +### [http://localhost:3333/reports/excel-dashboard](http://localhost:3333/reports/excel-dashboard) |
| 35 | + |
| 36 | +-  |
| 37 | + |
| 38 | +- Chrome PDF |
| 39 | +- [Playground Link](https://playground.jsreport.net/w/admin/VvaGnaE) |
| 40 | + |
| 41 | +# |
17 | 42 |
|
18 | 43 | ### [http://localhost:3333/reports/student](http://localhost:3333/reports/student) |
19 | 44 |
|
| 45 | +-  |
| 46 | + |
20 | 47 | - DocX |
21 | 48 | - [Playground Link](https://playground.jsreport.net/w/admin/d7o0nIWc) |
22 | 49 |
|
| 50 | +# |
| 51 | + |
| 52 | +### [http://localhost:3333/reports/ticket](http://localhost:3333/reports/ticket) |
| 53 | + |
| 54 | +-  |
| 55 | + |
| 56 | +- Chrome PDF |
| 57 | +- [Playground Link](https://playground.jsreport.net/w/admin/ms2EkdfI) |
| 58 | + |
| 59 | +# |
| 60 | + |
| 61 | +### [http://localhost:3333/reports/pdf-forms](http://localhost:3333/reports/pdf-forms) |
| 62 | + |
| 63 | +-  |
| 64 | +- Chrome PDF |
| 65 | +- [Playground Link](https://playground.jsreport.net/w/admin/lbhULCsP) |
| 66 | + |
| 67 | +# |
| 68 | + |
23 | 69 | ### [http://localhost:3333/reports/invoice](http://localhost:3333/reports/invoice) |
24 | 70 |
|
25 | 71 | - DocX |
26 | 72 | - [Playground Link](https://playground.jsreport.net/w/admin/yo9J3hvu) |
27 | 73 |
|
| 74 | +# |
| 75 | + |
28 | 76 | ### [http://localhost:3333/reports/invoice-xlsx](http://localhost:3333/reports/invoice-xlsx) |
29 | 77 |
|
30 | 78 | - Xlsx |
31 | 79 | - [Playground Link](https://playground.jsreport.net/w/admin/Lh8Kjc~f) |
32 | 80 |
|
| 81 | +# |
| 82 | + |
33 | 83 | ### [http://localhost:3333/reports/population](http://localhost:3333/reports/population) |
34 | 84 |
|
35 | 85 | - Xlsx |
36 | 86 | - [Playground Link](https://playground.jsreport.net/w/admin/V71OgRWt) |
37 | 87 |
|
| 88 | +# |
| 89 | + |
38 | 90 | ### [http://localhost:3333/reports/html-to-xlsx](http://localhost:3333/reports/html-to-xlsx) |
39 | 91 |
|
40 | 92 | - Html-to-Xlsx |
41 | 93 | - [Playground Link](https://playground.jsreport.net/w/admin/h45L49Dp) |
42 | 94 |
|
43 | | -### [http://localhost:3333/reports/ticket](http://localhost:3333/reports/ticket) |
44 | | - |
45 | | -- Chrome PDF |
46 | | -- [Playground Link](https://playground.jsreport.net/w/admin/ms2EkdfI) |
47 | | - |
48 | | -All endpoints except for `flight-ticket` endpoint will generate a PDF (instead of .docx or .xlsx) with the query `pdf=1` (i.e, http://localhost:3333/reports/invoice?pdf=1) |
49 | | - |
50 | | -## Why do this? |
51 | | - |
52 | | -Well, in terms of pure document generation chops (not talking about templating backends, GUIs or workflows), JSReport is more-or-less on par with what is possible using SaaS services like [Bold Reports](https://www.boldreports.com/), [DocxTemplater](https://docxtemplater.com/), [CarboneIO](https://carbone.io), [DocuPilot](https://docupilot.app/), [Formstack](https://www.formstack.com/), etc... |
53 | | - |
54 | | -However, unlike those services, JSReports does not gatekeep **ANY** functionality behind payment tiers. Rather, their business model is oriented around usage of their 'Studio' template builder GUI, which has SaaS and self-hosted versions, while the JSReport server code itself is completely open source and accessible. |
55 | | - |
56 | | -So, by making use of the [jsreport core package](https://github.com/jsreport/jsreport/tree/master/packages/jsreport-core) you can have self-hosted document generation that's on-par with any SaaS out there. |
| 95 | +# |
57 | 96 |
|
58 | | -The [JSReport Studio GUI](https://playground.jsreport.net/w/admin/S3xqZ0Zc) is actually quite good, if that's something you're looking for. |
| 97 | +Most of these will generate a PDF (instead .docx or .xlsx) with the query `pdf=1` (i.e, http://localhost:3333/reports/invoice?pdf=1) |
0 commit comments