Next.js Discord

Discord Forum

Custom auth system

Answered
OxyGen posted this in #help-forum
Open in Discord
Avatar
OxyGenOP
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

Avatar
American black bear
why dont you wanna use auth services?
also it is much easier to just use nextjs for everything, not just frontend
Avatar
OxyGenOP
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
Avatar
American black bear
you can read nextauth docs to understand how it works, its not that big of a deal
Avatar
OxyGenOP
Yeah, I'd agree with that. But I'm also interested in backend so I'd like to learn python and rust for myself
Avatar
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?
Avatar
OxyGenOP
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
Yeah, but for know I'm learning frontend so yeah
React yes, but nextjs not really, just switched 2 month ago
Avatar
American black bear
thats not true tho, everybody knows how their code is working otherwise it would not be working
Avatar
OxyGenOP
I'd say that everybody knows how to use the library but how the library does work under the hood just ones' maybe know
Avatar
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
Avatar
OxyGenOP
Because they have already their ecosystem maybe šŸ˜„
Avatar
American black bear
well are you a big project?
i mean are you working in a big project?
Avatar
OxyGenOP
I'd like to build one project for 3 years
untill completion of my study
that's my plan
Avatar
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
Avatar
OxyGenOP
So I'll go as deep as possible not to use libraries too much
Avatar
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?
Avatar
OxyGenOP
Yeah, but I'm not really sure about it. I'm doing it only for myself
Avatar
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
Avatar
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
Avatar
OxyGenOP
So your suggestion is to use nextauth and build other features. Complete authentication part at the end?
Avatar
American black bear
yes, i suppose you dont have any real features still right?
Avatar
OxyGenOP
Yes
Avatar
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
Avatar
OxyGenOP
Thanks man
Avatar
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
Avatar
OxyGenOP
Oh, I see, and also last question
would you recommend to use nextjs?
Avatar
American black bear
yes 100%
very good for seo and very easy to use
use app router i recommend it
Avatar
OxyGenOP
Thank man
Avatar
American black bear
no problem