Your Next.js Project Doesn't Need Auth

  Рет қаралды 3,200

Sam Meech-Ward

Sam Meech-Ward

Күн бұрын

It doesn't matter if you're building an app for money or for yourself, you should always be focusing on building the most important and most valuable features. In the early stages, login is not an important feature, and it can make initial development slower, so put off login.
Once you're ready to implement login, check out my video on using next auth with next 14 • Your Next.js Project D...
Chapters:
0:00​ Intro
1:14 App without auth
2:24 Fake auth
12:26 Conclusion
🔗Moar Links
My Website: www.sammeechward.com
Instagram: / meech_ward
Twitter: / meech_ward
Github: github.com/orgs/Sam-Meech-Ward

Пікірлер: 11
@user-ty6di6ky2o
@user-ty6di6ky2o 7 ай бұрын
Great video and theory. Always fantastic content and ideas. Glad to see you are back
@SamMeechWard
@SamMeechWard 7 ай бұрын
Thank you 🤗 I always love the comments
@developerpranav
@developerpranav 7 ай бұрын
This is a good mockup auth system, and now I'd want to implement this "fake" system in other places when I'm just testing something :) Great video! However, I do find that implementing Clerk Auth is much quicker and simpler (they have a signin with google button) Having a real auth will also protect your APIs!
@SamMeechWard
@SamMeechWard 7 ай бұрын
I really like clerk and i've had a lot of success using clerk in production applications, but I have one minor and one major issue with using clerk: ## Major Issue To use clerk, you'll end up using their library which forces you to use the ClerkProvider which wraps everything in a client component and forces all your pages to be dynamic with no option for static rendering. This is mainly an issue because it doesn't align with modern next where we're preparing for partial static rendering coming soon. Clerk will probably change this at some point, but i want to wait to find out if they do and I don't want to write my code around their current library if it's all going to change. ## Minor Issue It's still slightly more complex than a fake login system and I find myself thinking about too many auth things when i use clerk, like trying to reason about the UI and login flow. ## Another Issue You can't easily manage users in your database. I end up setting up webhooks to get a notification when a new user is created then i have a server side route insert that user into the database. It's not super difficult, but more work than I should reasonably be putting in at the start of development.
@milkmyshake
@milkmyshake 7 ай бұрын
Great approach! Any chance to showcase a Pages Router version?
@rezastella777
@rezastella777 7 ай бұрын
Hey Sam great vid. just a minor point, the sound level seems a bit low.
@SamMeechWard
@SamMeechWard 7 ай бұрын
Thank you, i'm still trying to get the sound settings right on this new microphone. It might take a few videos for me to get it right. Let me know when I get it right.
@adibk
@adibk 7 ай бұрын
Could you implement Clerk or NextAuth in the same amount of time? Both of those provide all the login screens you need assuming you don't decide to build custom versions.
@SamMeechWard
@SamMeechWard 7 ай бұрын
This is a really good question and I would love people to try and implement my example with next auth and clerk and tell me what they think. I've done this exact scenario with next auth in a different video. It's only available to channel members right now but i'll make it public early next week. The video is more than twice as long as this one and there's much more complex code: kzbin.info/www/bejne/Y3vRdqishdKnY7M The short answer to your question is that it's more difficult with next auth and clerk for many many reasons. For example, how do you manage user data in your own database? In next auth you need to use a database adapter, in clerk you need to use webhooks. Clerk also has an outdated way of managing auth using a Session Provider. They will probably change this in the future and you'll have to change all your code along with it. Next auth is migrating their docs right now so it's hard to find all the information you need and something simple like a user_id doesn't exist in the session object returned by calling auth() so you need to figure out a nice way around this. There are more reasons but this reply is already too long
@undefindjs2419
@undefindjs2419 7 ай бұрын
I couldn't not disagree more. I am working on a project where the main focus is to have a user and create objects for the DB. And the absolute first thing to get working is the Auth/Token handle. If this doesn't work, the app is simply useless. You must have a working Auth/Token so you can check that API/DB access is working properly. And with Next 14 and RSC, it is very important that you only fetch content that you are allowed to see and that the cache control is correct. And with any kind of app that has Auth, you need to test the page in incognito mode with more than 1 user, so you can see that there are no problems. To solve Auth problems later in a project, you will only make ad-hoc solutions that will not be as good as if you did the Auth well in the beginning. If you have Auth in your app/web. Get it working the first thing you do and make sure the data/structure is correct.
@SamMeechWard
@SamMeechWard 7 ай бұрын
The fake login solves these problems by using cookies. It sets you up well for streaming and partial pre rendering. I could drop in next auth later on with minimal changes. Unless your backend is somewhere else or you’re using some session provider but that goes against modern next and is outdated for next 14
React Proxy | Easiest Fix to CORS Errors
15:52
Sam Meech-Ward
Рет қаралды 77 М.
10 common mistakes with the Next.js App Router
20:37
Vercel
Рет қаралды 181 М.
Cute Barbie Gadget 🥰 #gadgets
01:00
FLIP FLOP Hacks
Рет қаралды 42 МЛН
Each found a feeling.#Short #Officer Rabbit #angel
00:17
兔子警官
Рет қаралды 5 МЛН
Её Старший Брат Настоящий Джентельмен ❤️
00:18
Глеб Рандалайнен
Рет қаралды 7 МЛН
MOM TURNED THE NOODLES PINK😱
00:31
JULI_PROETO
Рет қаралды 35 МЛН
Next Auth Credentials Provider - Ultimate Guide
50:01
Brett Westwood - Software Engineer
Рет қаралды 47 М.
The Story of Next.js
12:13
uidotdev
Рет қаралды 540 М.
I built the same app 10 times // Which JS Framework is best?
21:58
Fireship
Рет қаралды 2,4 МЛН
Next.js App Router: Routing, Data Fetching, Caching
14:32
Vercel
Рет қаралды 292 М.
DiagramGPT - Honest Review of Eraser AI
8:22
Sam Meech-Ward
Рет қаралды 110 М.
Storing Images in S3 from Node Server
39:59
Sam Meech-Ward
Рет қаралды 79 М.
Can we use Laravel as a Next.js alternative?
20:13
Andrew Schmelyun
Рет қаралды 15 М.
How to Protect Routes in Next.js 14 in 4 Ways - Private Routes - Authorization
27:47
Using Forms in Next.js (Server Actions, Revalidating Data)
10:27
Lee Robinson
Рет қаралды 124 М.
Хотела заскамить на Айфон!😱📱(@gertieinar)
0:21
Взрывная История
Рет қаралды 163 М.
😱НОУТБУК СОСЕДКИ😱
0:30
OMG DEN
Рет қаралды 3,4 МЛН
С ноутбуком придется попрощаться
0:18
Up Your Brains
Рет қаралды 423 М.
iPhone 15 Unboxing Paper diy
0:57
Cute Fay
Рет қаралды 3,4 МЛН
5 НЕЛЕГАЛЬНЫХ гаджетов, за которые вас посадят
0:59
Кибер Андерсон
Рет қаралды 1,5 МЛН
WWDC 2024 Recap: Is Apple Intelligence Legit?
18:23
Marques Brownlee
Рет қаралды 4,8 МЛН