Scrivio Interview library
DesignPrincipal7 min read · updated 12 November 2026

Every product team builds its own report exports (PDF, Excel, CSV) with different libraries, and some libraries have had licensing changes and security fixes. Would you build a shared document generation service, and how would you govern it?

Yes, for the heavy and risky formats, usually PDF and large Excel, a shared document service is worth it: one team owns templates, branding, accessibility, approved libraries and security fixes, and memory-hungry rendering moves out of the API services. It costs a central team, a template workflow other teams must learn, and a dependency on one more service, so I would build it as an asynchronous job service with storage, quotas and audit logs, govern it with a versioned template API, and let teams keep simple CSV exports in their own code.

Why this question is asked

Platform questions like this one have no single correct answer, which is exactly why they are asked at senior levels. The interviewer wants to see us weigh a central service against team autonomy, think about licences and security as well as code, and describe a governance model that people will actually follow. In this answer, we will look at what goes wrong when every team builds exports alone, what a shared service gives and costs, how to handle library licences, how the service itself should be designed, and how to govern it without making it a bottleneck.

1What Goes Wrong When Every Team Builds Its Own Exports

Picture a company with 25 product teams. Over the years they have chosen four PDF libraries, two ways of writing Excel, and hand-written CSV code in a dozen places. Each invoice looks slightly different, only some PDFs are accessible to screen readers, and the fonts are licensed in some services but copied without thought into others.

Then two things happen. A PDF library changes its licence from a permissive one to a copyleft or commercial licence, and legal asks which services are affected. A month later, a vulnerability is published in an XML parser used by an Excel library, and security asks the same question. Nobody can answer quickly, and the fix has to be repeated 25 times. Meanwhile, a product API occasionally runs out of memory because a large report is rendered inside the same JVM that serves customer requests. These are the problems a shared service is meant to solve.

2What a Shared Service Gives and What It Costs

The gains come from doing the hard parts once. Templates, branding and fonts live in one place, so every invoice looks the same and a rebrand is one change. Accessibility features, such as tagged PDF with a reading order and alternative text, are built once by people who understand them. Library upgrades and security fixes are applied in one service. And rendering, which can use a lot of memory and CPU for a few seconds, runs in its own pods that can scale and fail without taking product APIs with them.

The costs are real too. We need a team, perhaps three to five engineers, to own it. Product teams lose some freedom and must learn a template authoring workflow. Every export now depends on another service being available, and a central team can become a queue that slows everyone down. A good design keeps those costs small; a bad one makes teams quietly go back to their own libraries.

Shared service against per-team exports
ConcernPer-team librariesShared document service
Branding and templatesdrifts between teamsone set, versioned
Accessibilitydepends on each teambuilt once, tested once
Licence and CVE responsefind and fix in every serviceone inventory, one upgrade
Memory-heavy renderinginside product APIsisolated, scaled on its own
Team autonomyfulllimited to the template API
Availabilityno extra dependencyone more service on the path
The shared service wins on consistency and risk; per-team code wins on autonomy and simplicity.

3Handling Library Licences and Security

Licences deserve their own step because they are easy to overlook. Some well-known Java PDF libraries are published under the AGPL or under a commercial licence, and the AGPL can require us to publish our own source code when we offer software over a network. Other libraries use permissive licences such as Apache 2.0. Some projects have changed licence between major versions, so the version matters as much as the name.

So before choosing, we review the candidate libraries and their licences with legal, record the approved list, and pin it. Fonts need the same review, since font licences often limit embedding. Then we add the libraries to our dependency scanning, subscribe to their security advisories, and give the service an owner who upgrades within an agreed time, for example 14 days for a critical fix. The inventory question that took weeks before now has a one-line answer.

4Designing the Service

Rendering a 300 page PDF or a 400,000 row workbook takes seconds to minutes, so the service should be asynchronous. A product service submits a job with a template id, a template version and the data; the document service validates the data against the template's schema, renders the file in a worker, stores it in object storage, and returns a link that expires, for example after 24 hours. Small documents, such as a single invoice, can use a synchronous path with a strict size limit and timeout.

