removed dev SMTP

This commit is contained in:
Rolf
2026-03-19 09:09:55 +01:00
parent 988989e625
commit 1538744959
5 changed files with 97 additions and 21 deletions
+26
View File
@@ -0,0 +1,26 @@
# ============================================================
# MulliganMates — Environment Variables
# Copy to .env and fill in all values before starting.
# ============================================================
# ── Application ─────────────────────────────────────────────
APP_DOMAIN=golf.example.com
SITE_URL=https://golf.example.com
ADMIN_EMAIL=admin@example.com
# ── Database ─────────────────────────────────────────────────
# Generate: node -e "console.log(require('crypto').randomBytes(24).toString('hex'))"
POSTGRES_PASSWORD=your-strong-postgres-password
POSTGRES_DB=postgres
# ── Auth (better-auth) ───────────────────────────────────────
# Generate: node -e "console.log(require('crypto').randomBytes(32).toString('hex'))"
BETTER_AUTH_SECRET=your-better-auth-secret-at-least-32-chars
# ── Email ────────────────────────────────────────────────────
# Set to your SMTP provider (e.g. smtp.resend.com, smtp.mailgun.org)
SMTP_HOST=smtp.example.com
SMTP_PORT=587
SMTP_USER=your-smtp-user
SMTP_PASS=your-smtp-password
SMTP_SENDER_NAME=MulliganMates
+43
View File
@@ -0,0 +1,43 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# dependencies
/node_modules
/.pnp
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/versions
# testing
/coverage
# next.js
/.next/
/out/
# production
/build
# misc
.DS_Store
*.pem
# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*
# env files
.env
.env.local
.env.*.local
# docker
volumes/
# typescript
*.tsbuildinfo
next-env.d.ts
+3 -7
View File
@@ -11,10 +11,7 @@ MulliganMates is a social golf score tracking PWA. Multiple players in a group t
All commands run inside Docker (Node.js is not installed on the host): All commands run inside Docker (Node.js is not installed on the host):
```bash ```bash
# Development (with Mailpit for email) # Start
docker compose --profile dev up
# Production
docker compose up -d docker compose up -d
# Install a new npm package # Install a new npm package
@@ -86,9 +83,8 @@ See `lib/handicap.ts` for `strokesReceived()`, `netStrokes()`, `formatVsPar()`,
## Infrastructure ## Infrastructure
- **Docker Compose** — `app` + `db` (postgres:17-alpine) + `mailpit` (dev profile) - **Docker Compose** — `app` + `db` (postgres:17-alpine)
- **Traefik** — external reverse proxy; services expose via labels only - **Traefik** — external reverse proxy; services expose via labels only
- **Email dev:** Mailpit (`docker compose --profile dev up`) - **Email:** Set `SMTP_HOST`, `SMTP_PORT`, `SMTP_USER`, `SMTP_PASS` in `.env`
- **Email prod:** Set `SMTP_HOST`, `SMTP_USER`, `SMTP_PASS` in `.env`
- Copy `.env.example``.env` before first run - Copy `.env.example``.env` before first run
- `BETTER_AUTH_URL` must equal the app's public URL for magic links to work - `BETTER_AUTH_URL` must equal the app's public URL for magic links to work
-14
View File
@@ -49,20 +49,6 @@ services:
networks: networks:
- internal - internal
# ── Email: Python SMTP debug server (dev only) ────────────
# Accepts all mail and prints it to stdout (docker compose logs smtp)
smtp:
build:
context: .
dockerfile_inline: |
FROM python:3-alpine
RUN pip install aiosmtpd --quiet
ENV PYTHONUNBUFFERED=1
CMD ["python", "-m", "aiosmtpd", "-n", "-l", "0.0.0.0:1025"]
restart: unless-stopped
profiles: ["dev"]
networks:
- internal
volumes: volumes:
db_data: db_data:
+25
View File
@@ -0,0 +1,25 @@
import { NextResponse, type NextRequest } from 'next/server'
const PUBLIC_PATHS = ['/login', '/api/auth']
export function middleware(request: NextRequest) {
const { pathname } = request.nextUrl
if (PUBLIC_PATHS.some((p) => pathname.startsWith(p))) {
return NextResponse.next()
}
const session = request.cookies.get('better-auth.session_token')
if (!session) {
return NextResponse.redirect(new URL('/login', request.url))
}
return NextResponse.next()
}
export const config = {
matcher: [
'/((?!_next/static|_next/image|favicon.ico|icons|.*\\.(?:svg|png|jpg|jpeg|gif|webp)$).*)',
],
}