← Back to Blog

Django dev tries Next.js

djangonextjstypescripttailwindpythonjavascript

Django dev tries Next.js

What is Next.js?

Let's take a look at the documentation.

They say it's the React framework for production.

You might ask, isn't React a framework? Yes and no - it is a JavaScript library for building frontend components, reusable code to make pretty user experiences. To steal a quote from my buddy Theo: "Next is a backend framework that tricks frontend devs into using it."

What is Django?

Let's take a look at the documentation.

They say it's the web framework for perfectionists with deadlines.

It makes sense - some of the biggest sites on the internet are made with Django. Django Stars has some of the best sites made with Django: NASA, Spotify, and others. Django is a backend framework based on Python. Python is a great first language to learn; the syntax looks a lot like English.

One strict rule is spacing in the python code. Django is a large, high-powered framework with a lot of magic behind the scenes. The learning curve on Django is steep, but once you get it, you'll have superpowers when building a site.

How I started working with Next.js

I got more involved with the dev community on Twitter, mostly in Twitter spaces. Jacob MG Evans hosts weekly spaces, and I got over my fear of sounding dumb when talking tech. Theo is also a speaker in all of Jacob's spaces.

He has a habit of finding the simplest solutions for solving his problems. And what is programming? Using tech and code to solve problems.

One of my mentors, Stefan, always says: "Be tech agnostic. See the problem and use the tech that best solves it."

Theo challenged me to build something with TypeScript and Next.js. I downloaded a TypeScript book and started to read it. He said, "No, don't read a book. Build it and figure it out."

So I watched a video on TypeScript and Next.js to see how to name my files and do components because I know zero React. I tried to learn React many times but using Django and Bootstrap was faster and somewhat easier for me.

TypeScript

I have a dislike of JavaScript - I find it to be a silly language and kind of hacked together. If you look into the history of JavaScript, you will see that is the case. It has evolved over the years and become a little more uniform.

I didn't understand it or get it until I learned Python, then it started to make a little more sense to me. I like that TypeScript is strongly typed - it shows you when your code isn't right. JavaScript is more of a "pray it works - console.log why didn't it work and spend the next 6 hours debugging."

Tailwind CSS

Tailwind CSS - the new kid on the block for CSS frameworks. I enjoy this framework. A lot of people say it makes your HTML look ugly, but with breaking up your code into sections, I don't think so.

With Next.js auto-refreshing your page, you can adjust the styles on the fly vs. going back and forth between documents. Mix in your ES6 and arrow functions and things - I feel it is a fast way to build your frontend vs. keeping track of multiple CSS files and JavaScript files.

Next.js

I enjoy how simple it is to deploy. I love the auto-loading and routing. Making pages and components are simple, wherein Django every new thing is its own app. Then you have to go into the URL patterns and set up the routes in apps.

Django takes a bit more work to deploy. It's tricky, and you need to know a touch of DevOps to do it.

Summary

  1. There isn't one magic stack - software is a forever learning field.
  2. Django is great, and lots of great sites are built with it.
  3. Next is excellent and growing, and it is a tool you can use to solve problems more manageable.
  4. Tailwind is a fantastic substitute for Bootstrap.
  5. Bootstrap is great and is on the decline, but many places on the net still use it.

Check me out next time on my Twitter - new portfolio site coming soon!

Resources