
Build a Shopify-style rest API with Next.js, Prisma, MongoDB, and TypeScript, covering route groups, dynamic routes, bcrypt and JWT authentication, and Zod validation for a scalable backend.
Open a project folder, install a specific Next.js version (15.2.1) with npx create dash next app, and verify the setup by running npm run dev inside the project folder.
Install Prisma at version 6.4.1 to avoid incompatibilities with different Next.js versions. Run npm i prisma@6.4.1 @prisma/client@6.4.1 and verify the Prisma client and Prisma versions.
Learn to create route groups in Next.js by organizing api folders into auth and app, which don't appear in the URL, and access endpoints like get all.
Learn how to create a get request endpoint in Next.js, handle it asynchronously, and return a JSON response with NextResponse.json.
Explore creating a post request alongside get requests, wiring a saving data endpoint in route.ts, and testing with Thunder Client to observe a 405 method not allowed error.
Register a free MongoDB account, create a project and a cluster, choose a free deployment near Cape Town, and connect MongoDB to Prisma using VS Code.
Initialize Prisma and set up a MongoDB connection, create a users model in the Prisma schema, and push the schema to MongoDB to verify the users collection.
Refine the Prisma user model for MongoDB, with an auto-generated unique id mapped to the ObjectId and fields like email (unique), name, last name, and password, plus user-post relationships.
Define a Prisma user type enum with values seeker and employer, assign default seeker for new users, and align the type field with the API and UI constraints.
Create a Prisma post model with a string unique id and a created timestamp defaulting to now, including title, description, salary, location, closing date, and a relationship to another model.
Prisma guide to building a one-to-many relationship between user and post, using user ID and post ID as primary and foreign keys, with bidirectional references in MongoDB.
Create a category enum for a prism post in a React Next.js TypeScript backend, with a general default and languages like JavaScript, PHP, React, Next.js, React Native, and Python.
Push Prisma models to MongoDB and sync schemas with Prisma db push, updating Shopify and Post models and refreshing the job B5 project to reflect the new schema.
Discover how to implement a prisma client singleton in a Next.js app by creating a lib singleton prisma module that exports one prisma instance to power a sign-up endpoint.
Create a signup route in the auth group of a Next.js API. Implement a post method with async handling, Prisma integration, and mocked data to test user creation and responses.
Learn how to receive signup data from the frontend in a Next.js app, extract JSON from the incoming request, await the data, and return it as a JSON response.
Validate signup data using Zod by building a schema for name, last name, email, password, and an optional user type enum; test and respond with validation results.
Validate signup data against the schema to ensure correct structure and data types. Check for an existing user with Prisma find unique on email, and store only if unique.
Learn how to secure signup by checking if a user exists, hash passwords with bcryptjs in a Next.js rest api backend, and save the hashed password to MongoDB.
Learn to generate a JSON web token for signup, sign it with a secret key, set expiration, and return it to secure the API.
Create a reusable jwt generator in typescript to issue tokens on user sign up and login, using a generic function, a jwt payload type, and a shared secret.
Refine json web token payload by trimming user data to minimal fields, aliasing sensitive keys, and removing password and unused properties before token generation, ensuring a clean, secure payload.
Design reusable server responses for a React Next.js TypeScript backend by implementing a centralized API responses module with standard status codes, generic success and error payloads, and clear messages.
Create a sign in route in a Next.js api under auth, validate email and password with Zod, infer client data types, and handle bad requests and user checks with Prisma.
Sign in flow continues by validating the user with bcrypt, generating a jwt token from minimal user data, and returning an unauthorized message for invalid credentials.
Create an add post route in a Next.js app, using zod to validate title, description, salary, location, closing date, userId, and category, with async request handling and JSON responses.
Use a singleton Prisma to create a post, return the created item when success is true, and verify it in MongoDB while sending API errors for failure.
Create a get all posts route using a route.ts file, exporting a sync handler with try/catch, returning API data via prisma find many and testing the get request.
Discover pagination in http rest apis by splitting large data sets into pages using page and limit, enabling incremental fetch to improve performance, memory usage, and user experience.
Learn to extract pagination query parameters from the URL using Next.js style search params, convert them to integers, apply defaults for page and limit, and pass them to data fetching.
Build prisma pagination by calculating skip as (page - 1) * limit and using take, count posts, include user data (username, last name, user id), and order by created descending.
Develop pagination logic in REST API using page and limit, compute total pages from total posts, and return metadata with next and previous URLs built from the request base URL.
Finalize pagination logic by building dynamic urls with page and limit, exposing total posts, total pages, current page, and next/previous urls for frontend.
Create a delete account route in Next.js using a dynamic slug to receive the user id, and use Prisma to perform a multi-transaction to delete posts and the user.
Learn to implement a delete post by ID API route in a Next.js TypeScript app using Prisma, with dynamic routing, existence checks, and proper error handling.
Create a dynamic Next.js post route to update user data by id, validate the request body, fetch the user with Prisma, and update fields, hashing the password when it changes.
Validate and refine the user update password logic by testing the endpoint, confirming passwords are hashed, and ensuring name updates apply when a password is provided.
Create a post update api route with a dynamic post id, validate input against the post schema, and enable optional updates to title, description, salary, location, closing date, and category.
Learn to align frontend types with the backend schema using Zod validation, fix type mismatches, and implement and test the update post endpoint in a TypeScript React Next.js API project.
Learn how middleware in Next.js acts as an interceptor between requests and responses, validating JWT tokens before protected endpoints and allowing public routes like sign in and sign up.
Learn how middleware receives the authorization token from the client via the request header in Next.js server functions and uses a bearer token to secure API endpoints.
Learn to extract and validate tokens in middleware: detect bearer tokens, split and obtain the jwt, support raw tokens, and apply authorization checks to protect api routes.
Verify a JWT token in an async middleware using a secret key to validate the payload. Inject user data into the request for endpoint access control and guard against tampering.
Explore middleware in a React Next.js Rest API backend, validating JWTs, handling unauthorized responses, and implementing robust error handling with try-catch for endpoints like add post and update post.
Ready to become a job-ready backend developer? In this hands-on course, you’ll build a fully functional Job Posting REST API using Next.js 15 App Router, Prisma ORM, MongoDB, and TypeScript — a powerful stack used by top companies today.
You’ll learn how to create a modern backend where users can register as Job Seekers or Employers, post jobs, view listings, and manage data with full CRUD functionality. Authentication is handled using JWT tokens with Next.js Middleware to protect routes globally. Passwords are securely hashed with bcryptjs, and all data is validated using Zod schemas to ensure reliability.
We’ll implement pagination to efficiently handle large sets of job posts and improve performance. You’ll also use route groups, dynamic routing, and organize your API using clean architecture and the Prisma Singleton pattern. To simulate real-world development, we’ll explore simple and multi-model transactions for managing complex database operations safely.
This course is beginner-friendly but packed with professional-grade practices that prepare you for freelance work, interviews, or your first developer role.
By the end, you’ll have built a complete backend — and the confidence to build APIs that work in the real world. Course taught by Matthew Msingathi the designer and developer form South Africa