Files
AM_CMS_Summative/README.md
T
2026-11-06 10:02:29 +00:00

2.7 KiB

This is a Next.js project bootstrapped with create-next-app.

Getting Started

First, run the development server:

npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev

Open http://localhost:3000 with your browser to see the result.

You can start editing the page by modifying app/page.tsx. The page auto-updates as you edit the file.

This project uses next/font to automatically optimize and load Geist, a new font family for Vercel.

Learn More

To learn more about Next.js, take a look at the following resources:

You can check out the Next.js GitHub repository - your feedback and contributions are welcome!

Deploy on Vercel

The easiest way to deploy your Next.js app is to use the Vercel Platform from the creators of Next.js.

Check out our Next.js deployment documentation for more details.

CMS README - Archie McCulloch

Setup Instructions

  • copy .env.example to .env and fill in values

  • ENFORCEADMIN is checked against "true" to determine whether to expose /users

  • npm install

  • npx prisma validate --config ./prisma7.config.ts

  • npx prisma migrate dev --name init --config prisma7.config.ts

  • npx prisma generate --config prisma7.config.ts

  • npx tsx prisma/seed.ts

  • npm run dev

  • seeded login details: "seededTest@test.test" + password defined in .env

Authentication Approach

  • Registation is done by a custom registration endpoint that creates uses in the database with hashed passwords using bcrypt
  • Email and passwod login is done with Auth.js Credentials provider which check against stored user and password hash
  • Google login is done with Auth.js Google provider, a database account is created if not already existing linked to their Google account by their Google ID
  • Routes access control is controlled by the proxy
  • Newsletter actions check for ownership using logged in user's ID
  • Auth.js signOut() endpoint clears the session and redirects to login page
  • Front end uses SessionProvider to gain access to session data which is fed by Auth.js
  • Auth.js uses JWT to store session information with http only cookies, a callback is used to append user.id to session