Skip to content

the website to keep links, It's has to load webpage to show links. and it can custom seo.

License

Notifications You must be signed in to change notification settings

Arikato111/load-link-nextjs

Repository files navigation

nextjs tailwindcss Typescript prisma Mongodb

load link nextjs

Github License GitHub Issues GitHub Pull Requests GitHub Contributors GitHub Last Commit

Get started

  • this project is developing now.
  • clone this repository.
  • npm install or pnpm install
  • create .env.local like .env.example
  • enter mongodb connect in .env.local
  • if prisma can't db push you can try to change .env.local to .env
  • npx prisma generate to setup prisma
  • npm run dev or pnpm dev to run server in dev mode

Inside it

  • Nextjs with Typescript
  • Tailwindcss [css framework]
  • prisma and mongodb [Database]
  • firebase
  • axios
  • antd
  • cookie
  • js-cookie
  • jsonwebtoken

TODOs

  • create schema

  • authentication with jwt

  • users

    • register
    • login
    • update profile with firebase
    • delete account
  • links

    • read link
      • metatage og seo
    • add link
    • edit link info
    • delete link

For developers

Plan

  • rewrite authentication algorithm
    • client send request to api with only access token.
    • check access token when first load website.

authentication

  • create token with jwt

    • access token '/api/auth/login'
    • refresh token '/api/auth/refresh'
  • check auth on server side on headers with authorization

  • check auth on client side by js-cookie

  • after login token will response to client and setCookie with js-cookie

Cookies.set("access_token", "theToken", {
  path: "/",
  expires: new Date(Date.now() * hours(1)),
});
  • when create cookie it need to input expires with Date()
  • when want to add time use hours(1) or minutes(10) and more at ./components/lib/aboutTime.ts

Request api

  • when sending api request it will check access token.
  • if access token has expired, client must sending api request to '/api/auth/refresh'
  • to get new access token and resend api request.

Cookies

  • get cookies on server side use req.headers.authorization
  • get cookies on client side use js-cookie

Api

  • api is in backend folder with expressjs

Status code

  • statusCode response description here

Problem

  • [fixed] express can't handle data from req.body.
  • It can not use express.json() and app dont need to use express.json();

About

the website to keep links, It's has to load webpage to show links. and it can custom seo.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages