this is NEPR (Nuxtjs-ExpressJs-Postgres-Redis) Stack web development
- Nuxtjs as frontend
- ExpressJs as backend
- Postgres as database
- Redis as cache token session
The architecture has wrapped in docker-compose, first thing first you need to install docker
. To run this file type this :
docker-compose up
locate: localhost:3000
/login
: POST, params :[email, password]
/register
: POST, params:[username, email, password]
/users/me
: GET To get users data/logout
: GET
locate: localhost:8000
/
: Home/login
: Login/register
: register/logout
: logout/profile
: Users profile's page to edit profile/private
: Private page that only for logged in user
there is no default user, for the first time use this needs to create/register new user.
- User register from frontend (NuxtJs) and calls API to backend (ExpressJs).
- Backend create new user and save to Postgres
- User login and also calls API to backend
- Backend create new token and send it to front-end as a token that use everytime request to backend
- When creating token, backend also save that token to redis cache
- When user login for next time, backend will check to redis if there is a token saved in there, if not will create new token, if yes will return that token
- When user are doing request, the token needs to validate with a few steps
- Is the token valid ?, if not, return with error
- Is token available in redis ?, if not, return error
- Is token in redis (same with request's token) is not expired ?, if not, return error
- if all validation passed, the request will continue to process, if not request will rejected.
- When users logout, backend just delete the token in redis. so, even if there are attacker use the token (not expired) but not available in redis, cannot access the account.
- Build an authentication API with oAuth Facebook and Google functionality.
- Also include normal email and password authentication.
- User should be able to
- log in, register
- update their password,
- forgot password and
- updates their information.
- Use the following tools; nodejs, expressjs, typescript, postgresql, redis and docker
- Database table; user
- Redis: store session/refresh token
- Ready to deploy using Docker
- Need to write the code in Typescript Frontend
- Create home, login, signup and profile page.
- Tools: NuxtJS
- Profile page must be protected and can only be access when login
- Clean design and you can use any UI library