📖 Step 6: Development#445 / 498
Cookie / Session
Cookie / Session
📖One-line summary
A way of keeping state using cookies, which store small data in the browser, and sessions, which let the server remember login state.
✨Example
// 쿠키/세션 (Cookie / Session)
브라우저에 작은 데이터를 저장하는 쿠키와, 서버가 로그인 상태를 기억하는 세션을 이용한 상태 유지 방식
> ready_
⚡Vibe coding prompt examples
>_
Write Next.js code that stores the session token in an httpOnly, secure, sameSite=lax cookie after login and checks it in middleware.
>_
Compare the security of storing login tokens in localStorage vs. an httpOnly cookie.
>_
Explain when to use cookies, sessions, and JWTs using a bank-counter analogy.
Try these prompts in your AI coding assistant!