DEV Community

Agnes Shan
Agnes Shan

Posted on

Next.JS Successes and Struggles

Intro

Over the past two weeks or so, I've been developing an online ARPG site in Next.JS. This was purely an experiment in trying out different languages and libraries, so I wasn't going for the most efficient web application; I was determined to build this web application using a very specific tech stack.
When Next.JS was introduced to me by a friend about a year ago, it was pitched to me as "backend built on the frontend...so you don't really need a backend. Because it's on a frontend." Obviously, I was intrigued.
Prior to using Next.JS, I'd been mostly using Flask for simpler web apps and Django if I needed anything more complex. For databases, I usually used either PostgreSQL or just plain MySQL. To really throw myself into the challenge, this time I used Next.JS with NoSQL (specifically MongoDB).

Successes

I had developed a bit of a penchant for building static sites with Zola and horribly misusing TOML templating, so I did really enjoy Next.JS's function components. I had a lot of sections on the same page that needed to look the same with different information, so it was really easy to just map over it.
The documentation for Next.JS was also fairly clear and easy to navigate.
I was a big fan of useStates, although I guess that's more of a React component than Next.JS.
Overall, and it pains me as someone who likes to keep things based on tangible evidence, it did feel more lightweight.

Struggles

When thinking of struggles with Next.JS, it's very easy to compare it to my past experience with Django. I think the biggest issue I had was that user authentication was a lot harder with Next.JS, in particular because I had to rely on an authentication platform since "backend built on the frontend" is just code for "some backend features! But still mostly frontend".
When querying database data, I forget what documentation I read, but some of the documentation for Next.JS very clearly stated that instead of accessing an API, it was better to just query the database directly in a Server Props wrapper, which was a bit odd.
Completely unrelated to Next.JS, but I also did miss being able to use relations from PostgreSQL, although I committed to using NoSQL this time.

Top comments (2)

Collapse
 
rafde profile image
Rafael De Leon

@48nes I am guessing that NextAuth didn't work for you as a solution for authenticating?

Collapse
 
48nes profile image
Agnes Shan

I ended up using auth0!