This is a simple todo application with JWT authentication built using NextJs and Django.
This can be a reference repo to setup your simple authentication system in NextJs with any backend system.
You can see how to use protected route. For example todo page only accessible when you are authenticated.
If you are not logged-in, and you go to todo page, it will redirect you to the login page.
Similarly if you are already authenticated, and go to login/register router you will be redirected to todo page.
simplescreenrecorder-2024-02-28_09.47.34.mp4
- Go to /backend folder.
- rename .env.example to .env and change any value if you want.
- Create a virtual env and install
requirements.txt
packages. - Then run
python manage.py migrate
andpython manage.py runserver
- Open second terminal and go to /frontend folder.
- rename .env.example to .env and change any value if you want.
- Run
npm i
to install dependencies - Run
npm run dev
to run the development server. - Open
localhost:3000
to see the web app.