chore: bootstrap portal application

This commit is contained in:
Leon Tonhäuser committed 2026-08-09 20:14:31 +02:00
1 parent 90e53e7d56
commit 763098b129
20 files changed
+5703 -1

No files matched your search

+22
View File
@@ -0,0 +1,22 @@
# Portal database (separate from Immich)
DATABASE_URL=postgres://portal:change-me@postgres:5432/portal
# Better Auth
BETTER_AUTH_SECRET=replace-with-a-long-random-secret
BETTER_AUTH_URL=http://localhost:3000
# Internal Immich API access; never expose these values to browsers
IMMICH_BASE_URL=http://immich-server:2283
IMMICH_API_KEY=replace-with-a-restricted-immich-api-key
# SMTP
SMTP_HOST=smtp.example.com
SMTP_PORT=587
SMTP_USER=portal@example.com
SMTP_PASSWORD=replace-with-an-smtp-password
SMTP_FROM=portal@example.com
# Legal pages managed outside the application
LEGAL_IMPRINT_URL=https://example.com/impressum
LEGAL_PRIVACY_URL=https://example.com/datenschutz
LEGAL_TERMS_URL=https://example.com/nutzungsbedingungen
+1
View File
@@ -8,3 +8,4 @@ node_modules/
.next/
dist/
coverage/
*.tsbuildinfo
@@ -161,7 +161,7 @@ Create `package.json` with these scripts and engine policy; install the named de
```json
{
"private": true,
"packageManager": "pnpm@10",
"packageManager": "pnpm@10.34.5",
"engines": { "node": ">=24 <25" },
"scripts": {
"dev": "next dev",
+5
View File
@@ -0,0 +1,5 @@
import nextVitals from "eslint-config-next/core-web-vitals";
const eslintConfig = [...nextVitals];
export default eslintConfig;
+7
View File
@@ -0,0 +1,7 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />
import "./.next/types/routes.d.ts";
import "./.next/types/root-params.d.ts";
// NOTE: This file should not be edited
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
+8
View File
@@ -0,0 +1,8 @@
import type { NextConfig } from "next";
const nextConfig: NextConfig = {
output: "standalone",
poweredByHeader: false,
};
export default nextConfig;
+40
View File
@@ -0,0 +1,40 @@
{
"private": true,
"type": "module",
"packageManager": "pnpm@10.34.5",
"engines": {
"node": ">=24 <25"
},
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "eslint .",
"typecheck": "tsc --noEmit",
"test": "vitest run",
"test:watch": "vitest",
"test:e2e": "playwright test"
},
"dependencies": {
"next": "^16.3.0",
"react": "^19.2.8",
"react-dom": "^19.2.8",
"server-only": "^0.0.1",
"zod": "^4.4.3"
},
"devDependencies": {
"@tailwindcss/postcss": "^4.3.3",
"@testing-library/jest-dom": "^7.0.0",
"@testing-library/react": "^16.3.2",
"@types/node": "^24.13.3",
"@types/react": "^19.2.18",
"@types/react-dom": "^19.2.4",
"@vitejs/plugin-react": "^6.0.5",
"eslint": "^9.39.5",
"eslint-config-next": "^16.3.0",
"jsdom": "^30.0.1",
"tailwindcss": "^4.3.3",
"typescript": "^5.9.3",
"vitest": "^4.1.10"
}
}
+5299
View File
File diff suppressed because it is too large. Load diff
+2
View File
@@ -0,0 +1,2 @@
allowBuilds:
unrs-resolver: true
+7
View File
@@ -0,0 +1,7 @@
const postcssConfig = {
plugins: {
"@tailwindcss/postcss": {},
},
};
export default postcssConfig;
+9
View File
@@ -0,0 +1,9 @@
import { expect, test } from "vitest";
import { GET } from "./route";
test("returns a process liveness response", async () => {
const response = await GET();
expect(response.status).toBe(200);
await expect(response.json()).resolves.toEqual({ status: "ok" });
});
+3
View File
@@ -0,0 +1,3 @@
export async function GET(): Promise<Response> {
return Response.json({ status: "ok" });
}
+140
View File
@@ -0,0 +1,140 @@
@import "tailwindcss";
:root {
--paper: #ffffff;
--ink: #0a0a0a;
--muted: #5f5f5f;
--line: #d8d8d8;
--soft: #f3f3f3;
color-scheme: light;
}
* {
box-sizing: border-box;
}
html {
background: var(--paper);
}
body {
min-height: 100vh;
margin: 0;
background: var(--paper);
color: var(--ink);
font-family: Inter, "Helvetica Neue", Arial, sans-serif;
font-synthesis: none;
}
a {
color: inherit;
}
:focus-visible {
outline: 3px solid var(--ink);
outline-offset: 4px;
}
.landing {
display: grid;
min-height: 100vh;
grid-template-rows: auto 1fr auto;
padding: clamp(1.25rem, 3vw, 2.75rem);
}
.masthead {
display: flex;
align-items: baseline;
justify-content: space-between;
gap: 2rem;
padding-bottom: 1rem;
border-bottom: 1px solid var(--line);
}
.wordmark {
font-size: 0.8125rem;
font-weight: 700;
letter-spacing: -0.01em;
text-transform: uppercase;
}
.section-label,
.eyebrow,
.landing-footer {
color: var(--muted);
font-size: 0.75rem;
letter-spacing: 0.09em;
text-transform: uppercase;
}
.intro {
display: grid;
align-content: center;
max-width: 70rem;
padding-block: clamp(5rem, 14vh, 10rem);
}
.eyebrow {
margin: 0 0 1.5rem;
}
.intro h1 {
max-width: 12ch;
margin: 0;
font-size: clamp(3rem, 9vw, 8.5rem);
font-weight: 600;
letter-spacing: -0.065em;
line-height: 0.88;
}
.lede {
max-width: 37rem;
margin: clamp(2rem, 5vw, 4rem) 0 0;
font-size: clamp(1rem, 1.6vw, 1.25rem);
line-height: 1.55;
}
.primary-action {
width: fit-content;
margin-top: 2.25rem;
padding: 0.9rem 1.25rem;
border: 1px solid var(--ink);
background: var(--ink);
color: var(--paper);
font-size: 0.875rem;
font-weight: 650;
text-decoration: none;
transition: background-color 140ms ease, color 140ms ease;
}
.primary-action:hover {
background: var(--paper);
color: var(--ink);
}
.landing-footer {
padding-top: 1rem;
border-top: 1px solid var(--line);
}
.landing-footer p {
margin: 0;
}
@media (max-width: 40rem) {
.masthead {
align-items: flex-start;
flex-direction: column;
gap: 0.5rem;
}
.intro h1 {
letter-spacing: -0.055em;
}
}
@media (prefers-reduced-motion: reduce) {
.primary-action {
transition: none;
}
}
+16
View File
@@ -0,0 +1,16 @@
import type { Metadata } from "next";
import type { ReactNode } from "react";
import "./globals.css";
export const metadata: Metadata = {
title: "Redaktionsportal | Leon Tonhäuser",
description: "Ausgewählte Pressefotos sicher finden und nutzen.",
};
export default function RootLayout({ children }: Readonly<{ children: ReactNode }>) {
return (
<html lang="de">
<body>{children}</body>
</html>
);
}
+26
View File
@@ -0,0 +1,26 @@
export default function HomePage() {
return (
<main className="landing">
<header className="masthead">
<span className="wordmark">Leon Tonhäuser</span>
<span className="section-label">Redaktionsportal</span>
</header>
<section className="intro" aria-labelledby="intro-title">
<p className="eyebrow">Pressefotografie</p>
<h1 id="intro-title">Bilder für Ihre Redaktion.</h1>
<p className="lede">
Freigegebene Fotoalben durchsuchen, Nutzungen dokumentieren und
Originaldateien herunterladen.
</p>
<a className="primary-action" href="/anmelden">
Zum Portal
</a>
</section>
<footer className="landing-footer">
<p>Der geschützte Zugang wird im nächsten Schritt eingerichtet.</p>
</footer>
</main>
);
}
+10
View File
@@ -0,0 +1,10 @@
import { describe, expect, test } from "vitest";
import { parseServerEnv } from "./env";
describe("parseServerEnv", () => {
test("rejects a missing Immich API key", () => {
expect(() => parseServerEnv({ DATABASE_URL: "postgres://db/app" })).toThrow(
/IMMICH_API_KEY/,
);
});
});
+33
View File
@@ -0,0 +1,33 @@
import "server-only";
import { z } from "zod";
const serverEnvSchema = z.object({
DATABASE_URL: z.url(),
BETTER_AUTH_SECRET: z.string().min(32),
BETTER_AUTH_URL: z.url(),
IMMICH_BASE_URL: z.url(),
IMMICH_API_KEY: z.string().min(1),
SMTP_HOST: z.string().min(1),
SMTP_PORT: z.coerce.number().int().min(1).max(65_535),
SMTP_USER: z.string().min(1),
SMTP_PASSWORD: z.string().min(1),
SMTP_FROM: z.string().min(1),
LEGAL_IMPRINT_URL: z.url(),
LEGAL_PRIVACY_URL: z.url(),
LEGAL_TERMS_URL: z.url(),
});
export type ServerEnv = z.infer<typeof serverEnvSchema>;
export function parseServerEnv(input: NodeJS.ProcessEnv): ServerEnv;
export function parseServerEnv(
input: Record<string, string | undefined>,
): ServerEnv;
export function parseServerEnv(
input: NodeJS.ProcessEnv | Record<string, string | undefined>,
): ServerEnv {
return serverEnvSchema.parse(input);
}
export const env = parseServerEnv(process.env);
+1
View File
@@ -0,0 +1 @@
export {};
+41
View File
@@ -0,0 +1,41 @@
{
"compilerOptions": {
"target": "ES2022",
"lib": [
"dom",
"dom.iterable",
"es2022"
],
"allowJs": false,
"skipLibCheck": true,
"strict": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "bundler",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "react-jsx",
"incremental": true,
"plugins": [
{
"name": "next"
}
],
"paths": {
"@/*": [
"./src/*"
]
}
},
"include": [
"next-env.d.ts",
".next/types/**/*.ts",
"**/*.ts",
"**/*.tsx",
".next/dev/types/**/*.ts"
],
"exclude": [
"node_modules"
]
}
+32
View File
@@ -0,0 +1,32 @@
import path from "node:path";
import { fileURLToPath } from "node:url";
import { defineConfig } from "vitest/config";
const rootDirectory = path.dirname(fileURLToPath(import.meta.url));
export default defineConfig({
resolve: {
alias: {
"server-only": path.join(rootDirectory, "src/test/server-only.ts"),
},
},
test: {
environment: "node",
env: {
DATABASE_URL: "postgres://db/portal",
BETTER_AUTH_SECRET: "test-secret-at-least-thirty-two-characters",
BETTER_AUTH_URL: "http://localhost:3000",
IMMICH_BASE_URL: "http://immich:2283",
IMMICH_API_KEY: "test-immich-key",
SMTP_HOST: "smtp.example.com",
SMTP_PORT: "587",
SMTP_USER: "portal@example.com",
SMTP_PASSWORD: "test-smtp-password",
SMTP_FROM: "portal@example.com",
LEGAL_IMPRINT_URL: "https://example.com/impressum",
LEGAL_PRIVACY_URL: "https://example.com/datenschutz",
LEGAL_TERMS_URL: "https://example.com/nutzungsbedingungen",
},
include: ["src/**/*.test.ts", "src/**/*.test.tsx"],
},
});