Note
Template Project Next.js (Tailwind CSS v3), Prisma ORM, and AWS S3 for Cloudflare R2 for Bootcamp devscale.id.
This is an example template, already set up:
- DATABASE_URL
- JWT_SECRET
OAuth Google Cloud Console
- GOOGLE_CLIENT_ID
- GOOGLE_CLIENT_SECRET
- GOOGLE_REDIRECT_URI
Cloudflare R2
- R2_CLIENT_ID
- R2_CLIENT_SECRET
- R2_S3_ENDPOINT
- R2_PUBLIC_URL
- Clone this repo or use as template:
- Clone the repo.
git clone https://github.com/Devscale-Indonesia/devscale-nextjs-r2.git <project-name>
# at current directory/folder
git clone https://github.com/Devscale-Indonesia/devscale-nextjs-r2.git .
# using ssh
git clone [email protected]:Devscale-Indonesia/devscale-nextjs-r2.git <project-name>
# at current directory/folder
git clone [email protected]:Devscale-Indonesia/devscale-nextjs-r2.git .- Create project with template.
npx create-next-app@latest -e https://github.com/Devscale-Indonesia/devscale-nextjs-r2 <project-name>
# at current directory/folder
npx create-next-app@latest -e https://github.com/Devscale-Indonesia/devscale-nextjs-r2 .- Move to directory
cd <project-name>- Install dependencies:
npm install- Copy the
.env.exampleto.env:
cp .env.example .env- Setting provider database and create database model in the schema.prisma file.
prisma
└── schema.prisma- Do prisma migration:
Warning
This step if the database provider used is SQLite, otherwise ignore it and skip this step.
npm run db:migrate- Use
db pushto push the initial schema to the database:
npm run db:push- Do prisma generate:
npx prisma generate- Run the development server:
npm run dev-
Open http://localhost:3000 with your browser to see the result.
-
Do prisma studio:
npm run db:studio- Open http://localhost:5555 with your browser to see the result.
Tip
Don't forget adding prisma generate to the existing script build command Vercel.
Another way to configure prisma generate to be run on every deployment is to add the command to the build settings via Vercel's UI.
Within your project's dashboard, go to the Settings tab and find the General section. In that section you will find a box labeled Build & Development Settings that contains an input field named Build Command:
Within that field, prepend prisma generate to the existing script:
prisma generate && next buildReference: Vercel build dependency caching workaround

