Technology Reflection
Previously, Next.js, PostgreSQL and file storage were chosen as an “optimal” technology stack. This section looks back on the development process to see to what extent they performed as expected.
Framework
Overall, I’ve been quite happy with Next.js. With my basic knowledge of React and Next.js’s solid documentation, it wasn’t difficult to get started with building the application. Their file-based routing system makes it intuitive to create new page routes, and data flow between the server and client is mostly seamless.
Some things, however, turned out more difficult than expected. During development, I also had trouble with implementating some features, such as page transitions and keeping state after navigating pages. With Next.js’s large community – my main reason for choosing the framework – I expected it to be easy to find solutions to such problems. However, due to the recent (May 2023) switch to the app router, most answers on sites like StackOverflow are outdated, and there’s not always solutions available for the newer versions.
Database
During this project, I have not stumbled upon any limitations of PostgreSQL. The relational data structure makes it easy to model different data items and their connections, and provides error messages when trying to do something stupid (deleting an item that still has references elsewhere).
It must be said that with the library I used, the experience would probably have been nearly identical when using the other relational options (MySQL/MariaDB). Prisma even supports MongoDB, which could have been used in the same way, although the current data model is far from optimal for that database, requiring additional queries to achieve the same functionality.
Data Storage
As expected, native support by Node.js and all libraries make file storage a breeze to use: passing them a file path is often enough to make things work. In addition, serving files through a Next.js route handler makes it easy to perform the same permission checks as for regular pages.
The big downside of file storage is scalability. On my desktop this isn’t a problem – there’s enough disk space for thousands of pictures – but on my tiny webserver, additional storage comes at a high cost, and I ended up spinning up a temporary server with more space for showcasing the project. An object store that could be connected to regardless of where the app server is hosted would have been a nice alternative.