How to Add a Gemini API Key to Next.js and Vercel
Step by step: a Gemini key from Google AI Studio in .env.local, a server-only helper, a Next.js route handler, Vercel environment variables and a leak test.
// notes/
Coding tips and build notes by Mahir Faysal, a student web developer in Bangladesh: tested Python, HTML, CSS, JavaScript and PHP tutorials, plus notes from my Next.js and Gemini projects. Sample posts are marked and drafts stay in the admin area.
Step by step: a Gemini key from Google AI Studio in .env.local, a server-only helper, a Next.js route handler, Vercel environment variables and a leak test.
A simple PHP math captcha in two functions: store the answer in the session, check it once with ctype_digit and ===, then add a honeypot and time check.
How I send contact form emails with PHP's built-in mail(): a fixed recipient, Reply-To, header injection checks, a UTF-8 subject and a fake sendmail.
How to validate and sanitize PHP form input: trim, filter_var, mb_strlen and allow-lists, then escape output with htmlspecialchars, add CSRF and redirect.
Learn PHP PDO prepared statements with MySQL: connect safely, insert, select, update and delete, plus LIKE, IN lists, LIMIT, transactions and SQL injection.
How I built Quizwright so the Gemini API key never reaches the browser: one Next.js server route, a server-only import, Zod checks and a single retry.
// filter
This view is only the category, tag, or search you asked for. Sample warnings still apply on any article that carries them. Drafts are still hidden. The full list is the learning notes page, which also explains how a note is written and why some posts are marked Sample.