DEV Community

Cover image for Create a Fullstack Blog App with Next.js, Prisma 2 and Docker- Part I Setup the Repo and Configure the Backend

Create a Fullstack Blog App with Next.js, Prisma 2 and Docker- Part I Setup the Repo and Configure the Backend

Code Mochi on July 08, 2019

This post will go through how to use Docker to create a full stack javascript application with Next.js for server side rendered goodness and Prisma...
Collapse
 
jmramirez profile image
Jose Ramirez

Hey, I have a question, in the index page you import the type NextPage, although I don't see you use getInitialProps or something similar, is there any reason for you to put "import {NextPage} from 'next'" or it's just simple convention?

Collapse
 
codemochi profile image
Code Mochi

Hi Jose! That's a great catch- I just checked and you definitely don't need to import NextPage there, you can simply define your page component as a function and export that. I'll be sure to update the code- thanks!

Collapse
 
brunocrosier profile image
Bruno Crosier

Hey, just noticed one small thing that needs updating since prisma just updated prisma2..

The article says: "Let's fix that by updating backend/prisma/project.prisma file"

The project.prisma file has now been renamed to schema.prisma (see: github.com/prisma/prisma2/releases...)

Collapse
 
codemochi profile image
Code Mochi

Awesome thanks for letting me know! I'll fix it ASAP. Thanks for reading!

Collapse
 
nirmal_kumar profile image
Nirmal

@codemochi Excellent post. Waiting for the Part 2 of this series.

Collapse
 
codemochi profile image
Code Mochi

Thanks Nirmal! I'll do you one better- we have part 2 and 3 out as of today! Check out the top of this post for the series links to the other posts on dev.to or go straight to the source:
codemochi.com/blog/2019-07-10-pris...
codemochi.com/blog/2019-07-12-pris...
Cheers!

Collapse
 
nirmal_kumar profile image
Nirmal

Thanks CodeMochi.

I am getting this error when i cloned from the github.

Am i missing something. But i can able to access the GraphQL Playground and not the App from 3000 port.

Thread Thread
 
codemochi profile image
Code Mochi

Can you tell in your terminal what the error is? You should see that docker-compose is listing the output of all your containers and you can look at what is going on with the frontend container. I wonder if you ran npm stop and npm start if that would fix it. Maybe some error happened during the build of the frontend container.

Collapse
 
brunocrosier profile image
Bruno Crosier

Nice! Btw Next.js v9 dropped today so it might be a good idea to update the section that talks about the Canary version. V9 has typescript support :)

Collapse
 
codemochi profile image
Code Mochi

Super sweet, I'll update that too. Thanks Bruno!

Collapse
 
arcticspacefox profile image
ArcticSpaceFox

Very cool !!!