How I Built a Fintech Front End from Scratch and What I’d Change Today

A practical account of building a financial front end from an empty repository, while the product, API contracts and delivery process were still taking shape.
Confidentiality note: I have anonymised the company and external service providers. Identifying business details, credentials, customer data, private endpoints and proprietary source code have been omitted. The architectural decisions, implementation trade-offs, audit history, governance disagreement and engineering lessons remain faithful to the work.
When I joined the project, there was no front-end architecture to inherit. There was an existing back-end domain, a financial product taking shape in conversations and an MVP date that was not going to move. My job was to turn those ingredients into a platform.
I chose most of the front-end architecture, core technology, component strategy and development standards, then built the initial system. The decisions were mine to own, although they were not made in a vacuum. I worked through the consequential trade-offs with technical leadership and other engineers, especially where the browser, identity system and existing API met.
The organisation was a regulated payment service provider rather than a bank. The distinction was more than wording. The interface had to feel familiar to somebody managing an account while remaining accurate about what the service actually was.
The initial product group was small. Early requirements arrived through discussions with product and technical leadership; as implementation accelerated, I worked closely with the back-end technical lead. We did not have a mature specification. Product conversations, existing data structures and regulatory constraints were the specification, and they changed as we learnt more.
The first release needed a current account balance, incoming and outgoing movement histories and transfers addressed through domestic bank-account identifiers or aliases. It also needed a contact model in which one person or organisation could own several destination accounts, together with account-specific users, profiles and roles. These were not isolated screens. Every operation depended on the authenticated user's active account context, and the foundation had to accommodate later capabilities such as scheduled and batch transfers, reports, service payments, webhooks and API-key management.
That last constraint shaped nearly everything. In a content application, a stale view is irritating. In a financial application, a stale balance, an ambiguous destination account or a repeated submission can change what a user believes will happen to their money. Identity, account context, state changes and failure modes had to be visible in the design rather than left as component-level details.
Choosing Next.js 14 without adopting every new abstraction
The first architectural decision had two separate dimensions: which version of Next.js to use and which routing model to adopt.
Next.js 14 had just been released when the project began. Its App Router offered React Server Components, nested layouts and a newer data-fetching model. The Pages Router, however, had a longer operational history and broader compatibility with the authentication and component patterns we expected to use.
We chose Next.js 14 with the Pages Router.
That phrasing is important. The decision was not “Next.js 13 for pages or Next.js 14 for app”. Both routers were available, and the Pages Router already supported server-side rendering through getServerSideProps. Next.js 14 did not require the App Router.
This combination gave us the current framework version while limiting the number of new concepts introduced into a greenfield, security-sensitive product. We retained request-time rendering for authenticated, account-specific data and API Routes for a server-side integration layer, while continuing to use a well-understood client navigation model. It also gave us predictable compatibility with the server-side identity SDK and the wider React ecosystem. The value of the decision was not that the Pages Router was more modern; it was that its operational behaviour was better understood when the product already contained substantial domain and security uncertainty.
The trade-off was that we did not immediately gain the App Router's server-component model or its newer layout and data-fetching primitives. For this project, predictability was more valuable than adopting every new feature at once.
The broader lesson is to separate a framework upgrade from an architectural migration. They have different risks and do not always need to happen together.
Using Next.js as a thin back end for the front end
The browser could have called the core application API directly. That would have reduced the amount of Next.js server code, but it would also have distributed authentication, account selection, header construction and error handling across the UI.
Instead, we used the Next.js server as a thin back end for the front end, or BFF. The following diagram shows how the browser entered through a single application boundary, while identity, server rendering and API forwarding remained separate responsibilities.
On the initial page request, getServerSideProps validated the session, loaded the user's profiles and fetched account-specific data before returning the page. Subsequent browser requests went through a same-origin API route. That route recovered the session on the server, attached the bearer token and selected profile identifier, filtered forwarded headers and streamed the request body when necessary.
The BFF earned its keep quickly. The browser never needed to construct privileged back-end headers, and authentication or token-refresh failures followed one controlled path. Pages arrived with useful account data instead of an empty loading shell. Browser and server requests shared the same domain contracts. Logging, response validation and error translation had one home rather than a slightly different implementation in every feature.
The boundary did not make the Next.js process an authorisation server. The application API still had to confirm that the authenticated user could perform the requested action on the selected account. A BFF can centralise credentials and policy checks; it cannot confer trust on data supplied by the browser.
Modelling identity, profiles and accounts correctly
The hardest early problem was a noun.
A login identity was not equivalent to a business account. One email address could be associated with several profiles, and each profile represented an operating context containing an account and a role. For example, an employee might be permitted to work with one branch of a company but not another.
We treated those concepts separately. A user represented the authenticated person. A profile connected that person to a particular account and role. A contact was separate from a contact address because the same recipient could have several account destinations or aliases.
This model became part of the front-end–back-end contract. The identity provider established who had signed in. The application API supplied the business profiles and enforced what each profile could do. Mixing those answers would have produced simpler types and a much less honest system.
The first version selected the first available profile. I was not entirely satisfied with that shortcut, but the contract preserved the full list, so a later account selector would not require identity to be remodelled across the application. It was the kind of compromise I am comfortable making for an MVP: narrow behaviour now, with an explicit route to the next version.
Authentication answered “Who is this person?” The profile and role model answered the harder question: “In which business context are they acting, and what may they do there?” Most of the product depended on keeping those answers separate.
Making API contracts executable with TypeScript and Zod
The API was not standing still while I built against it. The domain was already large, endpoint contracts evolved and some response names reflected back-end implementation details rather than language we wanted in the interface. Working closely with the back-end technical lead was therefore part of the architecture, not an occasional coordination task.
TypeScript helped until the network returned JSON. At that point, an interface was only an assertion about what we hoped to receive. I introduced Zod schemas at the boundary so the contract could inspect the data that actually arrived.
A simplified pattern looked like this:
const accountSchema = z.object({
balance: z.number(),
state: z.string(),
currency: z.object({
codeAlphabetic: z.string(),
symbol: z.string(),
}),
});
type Account = z.infer<typeof accountSchema>;
A failed parse told us which contract had drifted before an undefined property caused a rendering error several components later. As the application grew, I centralised endpoint calls so query parameters were serialised consistently and typed path identifiers passed through one substitution mechanism. The same abstraction selected the direct server URL or browser-facing proxy, validated successful responses and normalised errors. It also became the place where sensitive request and response bodies could be excluded from logs. In retrospect, that exclusion should have been the default rather than an option selected endpoint by endpoint.
Awkward transport shapes stopped at the same boundary. A component should not care that two endpoints use different names for the same field or return expanded contact data in different structures. The integration layer translated those responses into stable domain objects once.
An OpenAPI-generated client was the obvious alternative. It works well when the specification is current and treated as a source of truth. Ours was still being negotiated, so hand-written schemas let us add runtime validation where it mattered without waiting for the whole contract to stabilise. For the mature system, I would generate transport types and keep runtime validation and domain normalisation at the edge.
Representing a transfer as a workflow, not a form
A transfer looked like a form until the branches appeared. It could begin with a saved contact or a new account identifier. A contact might have one destination or several. Before submission, the application had to resolve and confirm the account holder, collect the amount and concept, and show a final review. Afterwards, success and failure had to be unambiguous.
The first large-form implementation became difficult to reason about almost immediately. We replaced it with explicit steps represented by a discriminated union:
type TransferStep =
| { step: "cbuInput"; cbuAlias: string }
| { step: "contactAddressSelection"; contact: Contact }
| { step: "contactConfirmation"; recipient: Recipient }
| { step: "transferForm"; recipient: Recipient };
The flow could then make the domain rules visible. A contact with one account proceeded directly to confirmation, whereas a contact with several accounts required an explicit selection. An unknown address had to be resolved before money could be entered. The user then reviewed the sender, recipient, amount and concept before submission, after which the interface entered an explicit success or failure state. The workflow can be expressed more clearly as a graph than as a collection of conditional components.
We kept a small workflow history so the back action returned to the previous logical step instead of guessing from browser history. While a transfer was in progress, the page guarded navigation and the submit action was disabled after the first attempt. Those controls improved the interaction, although server-side idempotency remained the control that ultimately mattered.
A global store or state-machine library would also have worked. The local union was enough because the workflow belonged to one feature and TypeScript could enforce exhaustive handling. If the process had needed to survive a reload, resume on another device or branch much further, I would have reached for a durable state machine.
Delivering fresh financial data without pretending it was streaming
Users expected balances and movements to stay current, but the API did not initially expose WebSockets or Server-Sent Events. I used a hybrid approach. The server rendered the initial balance, recent movements and contacts, which made the first authenticated view useful. Once the page became interactive, the browser refreshed account and movement data at a short fixed interval. Polling stopped when the document was hidden, and a failed refresh left the last successful data in place instead of replacing it with an empty state.
I described this as near-real-time, never real-time. We were polling. Naming the mechanism honestly made its latency, load and failure behaviour easier to discuss.
Polling fitted the HTTP API we had, failed in understandable ways and required no new event infrastructure. The Page Visibility API removed pointless background requests. It was not elegant, but it was observable and shippable.
WebSockets or Server-Sent Events would reduce repeated requests and lower update latency, but they would also require connection management, reconnection rules, event ordering, authentication renewal and server support. They become more attractive as the number of concurrent users or the required freshness increases.
Transport did not change the authority model. A balance displayed in the browser was informational until the server accepted a transaction. The back end remained the source of truth.
Handling data-heavy screens and asynchronous races
Movement and transfer histories introduced another set of scaling problems. Loading an entire history and filtering it in the browser would have increased payload size and produced results inconsistent with server data.
We moved search, filtering, sorting and pagination to the API. The front end maintained the user's current query and rendered reusable table components. The implementation later evolved to preserve filters in the URL, which made filtered views refreshable and shareable.
Rapid filter or page changes can also create a subtle race condition: an older, slower request may finish after a newer request and overwrite the correct result. The table data layer compared each response with the current parameters and ignored stale responses. Request cancellation with AbortController was another valid option; ignoring obsolete responses kept the abstraction simple for read-only requests.
This is the type of problem that rarely appears in a static design, but becomes visible as soon as realistic latency and user interaction are introduced.
Establishing quality gates with Jest, ESLint and Prettier
Creating the platform from scratch also meant defining what “ready” meant for front-end code. Manual QA remained essential for financial workflows, but it could not be the only defence against regressions as the number of pages, components and API states increased.
I established a layered quality process in which each tool addressed a different class of failure. TypeScript in strict mode caught invalid assumptions about nullable fields, API responses and component contracts during development, before those assumptions could become runtime defects. ESLint, including the Next.js Core Web Vitals rules and React Hooks checks, identified unsafe hook dependencies, accidental console statements, fall-through errors and framework-specific problems that the type system did not cover.
Prettier served a different purpose. It removed formatting debates from reviews and kept a rapidly growing codebase consistent, allowing review time to focus on behaviour and risk. Jest then provided repeatable automated tests and a coverage report for front-end logic and components. Together, these tools formed complementary layers: formatting made changes easier to review, linting enforced static conventions, TypeScript validated program structure and Jest exercised behaviour.
At the point recorded for the project, the Jest suite reported approximately 90% code coverage for its measured scope. I treated that figure as a signal rather than a target in isolation. Ninety per cent coverage does not prove that the most consequential behaviours are protected. Authentication expiry, account isolation, amount validation, transfer resubmission and error recovery deserve explicit tests regardless of the aggregate percentage.
The alternative was to rely primarily on manual acceptance testing until the MVP stabilised. That can appear faster initially, but it makes refactoring progressively more dangerous and supplies little repeatable evidence that quality controls have been exercised. Automated tests, linting, type checking and deterministic formatting created a baseline that both engineers and reviewers could verify.
Owning the design system while preserving accessibility
We followed a vendoring approach for the component system: the application owned the component source instead of consuming an opaque package. We used shadcn/ui patterns, Radix UI primitives, Tailwind CSS and class-variance utilities as the foundation.
Vendoring gave us direct control over styling, behaviour and accessibility. It also meant every change remained reviewable with the product code. The cost was ownership: copied components do not update themselves, so fixes and upstream accessibility improvements must be evaluated and merged deliberately.
A comprehensive component library such as Material UI would have accelerated some screens, but it would also have introduced a stronger visual language and more overrides. A separately published internal package would make sense once several applications needed the same system; for one evolving product, keeping the source close to its consumers reduced release overhead.
Accessibility was not delegated to the component library. We used semantic nav, main, table, heading and form elements, and introduced a keyboard-visible skip link to the main content. Form controls received correctly associated labels, descriptions and error messages, while aria-invalid, aria-describedby, loading status and current-page states communicated changes that visual styling alone could not express. Dialogs, menus, tabs and table-sorting controls had to remain keyboard-operable, and icon-only actions required screen-reader descriptions.
Currency presentation required particular attention. A locally formatted amount could be announced by a screen reader as a currency symbol followed by disconnected punctuation, even when its meaning was visually obvious. We created accessible labels that announced the value as currency units and minor units while preserving the expected visual format. Accessibility defects often hide inside apparently simple domain formatting rather than complex widgets.
Radix primitives helped with focus management and keyboard behaviour, but accessible primitives do not make an accessible product automatically. Each composed workflow still required keyboard and screen-reader testing.
Treating security and audit readiness as engineering work
Security was not confined to one login page. It affected every authenticated page and each component that displayed an account balance, accepted a destination identifier, initiated a transfer, changed account settings, configured a webhook or revealed an API key.
At the route boundary, server-rendered pages and API Routes were protected by a session managed through an external identity provider. Expired sessions were refreshed, and requests failed closed when identity could not be established. The business profile and account context travelled with API requests, but the back end remained authoritative for authorisation because hiding a button in React is never an adequate permission control.
At the data boundary, external responses were validated before they reached rendering code, and the Next.js integration layer limited the headers forwarded to the API. Sensitive interactions received additional treatment. A newly created API key was displayed once and masked afterwards, marked request and response bodies could be excluded from logs, dependency vulnerabilities and security-review findings were addressed, and the production container ran without root privileges. These measures covered different layers of the system and were most effective when treated as one control chain rather than unrelated tasks.
I also performed front-end security testing and vulnerability reviews across authenticated pages and reusable components, then worked with back-end and infrastructure engineers when a fix crossed system boundaries. Hiding a restricted button was never the goal. Session handling, account context, validation, data exposure, failure behaviour and client–server communication had to work as one control chain.
The project was preparing for PCI DSS assessment, and the assessment timetable influenced delivery decisions. It also produced the sharpest governance disagreement of the project. Because the MVP would be presented before the assessment, a senior technical leader sometimes treated several delivery controls as work that could wait. On some occasions, production changes were pushed without the engineers' approval, including force-updates to shared history. I said explicitly that I was uncomfortable with that practice. The response was that the assessment was still months away and the process could be repaired in the interval.
I understood the pressure behind the decision, but I disagreed with the premise. An assessment date is when controls are verified; it is not when they become necessary. Deferring a lower-risk hardening task can be a legitimate MVP trade-off. Weakening traceability and peer review is different because it removes the evidence and safeguards needed to understand every subsequent change. The experience changed how I think about delivery controls: branch protection, review, automated checks, immutable release history and rollback are part of the production architecture.
This is an account of an engineering disagreement, not a claim about the organisation's formal compliance status. PCI DSS spans technology, people, process, scope definition and assessment. My responsibility was narrower: improve the front-end controls, support the audit process and avoid creating gaps in the wider chain.
Making the platform observable
A browser monitoring and observability platform became a significant part of the work and supplied evidence requested during audit preparation. I introduced the front-end integration because production behaviour should be examined from evidence, not reconstructed from an incomplete user report.
The integration soon grew beyond basic error reporting. Real-user monitoring showed how pages behaved on actual devices and connections. Captured front-end errors and structured logs made failures searchable. Resource timing and long-task data helped us separate network delay from expensive browser work. Sampled session replay added context with user input masked by default, while environment and service metadata kept deployments separate. Once server traces were correlated, an error could be followed beyond the browser and through the request path.
Installing the SDK was the easy part. The real design problem was collecting enough context to diagnose a financial application without copying its financial and personal data into another system. API keys and sensitive request or response bodies had to be excluded. User and account identifiers needed a deliberate policy rather than unrestricted logging.
Observability improved production diagnosis and exposed failures that were difficult to reproduce locally. It also introduced cost, privacy and retention decisions. In a financial system, a session-replay or logging platform must be treated as another sensitive data processor, with sampling and access policies appropriate to that role.
Solving runtime configuration and deployment problems
One problem consumed an unreasonable amount of time for something called “configuration”.
Values prefixed with NEXT_PUBLIC_ are embedded in the browser bundle during the Next.js build. Our container workflow built the application before some environment-specific public observability values were injected. Those values were therefore missing or fixed to the wrong environment at runtime.
The variable name suggested a public-versus-private distinction. The bug was really about build-time versus runtime availability.
We kept API locations and credentials server-only. Values intentionally exposed to the browser monitoring SDK were read by the Next.js server at runtime and passed to the application explicitly. This solved the deployment mismatch, although using custom _app.getInitialProps carried a rendering and optimisation trade-off. A dedicated runtime configuration endpoint or an environment-specific build is another valid design.
We containerised the application, built it with a reproducible dependency install and ran the production process as a non-root user. The experience also showed why configuration must be kept outside source control and why build-time public values must be separated explicitly from runtime secrets.
Results
The result I care about most is that the MVP did not become a disposable prototype. The same foundation grew from balances, movements, contacts and transfers into scheduled and batch operations, reports, account management, notifications, webhooks and API keys without a complete rewrite.
The reusable component and data-access layers reduced duplication across those features. Server rendering improved the first authenticated view, while targeted bundle, rendering and request optimisations improved perceived responsiveness. In our internal measurements, selected load paths improved by approximately 50–70%, depending on the route and environment.
Jest, ESLint, Prettier, strict TypeScript checks and coverage monitoring made those changes safer to deliver. They also produced repeatable evidence of engineering discipline instead of relying only on manual confidence.
The less measurable result was a shared vocabulary. Product, QA, front-end and back-end engineers stopped using user, profile, account, contact, address and transfer state as if they were interchangeable. That alignment prevented at least as many defects as any library choice.
What I would change now
Looking at the code now with a principal-engineer lens, I would keep TypeScript, runtime schemas, the BFF boundary, explicit transfer states, server-rendered initial data and owned accessible components. I would be much less forgiving about the following areas.
Make production governance a technical control
The delivery process should have enforced protected branches, prohibited force-pushes, mandatory peer approval, required test and security checks, immutable release identifiers and a documented rollback path before the first production deployment. These are not merely administrative controls; they protect the integrity and traceability of the software supply chain.
Emergency deployment must still be possible, but it should pass through a defined break-glass process with named authority, automatic recording and retrospective review. Production history should remain immutable even when delivery is urgent.
Use purpose-bound tokens
The authentication design should explicitly distinguish token purposes. An ID token proves identity to the client application; an access token with the correct audience and scopes authorises calls to an API.
I would configure a dedicated application API audience, request minimal scopes, pass only the access token from the server and test issuer, audience, expiry and permission failures. The browser would continue to use the protected same-origin BFF without receiving the API token.
Replace the unrestricted catch-all proxy with an allowlisted gateway
A generic proxy is convenient, but it should not forward every authenticated path and HTTP method by default. I would define an allowlist containing the accepted method, path pattern, body limit and expected content type for each browser-facing operation. State-changing requests should also have explicit cross-site request forgery protection through origin or Fetch Metadata checks, with stricter confirmation for high-risk operations.
The back end remains the final authorisation boundary, but defence in depth should prevent the front end from becoming a transparent tunnel to endpoints it never intended to expose.
Never represent money or financial identifiers as floating-point values
The current domain types use JavaScript number for balances and transfer amounts, while some identity values are converted with parseFloat. I would change that contract.
Money should cross the API boundary as an integer number of minor units or as a decimal string handled by a decimal library. Account, tax and other financial identifiers should remain branded strings. They are labels, not quantities; numeric conversion can remove leading zeroes or lose precision.
Make account context explicit and tamper-resistant
The profile model correctly anticipates users with access to several accounts, but the inspected version implicitly selects the first profile. I would make the chosen profile a server-managed session value, verify that it belongs to the authenticated subject on every request and require the API to enforce the same relationship.
The user interface should display the active organisation, account and role consistently, especially on confirmation screens. This reduces both authorisation risk and human error.
Make telemetry private by default
The logging abstraction allows an endpoint to opt out of recording sensitive bodies. I would invert that rule: request and response bodies should be excluded by default, with a small allowlist of safe structured fields. Direct identifiers should be removed, tokenised or pseudonymised unless an approved diagnostic need exists.
Observability sampling, replay, retention and access should be environment-specific and reviewed with security and privacy stakeholders. Masking inputs is necessary, but it does not cover every source of personal or financial data.
Separate authentication failure from service failure
Several server-side paths redirect to logout when profile or account retrieval fails. A back-end timeout, schema mismatch or temporary 500 response does not mean that the user's identity is invalid.
I would model unauthenticated, unauthorised, unavailable and invalid-contract failures separately. Only the first should start a login flow. The others should preserve the session, display a safe recovery path and include a correlation identifier for support.
Consolidate server state and evolve beyond fixed polling
Custom hooks solved immediate requirements, but a shared server-state layer such as TanStack Query or SWR would provide request deduplication, cancellation, cache ownership, retry policies and consistent stale-data behaviour. Polling should include exponential back-off and jitter rather than issuing fixed-interval requests indefinitely.
If freshness and scale later justified it, I would introduce Server-Sent Events or WebSockets for balance and movement notifications while retaining request-based reconciliation as the source of truth.
Generate contracts and test risks, not only coverage
A versioned OpenAPI contract should generate transport types and clients, while Zod or generated validators should continue to distrust external data at runtime. Consumer-driven contract tests would identify front-end–back-end drift before deployment.
I would keep the coverage report, but place greater emphasis on tests for tenant isolation, token expiry, transfer idempotency, duplicate clicks, money precision, stale responses, keyboard-only completion and screen-reader announcements. End-to-end tests should cover the small number of flows whose failure could move money or expose sensitive information.
Remove global rendering costs from runtime configuration
Using _app.getInitialProps solved the immediate browser-monitoring runtime-variable problem, but it disables some automatic static optimisation and couples every route to configuration loading. I would replace it with a validated runtime configuration endpoint or an injected configuration asset containing public values only.
Finally, I would record route-specific Web Vitals, bundle budgets and repeatable performance baselines continuously. That would make the measured 50–70% improvement reproducible rather than dependent on a historical snapshot.
Closing thoughts
Leading this front end taught me that architecture is less about selecting fashionable tools and more about making constraints explicit.
Next.js and TypeScript were valuable, but the most important choices were more fundamental: keeping identity separate from account context, validating data at runtime, placing a controlled server boundary between the browser and the API, modelling transfers as explicit states, being honest about polling and treating accessibility and observability as system properties.
Those choices made the platform easier to change, easier to diagnose and safer to operate. For a financial product, that is the standard that matters.
About the author
- Full-stack engineer with 6+ years building scalable backend systems and web platforms. Specializes in database optimization, API architecture, and performance engineering with TypeScript, Python, and Node.js.
Comments
Join the discussionthe discriminated-union transfer state is the right instinct, and the honest framing on near-real-time polling over pretending it's a stream is exactly the kind of clarity that avoids a whole class of confused bug reports later. one thing I'd add to the money-as-floating-point section: even after moving to minor-unit integers, currency conversion/display formatting still needs its own decimal library at the boundary, Intl.NumberFormat is fine for display but silently reintroduces float rounding if you feed it a computed value instead of a stored one.



