Skip to content
This repository was archived by the owner on Jul 18, 2026. It is now read-only.
agentlab-inPublic archive

Repository files navigation

Private Agent Lab

Private authenticated area for private.agentlab.in.

Milestone 1 is intentionally small:

  • /signup
  • /login
  • /logout
  • /dashboard
  • email/password auth
  • DB-backed sessions
  • HTTP-only session cookie
  • protected dashboard showing You're logged in as "Username"

Stack

  • Next.js App Router
  • TypeScript
  • Drizzle ORM
  • PostgreSQL
  • Argon2id password hashing via @node-rs/argon2

Local Setup

Create .env.local:

DATABASE_URL="postgres://USER:PASSWORD@HOST:5432/DATABASE?sslmode=require"

Run migrations:

npm run db:migrate

Start the app:

npm run dev

Open http://localhost:3000.

Auth Notes

Passwords are hashed with argon2id and plaintext passwords are never stored.

Sessions use a random 32-byte token. The browser receives only the raw token in an HTTP-only cookie; the database stores a SHA-256 hash of the token with an expiry timestamp.

Login creates a fresh session and deletes any older sessions for that user. Logout deletes the current session and clears the cookie.

The cookie is httpOnly, sameSite=lax, scoped to /, and secure in production. Server Actions are used for the auth form POSTs, which gives Next.js same-origin Server Action protections for the normal form submission path. If this app later adds API route mutations, add explicit CSRF tokens or another CSRF strategy for those routes.

Login and signup have a basic DB-backed rate limit keyed by action, normalized email, and request IP.

Deployment

Vercel needs DATABASE_URL set in the Production, Preview, and Development environments before the app can complete auth flows.

The CNAME file declares:

private.agentlab.in

DNS should point the subdomain at Vercel:

private CNAME cname.vercel-dns.com

Getting Started

First, run the development server:

npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev

Open http://localhost:3000 with your browser to see the result.

You can start editing the page by modifying app/page.tsx. The page auto-updates as you edit the file.

This project uses next/font to automatically optimize and load Geist, a new font family for Vercel.

Learn More

To learn more about Next.js, take a look at the following resources:

You can check out the Next.js GitHub repository - your feedback and contributions are welcome!

Deploy on Vercel

The easiest way to deploy your Next.js app is to use the Vercel Platform from the creators of Next.js.

Check out our Next.js deployment documentation for more details.

Releases

Packages

Contributors

Languages