Engineering8 min read

I Built a Production-Ready Architecture. Then I Audited It.

A practical production readiness audit checklist covering caching, pagination, security, observability, and reliability lessons from a real project.

Quick answer: A production-ready architecture is not proven by features working on the happy path. It becomes trustworthy only after auditing failures, caching, pagination, security, observability, and deployment behavior with evidence.

Why implementing system design features is only half the job.

When I started building my Resources page, my main concern was simple: make everything work.

The page had three major sections: Courses, Notes, and 3D Models. The architecture was straightforward: React → Express.js → Prisma → PostgreSQL. I was using React Router for navigation, Clerk for authentication, Sharp for image processing, and Vercel for deployment.

Whenever someone opened the Resources page, the frontend made three API requests in parallel to fetch the available resources. It worked. But as I started thinking about production, I realized that working functionality and production readiness are two very different things.

A system can work perfectly with a small dataset and still struggle when traffic increases, APIs fail, users navigate away during requests, or the database becomes unavailable. That made me revisit the architecture.

Rendering diagram…

Initial Resources page architecture

1. Looking beyond the happy path

I started reviewing the Resources page from a system design perspective. Instead of asking whether the page worked, I started asking different questions:

  • What happens if one API fails?
  • What happens if the user refreshes the page?
  • Are we downloading the entire course catalogue?
  • What happens when multiple users search simultaneously?
  • Can public APIs be abused?
  • Does a 304 response actually save database work?
  • Can the application recover from temporary failures?
  • How will I know when something breaks in production?

Rendering diagram…

Original request flow and missing production capabilities

These questions exposed several architectural gaps. The original implementation had HTTP caching through Cache-Control and ETags, but no shared client-side cache. There was no pagination for the course listing. The page used Promise.all(), meaning one failed request could affect the entire loading flow. There was no proper request cancellation, and search and filtering were handled on the frontend. I also needed better rate limiting, observability, and security controls. The application worked, but I hadn't fully considered what would happen under real production conditions.

2. Evolving the architecture

I started addressing these problems one by one.

Client-side data management

I introduced TanStack Query to manage resource requests. The objective wasn't simply to add another library. I wanted a shared cache, better request management, background refetching, and independent loading and error states. I also separated Courses, Notes and Models into independent queries. Now, a failure in the Notes API should not prevent Courses and Models from loading.

I worked on bounded retries, exponential backoff, timeouts, request cancellation and stale-data fallback. One important behavior I wanted was this: if a background request fails, don't immediately remove the data users already have. Keep the cached data visible while recovery happens.

Rendering diagram…

Client-side data management with TanStack Query

Backend pagination

Fetching every published course might be acceptable with a small catalogue, but it isn't a sustainable approach as the dataset grows. I moved toward cursor-based pagination with a default page size of 12, stable ordering, a unique tie-breaker, cursor-based database queries, and a response containing items, nextCursor and hasMore. This allows the frontend to request additional courses instead of downloading the entire catalogue.

Rendering diagram…

Cursor-based pagination flow

Backend search and filtering

Frontend filtering works when the complete dataset is already available. But as the catalogue grows, downloading everything just to filter it in the browser becomes inefficient. I wanted search, filtering and sorting to happen at the backend, with PostgreSQL returning only the relevant results. Debouncing search input also became important. Instead of sending a request on every keystroke, the application waits briefly after the user stops typing.

Rate limiting and security

Public APIs introduce another concern: abuse. I considered separate rate-limit policies for anonymous and authenticated users. Anonymous users should have stricter IP-based limits, while authenticated users can have higher limits based on verified Clerk identity. But application-level rate limiting is not the same as DDoS protection. That requires thinking about protection at the CDN and WAF layers too. I also revisited authorization, image processing, SSRF protection, CSP and the handling of paid course content.

Rendering diagram…

Rate limiting and security layers

Caching beyond the browser

Another important lesson was understanding that caching isn't a single feature. There are different layers: TanStack Query's in-memory cache, IndexedDB persistence if required, browser HTTP caching, CDN/shared caching, and backend caching where justified. Each solves a different problem.

For the initial implementation, I chose to defer IndexedDB rather than introduce persistent caching before it was necessary. I also realized that an ETag returning HTTP 304 does not automatically mean PostgreSQL was skipped. If the server queries the database before generating the ETag, the database work has already happened. That distinction matters.

Rendering diagram…

Caching layers across the system

3. The part I almost overlooked: auditing the implementation

After working through the architecture, I wanted to know whether the implementation actually matched the design. Not whether the packages were installed. Not whether the configuration files existed. Not whether the feature names appeared in the code. I wanted to verify the complete execution flow.

So I used OpenCode to perform a repository-level system design audit. I deliberately split the audit into seven parts and instructed the agent to inspect the actual code, trace requests across layers, identify missing safeguards, and provide evidence using file paths and line numbers. I also made one rule explicit: do not modify anything during the audit. I wanted findings, not automatic fixes.

PartWhat I audited
1Repository and architecture verification
2Frontend reliability and caching
3Backend APIs, pagination and database
4HTTP caching, CDN and image processing
5Authentication, authorization and security
6Observability, resilience and scalability
7Final production readiness assessment

Rendering diagram…

Repository-level system design audit flow

4. What the audit taught me

The most important lesson was that an implementation can be partially correct while the overall architecture remains incomplete. For example: having TanStack Query installed doesn't prove caching is configured correctly; having an AbortController doesn't prove every fetch request consumes its signal; having cursor fields in an API response doesn't prove pagination is actually cursor-based; having Cache-Control headers doesn't prove CDN caching works; having Redis doesn't prove rate limiting is distributed correctly; having Clerk doesn't mean paid content is protected; having structured logs doesn't mean the system has complete observability; passing tests doesn't prove the application can handle production traffic.

The audit highlighted areas needing investigation: database migration consistency, verified cursor pagination and backend search/filtering, rate limiting and SSRF protection, preventing long-lived cache headers on errors, request-level logs/metrics/alerting, and deployment-level CDN/WAF/CSP confirmation.

5. What I would do differently next time

If I were starting this system again, I would define production requirements much earlier. Before implementing a feature, I would ask: What problem does this solve? Which layer should own the responsibility? What happens when this component fails? How will the behavior be tested? How will I observe it in production? What evidence will prove that it works?

I would also avoid introducing infrastructure just because it is popular. Not every application needs microservices, Kubernetes, Redis caching or a complicated distributed architecture. Sometimes a well-structured modular backend, a properly configured database, sensible caching and good observability are enough. The goal should be to solve actual engineering problems, not to make the architecture look impressive.

Final takeaway

This exercise changed my understanding of system design. Earlier, I mostly thought about how different components communicate and how to make the application work. Now, I think much more about failure scenarios, data consistency, security boundaries, resource constraints, observability and operational behavior.

Building a feature proves that it works. Auditing its architecture helps establish whether it can be trusted. I'm still working through the production-readiness gaps, but the process itself has been valuable. Because production engineering isn't just about choosing the right technologies. It's about understanding what happens when those technologies don't behave as expected.

I'd be interested in hearing from engineers who have taken an application from a working implementation to production. What do you usually audit first: database performance, caching, security, reliability or observability?

Rendering diagram…

Production-ready architecture overview