A multi-user blog. People sign up, create topics, write entries inside them, save entries as drafts or publish them, and everyone's published entries show on the Community page. Admins get a Users page to edit, reset or remove users.
Built with Next.js + TypeScript, a Neon Postgres database, and hosted on Vercel. (The first version was PHP + MySQL; that is still in the git history.)
| Part | Where |
|---|---|
| Pages | app/ (one folder per page) |
| Backend (saving, deleting, login) | app/actions/ — server actions that run on Vercel |
| Database code | lib/db.ts, lib/data.ts |
| Login cookie | lib/session.ts, lib/auth.ts |
| Database tables | db/schema.sql |
| Old stylesheet (kept so the site looks the same) | app/style.css |
- Make a free Neon database at neon.tech, or connect Neon to the
project in Vercel (Storage tab → Neon) and copy its
DATABASE_URL. - Copy
.env.exampleto.env.localand fill inDATABASE_URLandSESSION_SECRET(make a secret withopenssl rand -base64 32). - Install and create the tables:
npm install npm run db:setup
- Start it:
npm run dev, then open http://localhost:3000
Sign up on the site first, then run:
npm run make-admin -- you@example.com- In the Vercel project, connect Neon (Storage → Neon). This adds
DATABASE_URL. - Add
SESSION_SECRETunder Settings → Environment Variables. - Run
npm run db:setuponce on your computer with the sameDATABASE_URLto create the tables. - Deploy.