A lightweight, high-performance blog built with Next.js 15 and Payload CMS 3.0. This application is designed for a curated reading experience where access is managed strictly by the administrator.
This blog implements a Magic Link authentication system. Users don't need passwords—they receive a secure login link via email.
How it works:
- User visits the login page and enters their email
- System sends an email with a magic link (valid for a limited time)
- User clicks the link and is automatically logged in
- Session is created via secure cookie
Key Features:
- ✅ No passwords to remember or manage
- ✅ Secure token-based authentication
- ✅ Time-limited login links
- ✅ Admin-controlled user access (no public registration)
- No Public Registration: Users cannot sign themselves up. An admin must create accounts in the Payload dashboard.
- Email-Based Access: Only users with registered email addresses can request a login link.
- Admin Only: Only administrators can create, edit, or delete user accounts.
Password-based authentication can be enabled via environment variable for demo and testing purposes.
When enabled:
- Users log in with email and password instead of magic links
- Passwords are managed in the Payload dashboard
- Useful for demos, testing, and future implementations
Create a .env file in the root directory and populate it with the following variables.
| Variable | Description |
|---|---|
PAYLOAD_SECRET |
Secret string used to secure cookies and JWTs. |
ADMIN_EMAIL |
The email address of the primary administrator. |
NEXT_PUBLIC_AUTH_METHOD |
Authentication method: magic-link (default, secure) or password (demo/testing) |
| Variable | Description | Example |
|---|---|---|
DB_HOST |
Database host | localhost |
DB_PORT |
Port the database is listening on. | 5432 |
DB_USER |
Database username. | postgres |
DB_PASS |
Database password. | postgres |
DB_NAME |
The name of the database. | postgres |
| Variable | Description | Example |
|---|---|---|
WEBSITE_TITLE |
The display name of the blog. | Example.cz |
WEBSITE_URL |
The full base URL of the application. | http://localhost:3000 |
| Variable | Description | Example |
|---|---|---|
SMTP_HOST |
SMTP server hostname. | smtp.example.com |
SMTP_PORT |
SMTP server port. | 587 |
SMTP_USER |
The username for the SMTP account. | info@example.com |
SMTP_PASS |
The password for the SMTP account. | your_password |
SMTP_FROM_ADDRESS |
The email address used as the sender. | info@example.com |
SMTP_FROM_NAME |
The name displayed in the "From" field. | Example.cz |
The database runs in a Docker container. To start only the database:
docker compose up db -d