Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e6ae9b9c1d | ||
|
|
28b8d27be7 | ||
|
|
d2e2ef9ece | ||
|
|
fdd5cd4573 | ||
|
|
9c7b3e69ad | ||
|
|
5482616f3d | ||
|
|
45337cd0dc |
No files matched your search
+2
-2
@@ -12,7 +12,7 @@ metadata:
|
||||
title: Courier
|
||||
description: Transaktionsmail für deine Apps über Amazon SES.
|
||||
icon: https://git.aimighty.olares.de/aimighty/courier/raw/branch/main/icon.png
|
||||
version: 26.11.6
|
||||
version: 26.11.13
|
||||
categories:
|
||||
- Applications
|
||||
|
||||
@@ -106,7 +106,7 @@ envs:
|
||||
default: "1000"
|
||||
|
||||
spec:
|
||||
versionName: '26.11.6'
|
||||
versionName: '26.11.13'
|
||||
fullDescription: |
|
||||
**Courier** ist ein kleiner Versanddienst für transaktionale E-Mails:
|
||||
eine Resend-kompatible HTTP-API, Warteschlange, Retry, Logs und
|
||||
|
||||
+7
-1
@@ -4,6 +4,8 @@ import Link from "next/link";
|
||||
import { usePathname } from "next/navigation";
|
||||
import {
|
||||
Ban,
|
||||
BarChart3,
|
||||
Calculator,
|
||||
BookOpen,
|
||||
Globe,
|
||||
KeyRound,
|
||||
@@ -32,7 +34,11 @@ const groups: { title: string; items: Item[] }[] = [
|
||||
},
|
||||
{
|
||||
title: "Betrieb",
|
||||
items: [{ href: "/docs", label: "Dokumentation", icon: BookOpen }],
|
||||
items: [
|
||||
{ href: "/metrics", label: "Metriken", icon: BarChart3 },
|
||||
{ href: "/pricing", label: "Preise", icon: Calculator },
|
||||
{ href: "/docs", label: "Dokumentation", icon: BookOpen },
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import Link from "next/link";
|
||||
import { notFound } from "next/navigation";
|
||||
import { Globe } from "lucide-react";
|
||||
|
||||
import { CopyButton } from "@/app/copy-button";
|
||||
import { PageHeader } from "@/app/page-header";
|
||||
|
||||
+88
-78
@@ -1,5 +1,5 @@
|
||||
import Link from "next/link";
|
||||
import { Globe } from "lucide-react";
|
||||
import { ChevronRight, Globe } from "lucide-react";
|
||||
|
||||
import { EmptyState } from "@/app/empty-state";
|
||||
import { PageHeader } from "@/app/page-header";
|
||||
@@ -42,18 +42,6 @@ export default async function Domains() {
|
||||
}
|
||||
/>
|
||||
|
||||
{!ses.production ? (
|
||||
<div className="ds-alert ds-alert--warning">
|
||||
<div>
|
||||
<p className="ds-alert__title">SES ist im Sandbox-Modus</p>
|
||||
<p className="ds-alert__text">
|
||||
{Math.round(ses.max24h)} Mails pro 24 Stunden, {ses.rate}/s. Für 500/Tag braucht das
|
||||
AWS-Konto Production Access.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
{error ? (
|
||||
<div className="ds-alert ds-alert--danger" role="alert">
|
||||
<div>
|
||||
@@ -63,73 +51,95 @@ export default async function Domains() {
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
{rows.length ? (
|
||||
<section className="ds-card app-panel">
|
||||
<div className="app-table-scroll app-desktop-table">
|
||||
<table className="ds-table">
|
||||
<caption className="ds-visually-hidden">SES-Domains</caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Domain</th>
|
||||
<th>Status</th>
|
||||
<th>DKIM</th>
|
||||
<th>MAIL FROM</th>
|
||||
<th>Zuletzt geprüft</th>
|
||||
<th />
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{rows.map((row) => (
|
||||
<tr key={row.domain}>
|
||||
<td>
|
||||
<Link href={`/domains/${encodeURIComponent(row.domain)}`}>{row.domain}</Link>
|
||||
</td>
|
||||
<td>{statusBadge(row.status)}</td>
|
||||
<td>{row.dkim_tokens?.length ? `${row.dkim_tokens.length} Tokens` : "–"}</td>
|
||||
<td className="app-mono">{row.mail_from_domain || "–"}</td>
|
||||
<td className="app-mono">{row.last_checked_at ? relativ(row.last_checked_at) : "–"}</td>
|
||||
<td>
|
||||
<Link
|
||||
className="ds-button ds-button--secondary ds-button--sm"
|
||||
href={`/domains/${encodeURIComponent(row.domain)}`}
|
||||
>
|
||||
Öffnen
|
||||
</Link>
|
||||
</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div className="app-mobile-list">
|
||||
{rows.map((row) => (
|
||||
<article key={row.domain} className="app-mobile-item">
|
||||
<div className="app-mobile-item__top">
|
||||
<Link href={`/domains/${encodeURIComponent(row.domain)}`}>{row.domain}</Link>
|
||||
{statusBadge(row.status)}
|
||||
</div>
|
||||
<div className="app-mobile-item__meta">
|
||||
<span className="app-mono">{row.mail_from_domain || "kein MAIL FROM"}</span>
|
||||
<span className="app-mono" title={datum(row.last_checked_at)}>
|
||||
{row.last_checked_at ? relativ(row.last_checked_at) : "–"}
|
||||
<div className="app-grid app-grid--sidebar">
|
||||
{rows.length ? (
|
||||
<section className="ds-card app-panel" aria-labelledby="domain-list">
|
||||
<div className="app-panel__head">
|
||||
<h2 id="domain-list">Domains</h2>
|
||||
</div>
|
||||
<div className="app-domain-list">
|
||||
{rows.map((row) => (
|
||||
<Link
|
||||
key={row.domain}
|
||||
className="app-domain-row"
|
||||
href={`/domains/${encodeURIComponent(row.domain)}`}
|
||||
>
|
||||
<span className="app-domain-row__icon" aria-hidden="true">
|
||||
<Globe />
|
||||
</span>
|
||||
</div>
|
||||
</article>
|
||||
))}
|
||||
<span className="app-domain-row__main">
|
||||
<span className="app-domain-row__name">{row.domain}</span>
|
||||
<span className="app-domain-row__meta">
|
||||
<span>
|
||||
{row.dkim_tokens?.length
|
||||
? `${row.dkim_tokens.length} DKIM-Tokens`
|
||||
: "keine DKIM-Tokens"}
|
||||
</span>
|
||||
<span className="app-mono">{row.mail_from_domain || "kein MAIL FROM"}</span>
|
||||
<span title={datum(row.last_checked_at)}>
|
||||
geprüft {row.last_checked_at ? relativ(row.last_checked_at) : "–"}
|
||||
</span>
|
||||
</span>
|
||||
</span>
|
||||
<span className="app-domain-row__side">
|
||||
{statusBadge(row.status)}
|
||||
<ChevronRight className="app-domain-row__chevron" aria-hidden="true" />
|
||||
</span>
|
||||
</Link>
|
||||
))}
|
||||
</div>
|
||||
</section>
|
||||
) : (
|
||||
<EmptyState
|
||||
icon={Globe}
|
||||
title="Noch keine Domains"
|
||||
text="Füge eine Domain hinzu, verifiziere sie mit den angezeigten DNS-Records und lege danach einen API-Key an."
|
||||
action={
|
||||
<Link className="ds-button ds-button--sm" href="/domains/new">
|
||||
Domain hinzufügen
|
||||
</Link>
|
||||
}
|
||||
/>
|
||||
)}
|
||||
|
||||
<aside className="ds-card app-panel" aria-labelledby="ses-konto">
|
||||
<div className="app-panel__head">
|
||||
<h2 id="ses-konto">SES-Konto</h2>
|
||||
{ses.production ? (
|
||||
<span className="ds-badge ds-badge--success">Production</span>
|
||||
) : (
|
||||
<span className="ds-badge ds-badge--warning">Sandbox</span>
|
||||
)}
|
||||
</div>
|
||||
</section>
|
||||
) : (
|
||||
<EmptyState
|
||||
icon={Globe}
|
||||
title="Noch keine Domains"
|
||||
text="Füge eine Domain hinzu, verifiziere sie mit den angezeigten DNS-Records und lege danach einen API-Key an."
|
||||
action={
|
||||
<Link className="ds-button ds-button--sm" href="/domains/new">
|
||||
Domain hinzufügen
|
||||
</Link>
|
||||
}
|
||||
/>
|
||||
)}
|
||||
<dl className="app-dl">
|
||||
<dt>Tagesquote</dt>
|
||||
<dd>{Math.round(ses.max24h)} Mails</dd>
|
||||
<dt>Rate</dt>
|
||||
<dd>{ses.rate}/s</dd>
|
||||
<dt>Region</dt>
|
||||
<dd className="app-mono">eu-west-1</dd>
|
||||
</dl>
|
||||
|
||||
{!ses.production ? (
|
||||
<div className="ds-alert ds-alert--warning">
|
||||
<div>
|
||||
<p className="ds-alert__title">Sandbox aktiv</p>
|
||||
<p className="ds-alert__text">
|
||||
Für 500/Tag braucht das AWS-Konto Production Access. Bis dahin nur verifizierte
|
||||
Empfänger.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
<h2 className="app-section">So funktioniert's</h2>
|
||||
<ol className="app-steps">
|
||||
<li>Domain anlegen und die DNS-Records setzen.</li>
|
||||
<li>Status prüfen, bis DKIM und SES „Verifiziert“ melden.</li>
|
||||
<li>API-Key mit dieser Domain erzeugen.</li>
|
||||
</ol>
|
||||
</aside>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
+352
@@ -872,3 +872,355 @@ body {
|
||||
.app-nav--mobile .app-nav__link {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.app-chart {
|
||||
padding: var(--ds-space-3);
|
||||
background: var(--ds-surface-sunken);
|
||||
border: var(--ds-border-thin) solid var(--ds-border);
|
||||
border-radius: var(--ds-radius-surface);
|
||||
}
|
||||
|
||||
.app-chart svg {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
.app-chart__grid {
|
||||
stroke: var(--ds-border);
|
||||
stroke-dasharray: 4 4;
|
||||
}
|
||||
|
||||
.app-chart__line {
|
||||
fill: none;
|
||||
stroke: var(--ds-action-bg);
|
||||
stroke-width: 2;
|
||||
stroke-linecap: round;
|
||||
stroke-linejoin: round;
|
||||
}
|
||||
|
||||
.app-chart__dot {
|
||||
fill: var(--ds-link);
|
||||
}
|
||||
|
||||
.app-chart__axis {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
margin-top: var(--ds-space-2);
|
||||
color: var(--ds-text-muted);
|
||||
font-size: var(--ds-text-xs);
|
||||
}
|
||||
|
||||
.app-toolbar--compact {
|
||||
grid-template-columns: minmax(12rem, 1fr) auto;
|
||||
}
|
||||
|
||||
.app-toolbar--metrics {
|
||||
grid-template-columns: repeat(2, minmax(10rem, 14rem)) auto;
|
||||
}
|
||||
|
||||
@media (max-width: 63.99rem) {
|
||||
.app-toolbar--compact,
|
||||
.app-toolbar--metrics {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
|
||||
.app-domain-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.app-domain-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--ds-space-3);
|
||||
padding-block: var(--ds-space-3);
|
||||
border-bottom: var(--ds-border-thin) solid var(--ds-border);
|
||||
color: var(--ds-text);
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.app-domain-row:last-child {
|
||||
border-bottom: 0;
|
||||
}
|
||||
|
||||
.app-domain-row:hover {
|
||||
background: var(--ds-surface-hover);
|
||||
}
|
||||
|
||||
.app-domain-row__icon {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: var(--ds-space-12);
|
||||
height: var(--ds-space-12);
|
||||
flex: none;
|
||||
border-radius: var(--ds-radius-surface);
|
||||
background: var(--ds-selection-bg);
|
||||
color: var(--ds-selection-text);
|
||||
}
|
||||
|
||||
.app-domain-row__icon svg {
|
||||
width: var(--ds-icon-md);
|
||||
height: var(--ds-icon-md);
|
||||
}
|
||||
|
||||
.app-domain-row__main {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--ds-space-1);
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.app-domain-row__name {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--ds-space-2);
|
||||
flex-wrap: wrap;
|
||||
color: var(--ds-link);
|
||||
font-size: var(--ds-text-md);
|
||||
font-weight: var(--ds-weight-semibold);
|
||||
}
|
||||
|
||||
.app-domain-row__meta {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: var(--ds-space-2);
|
||||
color: var(--ds-text-muted);
|
||||
font-size: var(--ds-text-sm);
|
||||
}
|
||||
|
||||
.app-domain-row__chevron {
|
||||
width: var(--ds-icon-md);
|
||||
height: var(--ds-icon-md);
|
||||
margin-inline-start: auto;
|
||||
flex: none;
|
||||
color: var(--ds-text-subtle);
|
||||
}
|
||||
|
||||
@media (max-width: 47.99rem) {
|
||||
.app-domain-row {
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
.app-domain-row__chevron {
|
||||
margin-top: var(--ds-space-2);
|
||||
}
|
||||
}
|
||||
|
||||
.app-domain-row__side {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--ds-space-2);
|
||||
margin-inline-start: auto;
|
||||
flex: none;
|
||||
}
|
||||
|
||||
.app-steps {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--ds-space-2);
|
||||
margin: 0;
|
||||
padding-inline-start: var(--ds-space-4);
|
||||
color: var(--ds-text-muted);
|
||||
font-size: var(--ds-text-sm);
|
||||
}
|
||||
|
||||
.app-domain-row__side .app-domain-row__chevron {
|
||||
margin-inline-start: 0;
|
||||
}
|
||||
|
||||
/* Sidebar-Feinschliff */
|
||||
.app-sidebar__top {
|
||||
gap: var(--ds-space-4);
|
||||
}
|
||||
|
||||
.app-sidebar .app-brand {
|
||||
font-size: var(--ds-text-lg);
|
||||
}
|
||||
|
||||
.app-nav--sidebar {
|
||||
gap: var(--ds-space-3);
|
||||
}
|
||||
|
||||
.app-nav__title {
|
||||
font-size: var(--ds-text-2xs);
|
||||
letter-spacing: 0.1em;
|
||||
opacity: 0.52;
|
||||
}
|
||||
|
||||
.app-nav__group + .app-nav__group {
|
||||
padding-top: var(--ds-space-3);
|
||||
border-top: var(--ds-border-thin) solid color-mix(in srgb, currentColor 14%, transparent);
|
||||
}
|
||||
|
||||
.app-nav__link:hover {
|
||||
background: color-mix(in srgb, currentColor 9%, transparent);
|
||||
}
|
||||
|
||||
.app-nav__link[aria-current="page"]:hover {
|
||||
background: var(--ds-selection-bg);
|
||||
}
|
||||
|
||||
.app-sidebar__status {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--ds-space-2);
|
||||
padding-inline: var(--ds-space-3);
|
||||
color: inherit;
|
||||
font-size: var(--ds-text-xs);
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
||||
.app-sidebar__dot {
|
||||
width: var(--ds-space-2);
|
||||
height: var(--ds-space-2);
|
||||
border-radius: var(--ds-radius-full);
|
||||
background: var(--ds-success);
|
||||
}
|
||||
|
||||
/* Aktiver Eintrag: ruhiger als die volle Goldfläche */
|
||||
.app-nav--sidebar .app-nav__link {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.app-nav--sidebar .app-nav__link[aria-current="page"] {
|
||||
background: color-mix(in srgb, var(--ds-selection-bg) 22%, transparent);
|
||||
color: var(--ds-link);
|
||||
}
|
||||
|
||||
.app-nav--sidebar .app-nav__link[aria-current="page"]::before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
top: var(--ds-space-2);
|
||||
bottom: var(--ds-space-2);
|
||||
left: 0;
|
||||
width: var(--ds-space-1);
|
||||
border-radius: var(--ds-radius-full);
|
||||
background: var(--ds-link);
|
||||
}
|
||||
|
||||
.app-nav--sidebar .app-nav__link[aria-current="page"] {
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
.app-nav--sidebar .app-nav__link[aria-current="page"]:hover {
|
||||
background: color-mix(in srgb, currentColor 9%, transparent);
|
||||
}
|
||||
|
||||
/* Link-Zustände in der Sidebar: nie von globalem a:hover/a:visited überschreiben lassen */
|
||||
a.app-nav__link,
|
||||
a.app-nav__link:visited {
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
a.app-nav__link:hover {
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
.app-nav--sidebar a.app-nav__link[aria-current="page"],
|
||||
.app-nav--sidebar a.app-nav__link[aria-current="page"]:hover {
|
||||
color: var(--ds-link);
|
||||
}
|
||||
|
||||
.app-nav--mobile a.app-nav__link[aria-current="page"],
|
||||
.app-nav--mobile a.app-nav__link[aria-current="page"]:hover {
|
||||
color: var(--ds-selection-text);
|
||||
}
|
||||
|
||||
/* Preise */
|
||||
.app-toolbar--pricing {
|
||||
grid-template-columns: minmax(12rem, 20rem) auto;
|
||||
}
|
||||
|
||||
@media (max-width: 63.99rem) {
|
||||
.app-toolbar--pricing {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
|
||||
.app-plan-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr));
|
||||
gap: var(--ds-space-4);
|
||||
}
|
||||
|
||||
.app-plan {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--ds-space-2);
|
||||
}
|
||||
|
||||
.app-plan__head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: var(--ds-space-2);
|
||||
}
|
||||
|
||||
.app-plan__head h2 {
|
||||
margin: 0;
|
||||
font-size: var(--ds-text-lg);
|
||||
}
|
||||
|
||||
.app-plan__cost {
|
||||
margin-top: var(--ds-space-2);
|
||||
}
|
||||
|
||||
.app-plan__price {
|
||||
color: var(--ds-text-muted);
|
||||
font-size: var(--ds-text-sm);
|
||||
}
|
||||
|
||||
.app-plan__note {
|
||||
margin: 0;
|
||||
color: var(--ds-text-muted);
|
||||
font-size: var(--ds-text-sm);
|
||||
}
|
||||
|
||||
.app-plan__conditions {
|
||||
margin: 0;
|
||||
padding-inline-start: var(--ds-space-4);
|
||||
color: var(--ds-text-subtle);
|
||||
font-size: var(--ds-text-xs);
|
||||
}
|
||||
|
||||
/* Preisrechner: Eingabe und Button auf einer Linie */
|
||||
.app-calc {
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
justify-content: space-between;
|
||||
gap: var(--ds-space-6);
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.app-calc__form {
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
gap: var(--ds-space-3);
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.app-calc__result {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-end;
|
||||
gap: var(--ds-space-1);
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.app-calc__value {
|
||||
font-size: var(--ds-text-3xl);
|
||||
}
|
||||
|
||||
@media (max-width: 63.99rem) {
|
||||
.app-calc {
|
||||
align-items: stretch;
|
||||
}
|
||||
|
||||
.app-calc__result {
|
||||
align-items: flex-start;
|
||||
text-align: left;
|
||||
}
|
||||
}
|
||||
@@ -39,6 +39,10 @@ export default function RootLayout({ children }: { children: React.ReactNode })
|
||||
<AppNav />
|
||||
</div>
|
||||
<div className="app-sidebar__footer">
|
||||
<div className="app-sidebar__status">
|
||||
<span className="app-sidebar__dot" aria-hidden="true" />
|
||||
Amazon SES
|
||||
</div>
|
||||
<ThemeToggle />
|
||||
</div>
|
||||
</aside>
|
||||
|
||||
@@ -0,0 +1,238 @@
|
||||
import Link from "next/link";
|
||||
import { BarChart3 } from "lucide-react";
|
||||
|
||||
import { EmptyState } from "@/app/empty-state";
|
||||
import { PageHeader } from "@/app/page-header";
|
||||
import { datum } from "@/lib/format";
|
||||
import { dailyMetrics, listApiKeys } from "@/lib/queries";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
const RANGES = [
|
||||
{ value: "7", label: "7 Tage" },
|
||||
{ value: "14", label: "14 Tage" },
|
||||
{ value: "30", label: "30 Tage" },
|
||||
];
|
||||
|
||||
function dayLabel(day: string): string {
|
||||
return new Intl.DateTimeFormat("de-DE", { day: "2-digit", month: "2-digit" }).format(
|
||||
new Date(`${day}T12:00:00`),
|
||||
);
|
||||
}
|
||||
|
||||
function percent(value: number, total: number): string {
|
||||
if (!total) return "–";
|
||||
return `${Math.round((value / total) * 1000) / 10} %`;
|
||||
}
|
||||
|
||||
export default async function Metrics({
|
||||
searchParams,
|
||||
}: {
|
||||
searchParams: Promise<{ days?: string; key?: string }>;
|
||||
}) {
|
||||
const params = await searchParams;
|
||||
const days = Number(params.days ?? 14);
|
||||
const keyId = String(params.key ?? "");
|
||||
|
||||
let rows: Awaited<ReturnType<typeof dailyMetrics>> = [];
|
||||
let keys: Awaited<ReturnType<typeof listApiKeys>> = [];
|
||||
let error = "";
|
||||
try {
|
||||
[rows, keys] = await Promise.all([dailyMetrics(days, keyId), listApiKeys()]);
|
||||
} catch (cause) {
|
||||
error = cause instanceof Error ? cause.message : "Datenbank nicht erreichbar";
|
||||
}
|
||||
|
||||
const total = rows.reduce((sum, row) => sum + row.total, 0);
|
||||
const delivered = rows.reduce((sum, row) => sum + row.delivered, 0);
|
||||
const bounced = rows.reduce((sum, row) => sum + row.bounced, 0);
|
||||
const complained = rows.reduce((sum, row) => sum + row.complained, 0);
|
||||
const failed = rows.reduce((sum, row) => sum + row.failed, 0);
|
||||
const final = delivered + bounced + complained + failed;
|
||||
|
||||
const W = 760;
|
||||
const H = 220;
|
||||
const padX = 16;
|
||||
const padTop = 16;
|
||||
const padBottom = 28;
|
||||
const max = Math.max(...rows.map((row) => row.total), 1);
|
||||
const x = (index: number) => padX + (index * (W - 2 * padX)) / Math.max(rows.length - 1, 1);
|
||||
const y = (value: number) => H - padBottom - (value / max) * (H - padTop - padBottom);
|
||||
const line = rows.map((row, index) => `${index === 0 ? "M" : "L"}${x(index)},${y(row.total)}`).join(" ");
|
||||
|
||||
return (
|
||||
<>
|
||||
<PageHeader
|
||||
title="Metriken"
|
||||
lead="Volumen, Zustellung und Fehler der letzten Tage. Tageswerte, keine Marketingzahlen."
|
||||
/>
|
||||
|
||||
<form className="app-toolbar app-toolbar--metrics" method="get">
|
||||
<div className="ds-field">
|
||||
<label className="ds-visually-hidden" htmlFor="days">
|
||||
Zeitraum
|
||||
</label>
|
||||
<select className="ds-select" id="days" name="days" defaultValue={String(days)}>
|
||||
{RANGES.map((range) => (
|
||||
<option key={range.value} value={range.value}>
|
||||
{range.label}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</div>
|
||||
<div className="ds-field">
|
||||
<label className="ds-visually-hidden" htmlFor="key">
|
||||
API-Key
|
||||
</label>
|
||||
<select className="ds-select" id="key" name="key" defaultValue={keyId}>
|
||||
<option value="">Alle API-Keys</option>
|
||||
{keys.map((key) => (
|
||||
<option key={key.id} value={key.id}>
|
||||
{key.app} · {key.name}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</div>
|
||||
<div className="app-toolbar__actions">
|
||||
<button className="ds-button" type="submit">
|
||||
Anzeigen
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
{error ? (
|
||||
<div className="ds-alert ds-alert--danger" role="alert">
|
||||
<div>
|
||||
<p className="ds-alert__title">Datenbank nicht erreichbar</p>
|
||||
<p className="ds-alert__text">{error}</p>
|
||||
</div>
|
||||
</div>
|
||||
) : total === 0 ? (
|
||||
<EmptyState
|
||||
icon={BarChart3}
|
||||
title="Noch keine Daten"
|
||||
text="Sobald Courier Mails verarbeitet, erscheinen hier Volumen und Zustellraten."
|
||||
action={
|
||||
<Link className="ds-button ds-button--sm" href="/docs">
|
||||
API ansehen
|
||||
</Link>
|
||||
}
|
||||
/>
|
||||
) : (
|
||||
<>
|
||||
<section className="app-stats" aria-label="Kennzahlen">
|
||||
<article className="ds-card app-stat">
|
||||
<span className="ds-stat__value">{total}</span>
|
||||
<span className="ds-stat__label">Mails</span>
|
||||
<span className="ds-stat__meta">{days} Tage</span>
|
||||
</article>
|
||||
<article className="ds-card app-stat">
|
||||
<span className="ds-stat__value">{percent(delivered, final)}</span>
|
||||
<span className="ds-stat__label">Zustellrate</span>
|
||||
<span className="ds-stat__meta">{delivered} zugestellt</span>
|
||||
</article>
|
||||
<article className="ds-card app-stat">
|
||||
<span className="ds-stat__value">{percent(bounced, final)}</span>
|
||||
<span className="ds-stat__label">Bounce-Rate</span>
|
||||
<span className="ds-stat__meta">{bounced} Bounces</span>
|
||||
</article>
|
||||
<article className="ds-card app-stat">
|
||||
<span className="ds-stat__value">{percent(complained, final)}</span>
|
||||
<span className="ds-stat__label">Complaint-Rate</span>
|
||||
<span className="ds-stat__meta">{complained} Beschwerden</span>
|
||||
</article>
|
||||
</section>
|
||||
|
||||
<section className="ds-card app-panel" aria-labelledby="verlauf">
|
||||
<div className="app-panel__head">
|
||||
<h2 id="verlauf">Verlauf</h2>
|
||||
</div>
|
||||
<div className="app-chart">
|
||||
<svg
|
||||
viewBox={`0 0 ${W} ${H}`}
|
||||
role="img"
|
||||
aria-label={`Tägliches Mailvolumen der letzten ${days} Tage`}
|
||||
>
|
||||
<title>Mailvolumen pro Tag</title>
|
||||
{[0, 0.5, 1].map((fraction) => (
|
||||
<line
|
||||
key={fraction}
|
||||
x1={padX}
|
||||
x2={W - padX}
|
||||
y1={y(max * fraction)}
|
||||
y2={y(max * fraction)}
|
||||
className="app-chart__grid"
|
||||
/>
|
||||
))}
|
||||
<path d={line} className="app-chart__line" />
|
||||
{rows.map((row, index) => (
|
||||
<circle
|
||||
key={row.day}
|
||||
cx={x(index)}
|
||||
cy={y(row.total)}
|
||||
r={3}
|
||||
className="app-chart__dot"
|
||||
>
|
||||
<title>{`${dayLabel(row.day)}: ${row.total}`}</title>
|
||||
</circle>
|
||||
))}
|
||||
</svg>
|
||||
<div className="app-chart__axis">
|
||||
<span>{dayLabel(rows[0]?.day ?? "")}</span>
|
||||
<span>{dayLabel(rows[rows.length - 1]?.day ?? "")}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="app-table-scroll app-desktop-table app-section">
|
||||
<table className="ds-table">
|
||||
<caption className="ds-visually-hidden">Tageswerte</caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Tag</th>
|
||||
<th className="ds-table__num">Mails</th>
|
||||
<th className="ds-table__num">Zugestellt</th>
|
||||
<th className="ds-table__num">Bounce</th>
|
||||
<th className="ds-table__num">Beschwerde</th>
|
||||
<th className="ds-table__num">Fehler</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{rows.map((row) => (
|
||||
<tr key={row.day}>
|
||||
<td>{dayLabel(row.day)}</td>
|
||||
<td className="ds-table__num">{row.total}</td>
|
||||
<td className="ds-table__num">{row.delivered}</td>
|
||||
<td className="ds-table__num">{row.bounced}</td>
|
||||
<td className="ds-table__num">{row.complained}</td>
|
||||
<td className="ds-table__num">{row.failed}</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div className="app-mobile-list">
|
||||
{rows.map((row) => (
|
||||
<article key={row.day} className="app-mobile-item">
|
||||
<div className="app-mobile-item__top">
|
||||
<span>{dayLabel(row.day)}</span>
|
||||
<span className="ds-badge">{row.total} Mails</span>
|
||||
</div>
|
||||
<div className="app-mobile-item__meta">
|
||||
<span>{row.delivered} zugestellt</span>
|
||||
<span>{row.bounced} Bounce</span>
|
||||
<span>{row.complained} Beschwerde</span>
|
||||
</div>
|
||||
</article>
|
||||
))}
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<p className="app-muted app-section">
|
||||
Stand: {datum(new Date())}. Zustellrate = zugestellt / (zugestellt + Bounce +
|
||||
Beschwerde + Fehler).
|
||||
</p>
|
||||
</>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,154 @@
|
||||
import Link from "next/link";
|
||||
import { Calculator } from "lucide-react";
|
||||
|
||||
import { PageHeader } from "@/app/page-header";
|
||||
import { monthlyVolume } from "@/lib/queries";
|
||||
import { SES_PLANS, estimateMonthly, usd } from "@/lib/pricing";
|
||||
import { sesAccountStatus } from "@/lib/ses-admin";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
export default async function Pricing({
|
||||
searchParams,
|
||||
}: {
|
||||
searchParams: Promise<{ volume?: string }>;
|
||||
}) {
|
||||
const params = await searchParams;
|
||||
const requested = Number(params.volume);
|
||||
const volume = Number.isFinite(requested) && requested > 0 ? Math.floor(requested) : 15000;
|
||||
|
||||
let usage = { month: 0, last30: 0 };
|
||||
let ses = { production: false, max24h: 0, rate: 0 };
|
||||
try {
|
||||
[usage, ses] = await Promise.all([monthlyVolume(), sesAccountStatus()]);
|
||||
} catch {
|
||||
// Die Preisliste funktioniert auch ohne Datenbank.
|
||||
}
|
||||
|
||||
const plans = SES_PLANS.map((plan) => ({ plan, cost: estimateMonthly(plan, volume) })).sort(
|
||||
(a, b) => a.cost - b.cost,
|
||||
);
|
||||
const cheapest = plans[0];
|
||||
const daysInMonth = new Date(new Date().getFullYear(), new Date().getMonth() + 1, 0).getDate();
|
||||
const projected = usage.month
|
||||
? Math.round((usage.month / new Date().getDate()) * daysInMonth)
|
||||
: 0;
|
||||
|
||||
return (
|
||||
<>
|
||||
<PageHeader
|
||||
title="Preise"
|
||||
lead="Was Amazon SES bei deinem Volumen kostet – AWS-Listenpreise, keine Schätzung aus Marketingmaterial."
|
||||
/>
|
||||
|
||||
<section className="app-stats" aria-label="Preis-Kennzahlen">
|
||||
<article className="ds-card app-stat">
|
||||
<span className="ds-stat__value">{usage.month}</span>
|
||||
<span className="ds-stat__label">Mails diesen Monat</span>
|
||||
<span className="ds-stat__meta">
|
||||
Hochrechnung: {projected} / Monat
|
||||
</span>
|
||||
</article>
|
||||
<article className="ds-card app-stat">
|
||||
<span className="ds-stat__value">{volume.toLocaleString("de-DE")}</span>
|
||||
<span className="ds-stat__label">Beispielvolumen</span>
|
||||
<span className="ds-stat__meta">entspricht 500 Mails/Tag</span>
|
||||
</article>
|
||||
<article className="ds-card app-stat">
|
||||
<span className="ds-stat__value">{usd(cheapest.cost)}</span>
|
||||
<span className="ds-stat__label">Günstigster Plan</span>
|
||||
<span className="ds-stat__meta">{cheapest.plan.name} bei diesem Volumen</span>
|
||||
</article>
|
||||
<article className="ds-card app-stat">
|
||||
<span className="ds-stat__value">{ses.production ? "Production" : "Sandbox"}</span>
|
||||
<span className="ds-stat__label">SES-Status</span>
|
||||
<span className="ds-stat__meta">
|
||||
{Math.round(ses.max24h)} Mails/Tag · {ses.rate}/s
|
||||
</span>
|
||||
</article>
|
||||
</section>
|
||||
|
||||
<section className="ds-card app-panel" aria-labelledby="rechner">
|
||||
<div className="app-panel__head">
|
||||
<div>
|
||||
<h2 id="rechner">Kostenrechner</h2>
|
||||
<p className="app-muted">AWS-Listenpreise für eu-west-1, ohne Steuern.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div className="app-calc">
|
||||
<form className="app-calc__form" method="get">
|
||||
<div className="ds-field">
|
||||
<label className="ds-field__label" htmlFor="volume">
|
||||
Mails pro Monat
|
||||
</label>
|
||||
<input
|
||||
className="ds-input"
|
||||
id="volume"
|
||||
name="volume"
|
||||
type="number"
|
||||
min={1}
|
||||
step={1000}
|
||||
defaultValue={volume}
|
||||
required
|
||||
/>
|
||||
</div>
|
||||
<div className="app-toolbar__actions">
|
||||
<button className="ds-button" type="submit">
|
||||
<Calculator className="app-nav__icon" aria-hidden="true" />
|
||||
Berechnen
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
<div className="app-calc__result">
|
||||
<span className="ds-stat__label">Günstigster Plan bei {volume.toLocaleString("de-DE")} Mails</span>
|
||||
<span className="ds-stat__value app-calc__value">{usd(cheapest.cost)}</span>
|
||||
<span className="app-muted">{cheapest.plan.name}</span>
|
||||
</div>
|
||||
</div>
|
||||
<p className="ds-field__hint app-section">Standard: 15.000 (500/Tag).</p>
|
||||
</section>
|
||||
|
||||
<section className="app-plan-grid app-section" aria-label="SES-Preispläne">
|
||||
{plans.map(({ plan, cost }) => (
|
||||
<article className="ds-card app-plan" key={plan.id}>
|
||||
<div className="app-plan__head">
|
||||
<h2>{plan.name}</h2>
|
||||
{plan.id === cheapest.plan.id ? (
|
||||
<span className="ds-badge ds-badge--success">Günstigster</span>
|
||||
) : null}
|
||||
</div>
|
||||
<span className="ds-stat__value app-plan__cost">{usd(cost)}</span>
|
||||
<span className="app-plan__price">
|
||||
{plan.base ? `${usd(plan.base)}/Monat + ` : "keine Grundgebühr + "}
|
||||
{usd(plan.tiers[0].rate)}/1.000
|
||||
</span>
|
||||
<p className="app-plan__note">{plan.note}</p>
|
||||
<ul className="app-plan__conditions">
|
||||
<li>0–10 Mio.: {usd(plan.tiers[0].rate)}/1.000</li>
|
||||
{plan.tiers[1] ? (
|
||||
<li>10–100 Mio.: {usd(plan.tiers[1].rate)}/1.000</li>
|
||||
) : null}
|
||||
{plan.tiers[2] ? <li>> 100 Mio.: {usd(plan.tiers[2].rate)}/1.000</li> : null}
|
||||
</ul>
|
||||
</article>
|
||||
))}
|
||||
</section>
|
||||
|
||||
<div className="ds-alert app-section">
|
||||
<div>
|
||||
<p className="ds-alert__title">Was in der Schätzung fehlt</p>
|
||||
<p className="ds-alert__text">
|
||||
Steuern, Datenübertragung für Anhänge ($0,12/GB), Dedicated IPs und SNS-Kosten sind
|
||||
nicht enthalten. Neue SES-Konten starten häufig auf <strong>Essentials</strong>; der
|
||||
Wechsel zu À la carte ist möglich. Preisstand: 23.11.2026, Quelle AWS SES Pricing.
|
||||
</p>
|
||||
<p className="ds-alert__text">
|
||||
<a href="https://aws.amazon.com/ses/pricing/" target="_blank" rel="noreferrer">
|
||||
AWS SES Preise öffnen
|
||||
</a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -60,7 +60,7 @@ export default async function Suppressions({
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
<form className="app-toolbar" method="get" style={{ gridTemplateColumns: "minmax(12rem, 1fr) auto" }}>
|
||||
<form className="app-toolbar app-toolbar--compact" method="get">
|
||||
<div className="ds-field">
|
||||
<label className="ds-visually-hidden" htmlFor="q">
|
||||
Suche
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
export type SesPlan = {
|
||||
id: string;
|
||||
name: string;
|
||||
base: number;
|
||||
tiers: { upTo: number | null; rate: number }[];
|
||||
note: string;
|
||||
};
|
||||
|
||||
export const SES_PLANS: SesPlan[] = [
|
||||
{
|
||||
id: "a-la-carte",
|
||||
name: "À la carte",
|
||||
base: 0,
|
||||
tiers: [{ upTo: null, rate: 0.1 }],
|
||||
note: "Pay-as-you-go, keine Grundgebühr.",
|
||||
},
|
||||
{
|
||||
id: "essentials",
|
||||
name: "Essentials",
|
||||
base: 0,
|
||||
tiers: [
|
||||
{ upTo: 10_000_000, rate: 0.16 },
|
||||
{ upTo: 100_000_000, rate: 0.14 },
|
||||
{ upTo: null, rate: 0.11 },
|
||||
],
|
||||
note: "Standard für neue SES-Konten, ohne Grundgebühr.",
|
||||
},
|
||||
{
|
||||
id: "pro",
|
||||
name: "Pro",
|
||||
base: 105,
|
||||
tiers: [
|
||||
{ upTo: 10_000_000, rate: 0.22 },
|
||||
{ upTo: 100_000_000, rate: 0.17 },
|
||||
{ upTo: null, rate: 0.12 },
|
||||
],
|
||||
note: "Mit Dedicated IPs und erweiterten Deliverability-Funktionen.",
|
||||
},
|
||||
{
|
||||
id: "enterprise",
|
||||
name: "Enterprise",
|
||||
base: 500,
|
||||
tiers: [
|
||||
{ upTo: 10_000_000, rate: 0.23 },
|
||||
{ upTo: 100_000_000, rate: 0.18 },
|
||||
{ upTo: null, rate: 0.13 },
|
||||
],
|
||||
note: "Mehrere Domains, viele Dedicated IPs und Seedlist-Tests.",
|
||||
},
|
||||
];
|
||||
|
||||
export function estimateMonthly(plan: SesPlan, volume: number): number {
|
||||
let remaining = Math.max(0, Math.floor(volume));
|
||||
let last = 0;
|
||||
let cost = plan.base;
|
||||
for (const tier of plan.tiers) {
|
||||
const limit = tier.upTo === null ? remaining : Math.min(remaining, tier.upTo - last);
|
||||
if (limit <= 0) break;
|
||||
cost += (limit / 1000) * tier.rate;
|
||||
remaining -= limit;
|
||||
last = tier.upTo ?? last;
|
||||
if (remaining <= 0) break;
|
||||
}
|
||||
return cost;
|
||||
}
|
||||
|
||||
export function usd(value: number): string {
|
||||
return new Intl.NumberFormat("de-DE", {
|
||||
style: "currency",
|
||||
currency: "USD",
|
||||
minimumFractionDigits: 2,
|
||||
maximumFractionDigits: 2,
|
||||
}).format(value);
|
||||
}
|
||||
@@ -145,3 +145,46 @@ export async function listSuppressions(q?: string, limit = 200) {
|
||||
return rows;
|
||||
}
|
||||
|
||||
|
||||
export type DailyMetric = {
|
||||
day: string;
|
||||
total: number;
|
||||
delivered: number;
|
||||
bounced: number;
|
||||
complained: number;
|
||||
failed: number;
|
||||
};
|
||||
|
||||
export async function dailyMetrics(days = 14, keyId = ""): Promise<DailyMetric[]> {
|
||||
const span = Math.min(Math.max(days, 1), 90);
|
||||
const { rows } = await query<DailyMetric>(
|
||||
`with days as (
|
||||
select generate_series(current_date - ($1::int - 1), current_date, interval '1 day')::date as day
|
||||
)
|
||||
select to_char(d.day, 'YYYY-MM-DD') as day,
|
||||
count(m.id)::int as total,
|
||||
count(m.id) filter (where m.status = 'delivered')::int as delivered,
|
||||
count(m.id) filter (where m.status = 'bounced')::int as bounced,
|
||||
count(m.id) filter (where m.status = 'complained')::int as complained,
|
||||
count(m.id) filter (where m.status = 'failed')::int as failed
|
||||
from days d
|
||||
left join messages m
|
||||
on m.created_at >= d.day
|
||||
and m.created_at < d.day + interval '1 day'
|
||||
and ($2::uuid is null or m.api_key_id = $2)
|
||||
group by d.day
|
||||
order by d.day`,
|
||||
[span, keyId || null],
|
||||
);
|
||||
return rows;
|
||||
}
|
||||
|
||||
export async function monthlyVolume(): Promise<{ month: number; last30: number }> {
|
||||
const { rows } = await query<{ month: number; last30: number }>(
|
||||
`select
|
||||
count(*) filter (where created_at >= date_trunc('month', now()))::int as month,
|
||||
count(*) filter (where created_at >= now() - interval '30 days')::int as last30
|
||||
from messages`,
|
||||
);
|
||||
return rows[0] ?? { month: 0, last30: 0 };
|
||||
}
|
||||
+2
-2
@@ -2,7 +2,7 @@ apiVersion: v2
|
||||
name: courier
|
||||
description: Transaktionsmail-Gateway für hubsport.club über Amazon SES.
|
||||
type: application
|
||||
version: 26.11.6
|
||||
appVersion: "26.11.6"
|
||||
version: 26.11.13
|
||||
appVersion: "26.11.13"
|
||||
icon: https://git.aimighty.olares.de/aimighty/courier/raw/branch/main/icon.png
|
||||
home: https://git.aimighty.olares.de/aimighty/courier
|
||||
@@ -12,7 +12,7 @@ metadata:
|
||||
title: Courier
|
||||
description: Transaktionsmail für deine Apps über Amazon SES.
|
||||
icon: https://git.aimighty.olares.de/aimighty/courier/raw/branch/main/icon.png
|
||||
version: 26.11.6
|
||||
version: 26.11.13
|
||||
categories:
|
||||
- Applications
|
||||
|
||||
@@ -106,7 +106,7 @@ envs:
|
||||
default: "1000"
|
||||
|
||||
spec:
|
||||
versionName: '26.11.6'
|
||||
versionName: '26.11.13'
|
||||
fullDescription: |
|
||||
**Courier** ist ein kleiner Versanddienst für transaktionale E-Mails:
|
||||
eine Resend-kompatible HTTP-API, Warteschlange, Retry, Logs und
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "courier",
|
||||
"version": "26.11.6",
|
||||
"version": "26.11.13",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "next dev -H 0.0.0.0 -p 3400",
|
||||
|
||||
Reference in new issue
Block a user