Which is proper way for api authentication for nextJs api? taking more time to give response

Hello
im getting session and checking in api.
here screenshot attached

but just that api taking 2-3 seconds to give response
which is the proper way for api authentication in nextJs?
im using secondary database redis for session store.
this api saves 3 key values to postgress using drizzle orm.

whats the major improvements i need to do here?
is it possible to do create server action and calling it from client component?
i tried some error came.
image.png
image.png
Was this page helpful?