Step throughGenerating a large report through the shared service
Product serviceDocument serviceRender workerObject storage
submit job: template invoice v3 + data
check schema, quota, write audit entry
202 Accepted, job id
render job
upload file
done, storage key
event: job complete, expiring link

7 messages in order. Play them, or step through them one at a time.

Rendering never runs inside the product service, and the user downloads the file straight from storage.

Because the service is shared, it needs protection between its users. Quotas per tenant or per calling team, such as a number of concurrent jobs and a maximum document size, stop one team's month-end batch from starving everyone else. Every job is written to an audit log with who requested it, which template, how many records and who downloaded the result, because exports are a common path for personal data to leave the company. Files are deleted on a retention schedule rather than kept forever.

5Governing It Without Becoming a Bottleneck

Governance is mostly about making the right path the easy path. We publish a template API: a template is a versioned artifact with an id, a data schema and a preview, and product teams can author and test their own templates in a self-service tool, with the platform team reviewing only shared parts such as headers and fonts. Versions are immutable, so invoice v3 renders the same way next year, and a change becomes v4 that callers adopt when ready.

We should not force everything through the service. A team that writes a 2,000 row CSV for an admin screen gains nothing from a remote call, so the policy can say: CSV and small simple exports stay local, using a shared library from the approved list; branded documents, PDFs, accessibility-sensitive documents and anything above a size threshold go through the service. That keeps the central team focused on the expensive cases.

Finally, we measure. Usage per team, render times, failures and support requests tell us whether teams find the service helpful. If adoption stalls, the cause is usually the template workflow, and that is what we improve first.

6Follow-up questions

Would you build the rendering engine yourselves?

No. The value of the service is in templates, governance, isolation and operations, not in a new PDF engine. We wrap one or two approved libraries behind our template API, which also means we can replace a library later, for example after a licence change, without product teams changing anything.

How do you avoid a single point of failure?

We run several worker instances across zones, keep jobs in a durable queue so a crash only delays them, and give the synchronous small-document path its own capacity. Product services should treat document generation as something that can be retried, and show a clear message rather than failing the main user action when a document is late.

How would you migrate existing teams?

Start with the teams that feel the most pain, such as those with memory problems or a library that has a licence issue, and move their highest-volume documents first. Track the old libraries in the dependency inventory, set a deadline for the risky ones, and leave low-risk CSV code alone.

7Conclusion

In this answer, we saw why scattered export code causes inconsistent documents, slow licence and security responses, and memory problems in product APIs. A shared document service fixes those by owning templates, branding, accessibility, approved libraries and isolated rendering, at the cost of a central team, a template workflow and another dependency. We designed it as an asynchronous job service with object storage, expiring links, quotas and audit logs, governed it with a versioned self-service template API, and kept simple CSV exports local so the service only takes the work that really needs it.

What to say in the interviewAbout 90 seconds aloud

Open with

I would build a shared service, but only for the formats where sharing pays off: branded PDFs, large Excel files and anything with accessibility or compliance requirements. Today every team carries its own libraries, so when a PDF library changes its licence or an XML parser has a CVE, nobody can say quickly which services are affected, and heavy rendering runs inside customer-facing APIs.

Then, if they want more

A central service gives one set of templates and fonts, one place to fix vulnerabilities, accessible output built once, and rendering isolated in its own workers. The costs are a small owning team, a template workflow other teams must learn, and one more dependency, so the design has to keep those small.

I would make it asynchronous: callers submit a job with a template id and version plus data, a worker renders it, the file goes to object storage, and the user gets an expiring link. It has quotas per team and an audit log of every export, because exports are where personal data leaves the company.

Licences go through legal before a library is approved, since some PDF libraries are AGPL or commercial. For governance I would publish a versioned template API with self-service authoring and previews, and I would explicitly let teams keep small CSV exports in their own code, so the platform team is not a bottleneck.

About this answer

Last updated
12 November 2026
Checked
Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
Where the question comes from
Written by Scrivio for practice. It is not taken from an interview.
Report an issue with this answer

Copy the line below and send it to the author with what you found. It carries the address of this page.

Issue with "Every product team builds its own report exports (PDF, Excel, CSV) with different...": https://scrivio-interview-library.netlify.app/spring-boot/web-other/9212475c5b/