
Engage in a hands-on build of a real-world Instagram clone with NestJS and Next.js, applying TypeScript fundamentals, React concepts, and backend patterns via attached docs.
Learn about the monorepo setup with TurboRepo, access the full production Instagram clone code on GitHub, and follow guidance for forks and environment variables to reproduce issues.
Set up a pnpm-based turbo repo for a TypeScript monorepo, organizing apps and packages and configuring tasks to run the Next.js development server at localhost:3000.
Discover how to integrate Tailwind CSS and ShadeCN into a Next.js app, install dependencies, configure PostCSS, update tsconfig paths, and begin using prebuilt components for responsive styling.
Create and style signup and login pages with Next.js app router, using a file-based route structure and Tailwind, and link the pages to switch between sign up and sign in.
Learn to build reusable signup and login forms using ShadeCN’s card component, customize with the cn function and class overrides, and organize UI into an auth folder for Next.js app.
Explore form state management with react hook form and zod in ShadeCN to create accessible, validated client-side forms, and build reusable form components with radix ui and class variance authority.
Define a Zod-based signup schema (name, email, password, confirm password) with validation, integrate with React Hook Form via Zod resolver, and render a Next.js client form.
Create and validate a login form by building a login schema with email and password validation, wired to react-hook-form with zod, and mirror the signup flow.
Set up JWT authentication in a NestJS backend with BetterAuth, and connect to a local Postgres database using Drizzle ORM, creating a photosnap database and enabling PGAdmin4.
Initialize the NestJS back end inside the turbo repo using the NestJS CLI to create the project. Run through npm installs and adjust scripts to align with turbo tasks.
Install Drizzle ORM and Postgres, set up NestJS config to read environment variables, create a database module, and provide a Drizzle ORM connection via a pool for injection.
Implement end-to-end authentication with BetterAuth for NestJS and Next.js, persisting users with drizzle ORM and issuing JWT cookies. Enable global guards and public routes for secure, protected endpoints.
Implement database migrations to generate a drizzle ORM schema for BetterAuth, using a separate auth folder and the BetterAuth CLI to produce and apply migrations.
Build a Next.js UI with a BetterAuth auth client to enable email and password signup and login, proxied to the NestJS backend, and manage sessions via the secure betterAuth.sessionToken cookie.
Implement Next.js middleware to enforce authentication via the better off session cookie, redirect unauthenticated users to the login page, and expose public routes like /login and /signup.
Enhance user experience by auto logging in after signup and redirecting to the homepage with Next.js router. Add a global form error using React Hook Form to show authentication issues.
Set up the app shell with a responsive three-column layout using Tailwind CSS grid, featuring a posts feed, stories top bar, and a sticky sidebar for suggestions and settings.
Build a stories component for the Instagram clone, using mock data and interfaces to render user avatars and story thumbnails, with plans to connect via TRPC to the backend.
Build a photo feed with mock posts, user avatars, images, captions, likes, and a comments indicator using a feed component and card layout, ready for backend integration.
Build a sticky sidebar with a user profile card, settings panel, dark mode toggle, and logout, displaying the current user's email and name via the session hook.
Implement dark mode in a Next.js app using NextThemes, wrap the app with a theme provider, and add a theme switcher with a dropdown for light, dark, and system themes.
Finish the sidebar by rendering suggested users with mock data: avatars, usernames, a followed-by field, and a follow button, preview backend integration with Postgres, Drizzle ORM, TRPC, NestJS, and Next.js.
Implement a posts backend with drizzle ORM for Postgres, defining posts schema (id, image, caption, likes, created_at, user_id) and migrations, then build a posts service to persist and read posts.
Set up a tRPC server to provide an end-to-end type-safe API, sharing a single schema between back end and Next.js UI in a turbo repo, using NestJS TRPC and Zod.
Create and validate a post schema with Zod, expose a NestJS TRPC post router via HTTP, and implement create post mutation and find all query with typed input and output.
Finish backend posts with drizzle ORM and NestJS, exposing create and find all via TRPC, inject database providers, and format post responses by including user data and post metadata.
Create a reusable photo upload dialog wired to a NestJS backend. Build with shadecn dialog, drag-and-drop upload, image preview, caption input, and TRPC mutation to create a post.
Implement generic image uploads in a NestJS backend with multer, using disk storage and uuid-based filenames in an uploads directory for posts, avatars, and stories.
Apply a NestJS file interceptor to handle image uploads via a post route, extract the file, and pass it to the upload service for disk storage and future cloud storage.
Update the Next.js UI to upload images using form data, appending the image under the image key and posting to the Moulter endpoint to save the file, with API prefix.
Integrate a tRPC client into the Next.js UI to enable end-to-end type safety via the shared app router, and configure react query with an HTTP batch link to /api/trpc.
Add an image field to the create post mutation, save the image file name, and fetch posts with TRPC to update the feed with uploaded images served by NestJS.
Serve uploaded images as static assets from a nestjs backend, wire a next.js UI to access them via configured URLs, and refresh the feed cache after posting new content.
Implement a reusable avatar upload flow that updates the profile picture, displays the current avatar, and uses a shared avatar URL utility to fetch images from the server.
Upload a profile picture via form data to the api upload image endpoint, update the user with the image using better auth, and refresh posts and stories to reflect it.
Implement authentication for a tRPC server by adding a NestJS tRPC middleware that validates the better auth session cookie, populates the context with the user, and protects all procedures.
This course walks you through building a real Instagram-style application from scratch using a modern, type-safe fullstack stack.
You will build a fully featured app using NestJS, Next.js, tRPC, PostgreSQL, Drizzle ORM, Tailwind, shadcn/ui, Better Auth, and Turborepo. The focus of this course is not just features, but architecture, end-to-end type safety, and an excellent development experience through shared types and code between the frontend and backend.
This is a hands-on, production-focused course where every feature is built end to end, from database schema to API to UI, using patterns you can reuse in real-world applications.
What You Will Build
By the end of this course, you will have a complete Instagram-style application that includes:
Secure authentication with shared types across backend and frontend
A type-safe API using tRPC with full end-to-end inference
Posts with image uploads, likes, comments, and saved posts
Stories, user profiles, followers, and profile pictures
A modern UI built with Tailwind and shadcn/ui
A scalable monorepo using Turborepo with shared packages
A NestJS backend designed for real production workloads
Production deployment using AWS and Vercel
What You Will Learn
How to design end-to-end type-safe APIs with tRPC
How to share types and logic between frontend and backend safely
How to structure a scalable Turborepo monorepo
How to build clean NestJS services and routers
How to model data with PostgreSQL and Drizzle ORM
How to implement JWT authentication correctly across the stack using Better Auth
How to handle file uploads and media in production using AWS S3
How to deploy a fullstack application to production using AWS ElasticBeanstalk
Who This Course Is For
This course is for JavaScript and TypeScript developers who want to build real fullstack applications with modern tooling and strong type safety.
It is especially valuable for developers who care about clean architecture, developer experience, and eliminating API mismatches between frontend and backend.
You should be comfortable with TypeScript fundamentals & basic NestJS + Next.js concepts.
Why This Course
Most tutorials stop at simple examples or skip over important architectural decisions. This course focuses on building a real application with shared types, real data models, and production deployment so you can apply the same patterns in your own projects or at work.