removed dev SMTP
This commit is contained in:
@@ -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
@@ -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
|
||||||
@@ -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
|
||||||
|
|||||||
@@ -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:
|
||||||
|
|||||||
@@ -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)$).*)',
|
||||||
|
],
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user