- NextJs 14
- TailwindCSS
- Prisma ORM
- SQLite
- NextAuth
- zod
- Prisma ORM
- SQLite
npm i
npx prisma migrate dev --name init
You can update the schema in schema.prisma and run npx prisma migrate dev
to update the tables. You can add models or update the config in prisma.prisma
file.
- NextAuth with defaults for Github auth.
Steps:
- Register OAuth app at: http://github.com/settings/applications/new
- Fill authorization callback URL with http://localhost:3000/api/auth/callback/github
- For prod you will need separate registration
- Add to .env:
AUTH_SECRET
(random string by your choosing),GITHUB_CLIENT_ID
,GITHUB_CLIENT_SECRET
- app router
- route
- _components (used only on that route)
- _actions (used only on that route)
- route
- components
- ui (design system components)
- other common components
- actions (common actions)
- data-access (db util functions - act as a facade)
- db (db configs)
- lib (third party exports)
- utils
See .env.example
Route protection is implemented with Higher Order Component - withAuth
.
Prisma does not work in NextJS middleware because the middleware runs on the edge (not NodeJS).