Skip to content
abdulrdeveloperPublic

About

Free AI tutor for students. Chat instantly with 6 AI models - no login needed. Sign up to save conversations and unlock all models for better experience.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

13 stars

Watchers

0 watching

Forks

Repository files navigation

Klar

An AI tutor that gets straight to the point.

Klar is a free, open-source AI tutor for students. Ask a question and start chatting right away, or create an account to keep your conversations. It answers in English, Roman Urdu or Urdu script.

klar.abdulrdeveloper.me

License: MIT Next.js 16 React 19 TypeScript PostgreSQL PRs welcome


What is Klar?

Klar is built for school prep, coding help and quick explanations. It is told to skip filler, guide you through homework before handing over answers, and reply in the language you write in, with technical terms kept in English.

  • Guests can open /chat and start asking questions without signing up.
  • Account holders get the full dashboard with saved, per-conversation history.

What you can do

Pick how Klar answers

Mode Best for
Flash The fastest answer, in 1 to 3 sentences
Speed One-line answers or raw snippets
Smart Complex school topics, with the "why" behind the answer
Thinking Step-by-step working for math and logic
Coder Debugging, reviews and code fixes (Python by default)
Deep Long, thorough answers that cover edge cases

Each mode routes to Mistral first and falls back to Groq if the first provider is unavailable.

Keep your conversations

  • Sign up with email and password, then verify your email to log in.
  • Conversations and messages are saved in PostgreSQL.
  • Forgot your password? Reset it with an emailed link.

Safe by default

  • The dashboard is protected by middleware that checks a signed JWT session cookie.
  • Passwords are hashed with bcrypt.
  • Upstash Redis rate limits chat, registration, login and verification or password-reset emails.
  • Email links always point to the production URL, so request headers cannot redirect them.

Run it yourself

You need

  • Node.js 20+ and pnpm
  • A PostgreSQL database (for example Neon)
  • API keys for Groq and Mistral
  • A Resend API key for verification and reset emails
  • An Upstash Redis database for rate limiting

Quick start

git clone https://github.com/abdulrdeveloper/klar.git
cd klar
pnpm install
cp .env.local.example .env.local   # then fill in the values
pnpm drizzle-kit migrate           # create the database tables
pnpm dev

Open http://localhost:3000.

Configuration

Variable What it is
DATABASE_URL PostgreSQL connection string
JWT_SECRET Long random string used to sign session cookies
GROQ_API_KEY Groq API key (fallback provider)
MISTRAL_API_KEY Mistral API key (primary provider)
RESEND_API_KEY Resend API key for transactional email
UPSTASH_REDIS_REST_URL Upstash Redis REST URL
UPSTASH_REDIS_REST_TOKEN Upstash Redis REST token

All variables are required. The app will not start without JWT_SECRET and the Upstash variables.

The public URL used in email links is set in src/lib/request-security.ts. Change it there if you host your own copy.

Never commit .env.local.

Tech stack

Area Tools
Framework Next.js 16 (App Router), React 19, TypeScript
UI Tailwind CSS 4, Lucide icons, React Markdown
AI Vercel AI SDK with Mistral and Groq
Data PostgreSQL (Neon) with Drizzle ORM
Auth JWT session cookies (jose), bcrypt, Zod validation
Email Resend
Rate limiting Upstash Redis

Useful commands

Command What it does
pnpm dev Start the dev server
pnpm build / pnpm start Production build and server
pnpm lint ESLint
pnpm drizzle-kit generate Create a migration after changing the schema
pnpm drizzle-kit migrate Apply migrations to the database

Project layout

src/app/              Pages and API routes (Next.js App Router)
src/app/chat/         Guest chat
src/app/dashboard/    Logged-in chat with saved history
src/app/auth/         Register, verify, login, forgot and reset password
src/app/api/          Auth, chat, me and conversation routes
src/app/components/   Landing page sections and the markdown renderer
src/lib/              Auth, validation, rate limiting and chat runtime
src/db/               Database connection and Drizzle schema
drizzle/              SQL migrations
public/               Logo

Contributing

Contributions are welcome, from typo fixes to new features. Please read CONTRIBUTING.md for setup, workflow and the pull request checklist, and follow our Code of Conduct.

Security

Found a vulnerability? Please report it privately as described in SECURITY.md instead of opening a public issue.

License

Released under the MIT License. Copyright (c) 2026 abdulrdeveloper.

About

Free AI tutor for students. Chat instantly with 6 AI models - no login needed. Sign up to save conversations and unlock all models for better experience.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

13 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages