Former employer used Next.js as pure backend framework

Innovative Use of Next.js as a Backend Framework: A Case Study from a Scaleup Company

In the evolving landscape of web development, companies often explore unconventional approaches to meet their technical needs. Recently, I encountered an intriguing example during my tenure as a front-end engineer at a rapidly growing tech company. This case sheds light on an unconventional architecture choice that challenges traditional backend frameworks.

Background

At this scaleup, the primary front end was built using Angular, delivering a single-page application (SPA) across web and mobile platforms. The backend was structured as a RESTful API developed entirely in TypeScript, aligning with modern development practices for type safety and maintainability. Typically, such setups utilize established backend frameworks like Node.js, Nest.js, or similar.

Unexpected Architecture Choice

When I inquired about expanding my responsibilities to include backend development, I was surprised to learn that the company had constructed its entire backend using Next.js. This choice was particularly surprising because Next.js is predominantly recognized as a React-based framework for server-side rendering (SSR) and static site generation (SSG), primarily used for building client-facing web applications. It is not conventionally employed as a backend framework, especially not in place of more traditional server architectures.

Notably, the Next.js application in question was not serving a back-office administrative interface but was solely used for backend logic and API endpoints. This approach effectively repurposed Next.js as a server-side platform, leveraging its API routes and SSR capabilities to handle backend operations.

Implications and Reflections

This case raises interesting questions about the flexibility and boundaries of Next.js. While it is technically possible to use Next.js as a backend due to its API routes and server capabilities, such usage is atypical. The advantages might include seamless integration with the frontend codebase and simplified deployment, but it also raises considerations about scalability, maintainability, and architecture clarity.

Personal Departure

Ultimately, I opted to leave the company, recognizing that the unconventional architecture might pose challenges in the long term. This experience highlights how some organizations experiment with unorthodox solutions in pursuit of specific objectives, a reminder of the importance of aligning technology choices with project requirements and best practices.

Conclusion

While most companies adhere to traditional backend frameworks for server-side logic, some venture into innovative territory by leveraging frontend frameworks like Next.js for backend purposes. This case underscores the importance of understanding the trade-offs involved and encourages developers to think creatively while considering scalability and maintainability. Are more organizations adopting similar unconventional architectures? It


Leave a Reply

Your email address will not be published. Required fields are marked *