Next.js Discord

Discord Forum

Custom auth system

Answered
OxyGen posted this in #help-forum
Open in Discord
I'm doing my custom auth system in Nextjs 14. Backend is on python for now (will change to rust in future)
I need some help how can I complete it.
Basically my project have only 3 pages at all.


Pages:
1. Signin page
2. Home page
3. Dashboard page

https://github.com/KalilovM/website_front

Requirements: No auth related libraries such as NextAuth or clerk ant etc. No axios or any fetch related libraries except react-query

I'll appriciate any feedback or advice
Answered by American black bear
if i were you i would use nextauth, but since im not you i would connect a database first of all
View full answer

46 Replies

@American black bear why dont you wanna use auth services?
I'd like to understand it. I think that If I'll complete it by myself it'll give me more oportunity to learn than to use libraries and compelete projects without knowing how does the library works under the hood
@American black bear also it is much easier to just use nextjs for everything, not just frontend
Yeah, I'd agree with that. But I'm also interested in backend so I'd like to learn python and rust for myself
@OxyGen Yeah, I'd agree with that. But I'm also interested in backend so I'd like to learn python and rust for myself
American black bear
you are trying to do a lot of things at the same time, trust me just focus on one
do you know react?
@American black bear you can read nextauth docs to understand how it works, its not that big of a deal
Yeah, but nobody knows how their code works. And anyway if I think about the future any big project are using their own custom authentication system
@American black bear you are trying to do a lot of things at the same time, trust me just focus on one
Yeah, but for know I'm learning frontend so yeah
@American black bear do you know react?
React yes, but nextjs not really, just switched 2 month ago
@OxyGen Yeah, but nobody knows how their code works. And anyway if I think about the future any big project are using their own custom authentication system
American black bear
thats not true tho, everybody knows how their code is working otherwise it would not be working
@American black bear thats not true tho, everybody knows how their code is working otherwise it would not be working
I'd say that everybody knows how to use the library but how the library does work under the hood just ones' maybe know
American black bear
also big projects do not use custom login systems most of the time, why would they
basically all of them rely on major libraries like nextauth
Because they have already their ecosystem maybe 😄
@OxyGen Because they have already their ecosystem maybe 😄
American black bear
well are you a big project?
i mean are you working in a big project?
I'd like to build one project for 3 years
untill completion of my study
that's my plan
American black bear
yeah but right now the project is not big, you need to focus on the actual features of yout project not on the auth
So I'll go as deep as possible not to use libraries too much
American black bear
in the future you can use custom auth but right now just use nextauth and get the project rolling
i suppose it is a saas right?
Yeah, but I'm not really sure about it. I'm doing it only for myself
American black bear
if i were you i would use nextauth, but since im not you i would connect a database first of all
Answer
American black bear
then i would make an api endpoint for login which checks if the user is in the database and if he is, he can proceed
if hes not just give out an error and a destructive toast
or redirect to register page
So your suggestion is to use nextauth and build other features. Complete authentication part at the end?
American black bear
yes, i suppose you dont have any real features still right?
American black bear
then work on those, since you dont planning on deploying your project soon just work on the features then come back to the auth as soon as you are done
if you are planning to deploy your app as a saas i recommend to use whop, they are an online marketplace for software. you can use their api with nextauth to check if an user paid for your app or not and it is very handy
Thanks man
@OxyGen Thanks man
American black bear
no problem
also dont use python for backend trust me i almost made the same mistake cause i knew python more than react
and i though it would be better
nextjs fullstack is better
Oh, I see, and also last question
would you recommend to use nextjs?
@OxyGen would you recommend to use nextjs?
American black bear
yes 100%
very good for seo and very easy to use
use app router i recommend it
Thank man
American black bear
no problem