Skip to content

A very minimal Next.js template that uses server actions, Prisma, PostgreSQL, TailwindCSS, Shadcn, Zod and Next auth.

Notifications You must be signed in to change notification settings

danybeltran/nextjs-typescript-and-mongodb

Folders and files

NameName
Last commit message
Last commit date
May 27, 2024
Mar 28, 2024
Jan 24, 2025
Jan 12, 2021
Dec 28, 2024
Jan 24, 2025
May 27, 2024
Feb 5, 2023
Jan 24, 2025
Dec 25, 2024
Dec 20, 2024
Mar 31, 2024
Dec 28, 2024
Jan 14, 2025
Jan 12, 2021
Dec 25, 2024
Dec 25, 2024
Dec 25, 2024

Repository files navigation

A Next.js template

A Next.js app that uses Shadcn, Prisma ORM, MongoDB PostgreSQL and Next Auth

Deploy with Vercel

Updating deps

To update the dependencies to their latest versions, run:

./scripts/update-deps.sh

Development

You need to pass an env. variable with the MongoDB connection string, as well as any variables required by next-auth:

NEXTAUTH_SECRET=
GOOGLE_APP_CLIENT_ID=
GOOGLE_APP_CLIENT_SECRET=
NEXTAUTH_URL=http://localhost:3000
# Connect to Supabase via connection pooling with Supavisor.
DATABASE_URL=
# Direct connection to the database. Used for migrations.
DIRECT_URL=

(You don't need NEXTAUTH_URL if you are deploying to Vercel)

How to get these variables?


DATABASE_URL and DIRECT_URL: Visit the Supabase documentation



Use your preferred tool to generate the NEXTAUTH_SECRET hash:

Using This tool is the quickest way to generate a hash. You can change the last segment of the url to get a hash of your preferred length, such as https://generate-secret.vercel.app/44

OpenSSL :

openssl rand -base64 32

Urandom :

head -c 32 /dev/urandom | base64

Python :

import base64
import os

random_bytes = os.urandom(32)
base64_string = base64.b64encode(random_bytes).decode('utf-8')
print(base64_string)

JavaScript :

const crypto = require('crypto')

const randomBytes = crypto.randomBytes(32)
const base64String = randomBytes.toString('base64')
console.log(base64String)

You can add those variables to a .ENV file (don't forget to add it to your .gitignore file!)

Related documentation:

Live preview