Phase 0 — Foundation: backend, data model, local auth, frontend, deploy + CI #1

Merged
justin merged 17 commits from phase-0-foundation into main 2026-06-06 11:32:31 -04:00
24 changed files with 4281 additions and 0 deletions
Showing only changes of commit a5a79f01a7 - Show all commits
+7
View File
@@ -0,0 +1,7 @@
node_modules
.next
out
build
npm-debug.log*
.env*.local
README.md
+6
View File
@@ -0,0 +1,6 @@
/node_modules
/.next
/out
/build
next-env.d.ts
.env*.local
+24
View File
@@ -0,0 +1,24 @@
# syntax=docker/dockerfile:1
FROM node:22-bookworm-slim AS deps
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm ci
FROM node:22-bookworm-slim AS build
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .
RUN npm run build
FROM node:22-bookworm-slim AS runner
WORKDIR /app
ENV NODE_ENV=production \
PORT=3000 \
HOSTNAME=0.0.0.0
# Next standalone output: a minimal server with only the traced dependencies.
COPY --from=build /app/.next/standalone ./
COPY --from=build /app/.next/static ./.next/static
COPY --from=build /app/public ./public
EXPOSE 3000
CMD ["node", "server.js"]
+19
View File
@@ -0,0 +1,19 @@
@import "tailwindcss";
:root {
--background: #ffffff;
--foreground: #0a0a0a;
}
@media (prefers-color-scheme: dark) {
:root {
--background: #0a0a0a;
--foreground: #ededed;
}
}
body {
background: var(--background);
color: var(--foreground);
font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
+34
View File
@@ -0,0 +1,34 @@
import type { Metadata } from "next";
import Link from "next/link";
import "./globals.css";
export const metadata: Metadata = {
title: "Provenance",
description: "Where it came from matters — family and land, every fact sourced.",
};
export default function RootLayout({ children }: { children: React.ReactNode }) {
return (
<html lang="en">
<body>
<header className="border-b border-neutral-200">
<div className="mx-auto flex max-w-3xl items-center justify-between px-4 py-3">
<Link href="/" className="font-semibold">
Provenance
</Link>
<nav className="flex gap-4 text-sm">
<Link href="/trees" className="hover:underline">
Trees
</Link>
<Link href="/login" className="hover:underline">
Sign in
</Link>
</nav>
</div>
</header>
<main className="mx-auto max-w-3xl px-4 py-8">{children}</main>
</body>
</html>
);
}
+74
View File
@@ -0,0 +1,74 @@
"use client";
import Link from "next/link";
import { useRouter } from "next/navigation";
import { useState } from "react";
import { api } from "@/lib/api/client";
import { Button } from "@/components/ui/button";
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label";
export default function LoginPage() {
const router = useRouter();
const [email, setEmail] = useState("");
const [password, setPassword] = useState("");
const [error, setError] = useState<string | null>(null);
const [loading, setLoading] = useState(false);
async function onSubmit(e: React.FormEvent) {
e.preventDefault();
setLoading(true);
setError(null);
const { error } = await api.POST("/api/v1/auth/login", { body: { email, password } });
setLoading(false);
if (error) {
setError("Invalid email or password.");
return;
}
router.push("/trees");
}
return (
<Card className="mx-auto max-w-md">
<CardHeader>
<CardTitle>Sign in</CardTitle>
</CardHeader>
<CardContent>
<form onSubmit={onSubmit} className="space-y-4">
<div className="space-y-1">
<Label htmlFor="email">Email</Label>
<Input
id="email"
type="email"
value={email}
onChange={(e) => setEmail(e.target.value)}
required
/>
</div>
<div className="space-y-1">
<Label htmlFor="password">Password</Label>
<Input
id="password"
type="password"
value={password}
onChange={(e) => setPassword(e.target.value)}
required
/>
</div>
{error && <p className="text-sm text-red-600">{error}</p>}
<Button type="submit" disabled={loading} className="w-full">
{loading ? "Signing in…" : "Sign in"}
</Button>
</form>
<p className="mt-4 text-sm text-neutral-600">
No account?{" "}
<Link href="/register" className="underline">
Create one
</Link>
</p>
</CardContent>
</Card>
);
}
+25
View File
@@ -0,0 +1,25 @@
import Link from "next/link";
import { Button } from "@/components/ui/button";
export default function Home() {
return (
<div className="space-y-6">
<div className="space-y-2">
<h1 className="text-3xl font-bold">Provenance</h1>
<p className="text-neutral-600">
Trace where you come from your family and your land with every fact linked to a
source, on infrastructure you control.
</p>
</div>
<div className="flex gap-3">
<Link href="/register">
<Button>Create an account</Button>
</Link>
<Link href="/login">
<Button variant="outline">Sign in</Button>
</Link>
</div>
</div>
);
}
+82
View File
@@ -0,0 +1,82 @@
"use client";
import Link from "next/link";
import { useRouter } from "next/navigation";
import { useState } from "react";
import { api } from "@/lib/api/client";
import { Button } from "@/components/ui/button";
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label";
export default function RegisterPage() {
const router = useRouter();
const [email, setEmail] = useState("");
const [displayName, setDisplayName] = useState("");
const [password, setPassword] = useState("");
const [error, setError] = useState<string | null>(null);
const [loading, setLoading] = useState(false);
async function onSubmit(e: React.FormEvent) {
e.preventDefault();
setLoading(true);
setError(null);
const { error } = await api.POST("/api/v1/auth/register", {
body: { email, password, display_name: displayName || null },
});
setLoading(false);
if (error) {
setError("Could not register. The email may already be in use, or the password is too short (min 8).");
return;
}
router.push("/trees");
}
return (
<Card className="mx-auto max-w-md">
<CardHeader>
<CardTitle>Create your account</CardTitle>
</CardHeader>
<CardContent>
<form onSubmit={onSubmit} className="space-y-4">
<div className="space-y-1">
<Label htmlFor="name">Name</Label>
<Input id="name" value={displayName} onChange={(e) => setDisplayName(e.target.value)} />
</div>
<div className="space-y-1">
<Label htmlFor="email">Email</Label>
<Input
id="email"
type="email"
value={email}
onChange={(e) => setEmail(e.target.value)}
required
/>
</div>
<div className="space-y-1">
<Label htmlFor="password">Password</Label>
<Input
id="password"
type="password"
value={password}
onChange={(e) => setPassword(e.target.value)}
minLength={8}
required
/>
</div>
{error && <p className="text-sm text-red-600">{error}</p>}
<Button type="submit" disabled={loading} className="w-full">
{loading ? "Creating…" : "Create account"}
</Button>
</form>
<p className="mt-4 text-sm text-neutral-600">
Already have an account?{" "}
<Link href="/login" className="underline">
Sign in
</Link>
</p>
</CardContent>
</Card>
);
}
+96
View File
@@ -0,0 +1,96 @@
"use client";
import Link from "next/link";
import { useParams, useRouter } from "next/navigation";
import { useCallback, useEffect, useState } from "react";
import { api } from "@/lib/api/client";
import type { components } from "@/lib/api/schema";
import { Button } from "@/components/ui/button";
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
import { Input } from "@/components/ui/input";
type Person = components["schemas"]["PersonRead"];
export default function TreeDetailPage() {
const router = useRouter();
const params = useParams<{ id: string }>();
const treeId = params.id;
const [persons, setPersons] = useState<Person[]>([]);
const [given, setGiven] = useState("");
const [surname, setSurname] = useState("");
const [ready, setReady] = useState(false);
const load = useCallback(async () => {
const { data, response } = await api.GET("/api/v1/trees/{tree_id}/persons", {
params: { path: { tree_id: treeId } },
});
if (response.status === 401) {
router.push("/login");
return;
}
setPersons(data ?? []);
setReady(true);
}, [router, treeId]);
useEffect(() => {
load();
}, [load]);
async function addPerson(e: React.FormEvent) {
e.preventDefault();
if (!given.trim() && !surname.trim()) return;
const { error } = await api.POST("/api/v1/trees/{tree_id}/persons", {
params: { path: { tree_id: treeId } },
body: { given: given || null, surname: surname || null },
});
if (!error) {
setGiven("");
setSurname("");
load();
}
}
if (!ready) return <p className="text-neutral-500">Loading</p>;
return (
<div className="space-y-6">
<Link href="/trees" className="text-sm text-neutral-500 hover:underline">
All trees
</Link>
<Card>
<CardHeader>
<CardTitle className="text-base">Add a person</CardTitle>
</CardHeader>
<CardContent>
<form onSubmit={addPerson} className="flex gap-2">
<Input placeholder="Given name" value={given} onChange={(e) => setGiven(e.target.value)} />
<Input placeholder="Surname" value={surname} onChange={(e) => setSurname(e.target.value)} />
<Button type="submit">Add</Button>
</form>
</CardContent>
</Card>
<div>
<h2 className="mb-2 text-lg font-semibold">People</h2>
{persons.length === 0 ? (
<p className="text-neutral-500">No people yet.</p>
) : (
<ul className="space-y-2">
{persons.map((person) => (
<li key={person.id}>
<Card>
<CardContent className="p-4">
{person.primary_name ?? <span className="text-neutral-400">Unnamed</span>}
</CardContent>
</Card>
</li>
))}
</ul>
)}
</div>
</div>
);
}
+99
View File
@@ -0,0 +1,99 @@
"use client";
import Link from "next/link";
import { useRouter } from "next/navigation";
import { useCallback, useEffect, useState } from "react";
import { api } from "@/lib/api/client";
import type { components } from "@/lib/api/schema";
import { Button } from "@/components/ui/button";
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
import { Input } from "@/components/ui/input";
type Tree = components["schemas"]["TreeRead"];
export default function TreesPage() {
const router = useRouter();
const [trees, setTrees] = useState<Tree[]>([]);
const [name, setName] = useState("");
const [ready, setReady] = useState(false);
const load = useCallback(async () => {
const { data, response } = await api.GET("/api/v1/trees");
if (response.status === 401) {
router.push("/login");
return;
}
setTrees(data ?? []);
setReady(true);
}, [router]);
useEffect(() => {
load();
}, [load]);
async function createTree(e: React.FormEvent) {
e.preventDefault();
if (!name.trim()) return;
const { error } = await api.POST("/api/v1/trees", { body: { name } });
if (!error) {
setName("");
load();
}
}
async function logout() {
await api.POST("/api/v1/auth/logout");
router.push("/login");
}
if (!ready) return <p className="text-neutral-500">Loading</p>;
return (
<div className="space-y-6">
<div className="flex items-center justify-between">
<h1 className="text-2xl font-bold">Your trees</h1>
<Button variant="ghost" size="sm" onClick={logout}>
Sign out
</Button>
</div>
<Card>
<CardHeader>
<CardTitle className="text-base">New tree</CardTitle>
</CardHeader>
<CardContent>
<form onSubmit={createTree} className="flex gap-2">
<Input
placeholder="Family name"
value={name}
onChange={(e) => setName(e.target.value)}
/>
<Button type="submit">Create</Button>
</form>
</CardContent>
</Card>
{trees.length === 0 ? (
<p className="text-neutral-500">No trees yet create your first one above.</p>
) : (
<ul className="space-y-2">
{trees.map((tree) => (
<li key={tree.id}>
<Link href={`/trees/${tree.id}`}>
<Card className="transition-colors hover:bg-neutral-50">
<CardContent className="flex items-center justify-between p-4">
<span className="font-medium">{tree.name}</span>
<span className="text-xs uppercase tracking-wide text-neutral-400">
{tree.visibility}
</span>
</CardContent>
</Card>
</Link>
</li>
))}
</ul>
)}
</div>
);
}
+33
View File
@@ -0,0 +1,33 @@
import * as React from "react";
import { cva, type VariantProps } from "class-variance-authority";
import { cn } from "@/lib/utils";
const buttonVariants = cva(
"inline-flex items-center justify-center rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-neutral-400 disabled:pointer-events-none disabled:opacity-50",
{
variants: {
variant: {
default: "bg-neutral-900 text-white hover:bg-neutral-700",
outline: "border border-neutral-300 bg-transparent hover:bg-neutral-100",
ghost: "hover:bg-neutral-100",
},
size: {
default: "h-10 px-4 py-2",
sm: "h-9 px-3",
},
},
defaultVariants: { variant: "default", size: "default" },
},
);
export interface ButtonProps
extends React.ButtonHTMLAttributes<HTMLButtonElement>,
VariantProps<typeof buttonVariants> {}
export const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
({ className, variant, size, ...props }, ref) => (
<button ref={ref} className={cn(buttonVariants({ variant, size, className }))} {...props} />
),
);
Button.displayName = "Button";
+24
View File
@@ -0,0 +1,24 @@
import * as React from "react";
import { cn } from "@/lib/utils";
export function Card({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) {
return (
<div
className={cn("rounded-lg border border-neutral-200 bg-white/50 shadow-sm", className)}
{...props}
/>
);
}
export function CardHeader({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) {
return <div className={cn("flex flex-col gap-1 p-6", className)} {...props} />;
}
export function CardTitle({ className, ...props }: React.HTMLAttributes<HTMLHeadingElement>) {
return <h3 className={cn("text-lg font-semibold", className)} {...props} />;
}
export function CardContent({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) {
return <div className={cn("p-6 pt-0", className)} {...props} />;
}
+17
View File
@@ -0,0 +1,17 @@
import * as React from "react";
import { cn } from "@/lib/utils";
export const Input = React.forwardRef<HTMLInputElement, React.InputHTMLAttributes<HTMLInputElement>>(
({ className, ...props }, ref) => (
<input
ref={ref}
className={cn(
"flex h-10 w-full rounded-md border border-neutral-300 bg-transparent px-3 py-2 text-sm placeholder:text-neutral-400 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-neutral-400 disabled:opacity-50",
className,
)}
{...props}
/>
),
);
Input.displayName = "Input";
+11
View File
@@ -0,0 +1,11 @@
import * as React from "react";
import { cn } from "@/lib/utils";
export const Label = React.forwardRef<
HTMLLabelElement,
React.LabelHTMLAttributes<HTMLLabelElement>
>(({ className, ...props }, ref) => (
<label ref={ref} className={cn("text-sm font-medium", className)} {...props} />
));
Label.displayName = "Label";
+10
View File
@@ -0,0 +1,10 @@
import createClient from "openapi-fetch";
import type { paths } from "./schema";
// Same-origin in production (Caddy proxies /api/* to the backend). Override with
// NEXT_PUBLIC_API_BASE_URL for split local dev. credentials:"include" sends the
// HttpOnly session cookie the backend issues on login.
const baseUrl = process.env.NEXT_PUBLIC_API_BASE_URL ?? "";
export const api = createClient<paths>({ baseUrl, credentials: "include" });
+785
View File
@@ -0,0 +1,785 @@
/**
* This file was auto-generated by openapi-typescript.
* Do not make direct changes to the file.
*/
export interface paths {
"/health": {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
/** Health */
get: operations["health_health_get"];
put?: never;
post?: never;
delete?: never;
options?: never;
head?: never;
patch?: never;
trace?: never;
};
"/health/ready": {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
/** Ready */
get: operations["ready_health_ready_get"];
put?: never;
post?: never;
delete?: never;
options?: never;
head?: never;
patch?: never;
trace?: never;
};
"/api/v1/auth/register": {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
get?: never;
put?: never;
/** Register */
post: operations["register_api_v1_auth_register_post"];
delete?: never;
options?: never;
head?: never;
patch?: never;
trace?: never;
};
"/api/v1/auth/login": {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
get?: never;
put?: never;
/** Login */
post: operations["login_api_v1_auth_login_post"];
delete?: never;
options?: never;
head?: never;
patch?: never;
trace?: never;
};
"/api/v1/auth/logout": {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
get?: never;
put?: never;
/** Logout */
post: operations["logout_api_v1_auth_logout_post"];
delete?: never;
options?: never;
head?: never;
patch?: never;
trace?: never;
};
"/api/v1/auth/verify-email": {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
get?: never;
put?: never;
/** Verify Email */
post: operations["verify_email_api_v1_auth_verify_email_post"];
delete?: never;
options?: never;
head?: never;
patch?: never;
trace?: never;
};
"/api/v1/auth/request-password-reset": {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
get?: never;
put?: never;
/** Request Password Reset */
post: operations["request_password_reset_api_v1_auth_request_password_reset_post"];
delete?: never;
options?: never;
head?: never;
patch?: never;
trace?: never;
};
"/api/v1/auth/reset-password": {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
get?: never;
put?: never;
/** Reset Password */
post: operations["reset_password_api_v1_auth_reset_password_post"];
delete?: never;
options?: never;
head?: never;
patch?: never;
trace?: never;
};
"/api/v1/users/me": {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
/** Read Me */
get: operations["read_me_api_v1_users_me_get"];
put?: never;
post?: never;
delete?: never;
options?: never;
head?: never;
patch?: never;
trace?: never;
};
"/api/v1/trees": {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
/** List My Trees */
get: operations["list_my_trees_api_v1_trees_get"];
put?: never;
/** Create Tree */
post: operations["create_tree_api_v1_trees_post"];
delete?: never;
options?: never;
head?: never;
patch?: never;
trace?: never;
};
"/api/v1/trees/{tree_id}": {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
/** Get Tree */
get: operations["get_tree_api_v1_trees__tree_id__get"];
put?: never;
post?: never;
delete?: never;
options?: never;
head?: never;
patch?: never;
trace?: never;
};
"/api/v1/trees/{tree_id}/persons": {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
/** List Persons */
get: operations["list_persons_api_v1_trees__tree_id__persons_get"];
put?: never;
/** Create Person */
post: operations["create_person_api_v1_trees__tree_id__persons_post"];
delete?: never;
options?: never;
head?: never;
patch?: never;
trace?: never;
};
}
export type webhooks = Record<string, never>;
export interface components {
schemas: {
/** HTTPValidationError */
HTTPValidationError: {
/** Detail */
detail?: components["schemas"]["ValidationError"][];
};
/** LoginRequest */
LoginRequest: {
/** Email */
email: string;
/** Password */
password: string;
};
/** PasswordResetConfirm */
PasswordResetConfirm: {
/** Token */
token: string;
/** New Password */
new_password: string;
};
/** PasswordResetRequest */
PasswordResetRequest: {
/** Email */
email: string;
};
/** PersonCreate */
PersonCreate: {
/** Given */
given?: string | null;
/** Surname */
surname?: string | null;
/** Gender */
gender?: string | null;
/** Is Living */
is_living?: boolean | null;
/** @default inherit */
privacy?: components["schemas"]["PersonPrivacy"];
/** Notes */
notes?: string | null;
};
/**
* PersonPrivacy
* @description Per-person override of the tree's visibility (PRD US-041).
* @enum {string}
*/
PersonPrivacy: "inherit" | "private" | "public";
/** PersonRead */
PersonRead: {
/**
* Id
* Format: uuid
*/
id: string;
/**
* Tree Id
* Format: uuid
*/
tree_id: string;
/** Primary Name */
primary_name?: string | null;
/** Gender */
gender: string | null;
/** Is Living */
is_living: boolean | null;
privacy: components["schemas"]["PersonPrivacy"];
/**
* Created At
* Format: date-time
*/
created_at: string;
};
/** RegisterRequest */
RegisterRequest: {
/** Email */
email: string;
/** Password */
password: string;
/** Display Name */
display_name?: string | null;
};
/** SessionRead */
SessionRead: {
user: components["schemas"]["UserRead"];
/** Token */
token: string;
/**
* Expires At
* Format: date-time
*/
expires_at: string;
};
/** TokenRequest */
TokenRequest: {
/** Token */
token: string;
};
/** TreeCreate */
TreeCreate: {
/** Name */
name: string;
/** Description */
description?: string | null;
/** @default private */
visibility?: components["schemas"]["TreeVisibility"];
};
/** TreeRead */
TreeRead: {
/**
* Id
* Format: uuid
*/
id: string;
/** Name */
name: string;
/** Description */
description: string | null;
visibility: components["schemas"]["TreeVisibility"];
/**
* Owner Id
* Format: uuid
*/
owner_id: string;
/**
* Created At
* Format: date-time
*/
created_at: string;
};
/**
* TreeVisibility
* @enum {string}
*/
TreeVisibility: "public" | "unlisted" | "private";
/** UserRead */
UserRead: {
/**
* Id
* Format: uuid
*/
id: string;
/** Email */
email: string;
/** Display Name */
display_name: string | null;
/** Email Verified At */
email_verified_at: string | null;
/**
* Created At
* Format: date-time
*/
created_at: string;
};
/** ValidationError */
ValidationError: {
/** Location */
loc: (string | number)[];
/** Message */
msg: string;
/** Error Type */
type: string;
/** Input */
input?: unknown;
/** Context */
ctx?: Record<string, never>;
};
};
responses: never;
parameters: never;
requestBodies: never;
headers: never;
pathItems: never;
}
export type $defs = Record<string, never>;
export interface operations {
health_health_get: {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
requestBody?: never;
responses: {
/** @description Successful Response */
200: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": {
[key: string]: unknown;
};
};
};
};
};
ready_health_ready_get: {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
requestBody?: never;
responses: {
/** @description Successful Response */
200: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": {
[key: string]: unknown;
};
};
};
};
};
register_api_v1_auth_register_post: {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
requestBody: {
content: {
"application/json": components["schemas"]["RegisterRequest"];
};
};
responses: {
/** @description Successful Response */
201: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["SessionRead"];
};
};
/** @description Validation Error */
422: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["HTTPValidationError"];
};
};
};
};
login_api_v1_auth_login_post: {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
requestBody: {
content: {
"application/json": components["schemas"]["LoginRequest"];
};
};
responses: {
/** @description Successful Response */
200: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["SessionRead"];
};
};
/** @description Validation Error */
422: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["HTTPValidationError"];
};
};
};
};
logout_api_v1_auth_logout_post: {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
requestBody?: never;
responses: {
/** @description Successful Response */
204: {
headers: {
[name: string]: unknown;
};
content?: never;
};
};
};
verify_email_api_v1_auth_verify_email_post: {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
requestBody: {
content: {
"application/json": components["schemas"]["TokenRequest"];
};
};
responses: {
/** @description Successful Response */
204: {
headers: {
[name: string]: unknown;
};
content?: never;
};
/** @description Validation Error */
422: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["HTTPValidationError"];
};
};
};
};
request_password_reset_api_v1_auth_request_password_reset_post: {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
requestBody: {
content: {
"application/json": components["schemas"]["PasswordResetRequest"];
};
};
responses: {
/** @description Successful Response */
202: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": {
[key: string]: unknown;
};
};
};
/** @description Validation Error */
422: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["HTTPValidationError"];
};
};
};
};
reset_password_api_v1_auth_reset_password_post: {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
requestBody: {
content: {
"application/json": components["schemas"]["PasswordResetConfirm"];
};
};
responses: {
/** @description Successful Response */
204: {
headers: {
[name: string]: unknown;
};
content?: never;
};
/** @description Validation Error */
422: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["HTTPValidationError"];
};
};
};
};
read_me_api_v1_users_me_get: {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
requestBody?: never;
responses: {
/** @description Successful Response */
200: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["UserRead"];
};
};
};
};
list_my_trees_api_v1_trees_get: {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
requestBody?: never;
responses: {
/** @description Successful Response */
200: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["TreeRead"][];
};
};
};
};
create_tree_api_v1_trees_post: {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
requestBody: {
content: {
"application/json": components["schemas"]["TreeCreate"];
};
};
responses: {
/** @description Successful Response */
201: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["TreeRead"];
};
};
/** @description Validation Error */
422: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["HTTPValidationError"];
};
};
};
};
get_tree_api_v1_trees__tree_id__get: {
parameters: {
query?: never;
header?: never;
path: {
tree_id: string;
};
cookie?: never;
};
requestBody?: never;
responses: {
/** @description Successful Response */
200: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["TreeRead"];
};
};
/** @description Validation Error */
422: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["HTTPValidationError"];
};
};
};
};
list_persons_api_v1_trees__tree_id__persons_get: {
parameters: {
query?: never;
header?: never;
path: {
tree_id: string;
};
cookie?: never;
};
requestBody?: never;
responses: {
/** @description Successful Response */
200: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["PersonRead"][];
};
};
/** @description Validation Error */
422: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["HTTPValidationError"];
};
};
};
};
create_person_api_v1_trees__tree_id__persons_post: {
parameters: {
query?: never;
header?: never;
path: {
tree_id: string;
};
cookie?: never;
};
requestBody: {
content: {
"application/json": components["schemas"]["PersonCreate"];
};
};
responses: {
/** @description Successful Response */
201: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["PersonRead"];
};
};
/** @description Validation Error */
422: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["HTTPValidationError"];
};
};
};
};
}
+6
View File
@@ -0,0 +1,6 @@
import { clsx, type ClassValue } from "clsx";
import { twMerge } from "tailwind-merge";
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs));
}
+7
View File
@@ -0,0 +1,7 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
// Standalone output keeps the production container small.
output: "standalone",
};
export default nextConfig;
+936
View File
@@ -0,0 +1,936 @@
{
"openapi": "3.1.0",
"info": {
"title": "Provenance",
"description": "Provenance API \u2014 family and land provenance.",
"version": "0.0.0"
},
"paths": {
"/health": {
"get": {
"tags": [
"health"
],
"summary": "Health",
"operationId": "health_health_get",
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
"additionalProperties": true,
"type": "object",
"title": "Response Health Health Get"
}
}
}
}
}
}
},
"/health/ready": {
"get": {
"tags": [
"health"
],
"summary": "Ready",
"operationId": "ready_health_ready_get",
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
"additionalProperties": true,
"type": "object",
"title": "Response Ready Health Ready Get"
}
}
}
}
}
}
},
"/api/v1/auth/register": {
"post": {
"tags": [
"auth"
],
"summary": "Register",
"operationId": "register_api_v1_auth_register_post",
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/RegisterRequest"
}
}
},
"required": true
},
"responses": {
"201": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/SessionRead"
}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
}
}
},
"/api/v1/auth/login": {
"post": {
"tags": [
"auth"
],
"summary": "Login",
"operationId": "login_api_v1_auth_login_post",
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/LoginRequest"
}
}
},
"required": true
},
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/SessionRead"
}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
}
}
},
"/api/v1/auth/logout": {
"post": {
"tags": [
"auth"
],
"summary": "Logout",
"operationId": "logout_api_v1_auth_logout_post",
"responses": {
"204": {
"description": "Successful Response"
}
}
}
},
"/api/v1/auth/verify-email": {
"post": {
"tags": [
"auth"
],
"summary": "Verify Email",
"operationId": "verify_email_api_v1_auth_verify_email_post",
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/TokenRequest"
}
}
},
"required": true
},
"responses": {
"204": {
"description": "Successful Response"
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
}
}
},
"/api/v1/auth/request-password-reset": {
"post": {
"tags": [
"auth"
],
"summary": "Request Password Reset",
"operationId": "request_password_reset_api_v1_auth_request_password_reset_post",
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/PasswordResetRequest"
}
}
},
"required": true
},
"responses": {
"202": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
"additionalProperties": true,
"type": "object",
"title": "Response Request Password Reset Api V1 Auth Request Password Reset Post"
}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
}
}
},
"/api/v1/auth/reset-password": {
"post": {
"tags": [
"auth"
],
"summary": "Reset Password",
"operationId": "reset_password_api_v1_auth_reset_password_post",
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/PasswordResetConfirm"
}
}
},
"required": true
},
"responses": {
"204": {
"description": "Successful Response"
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
}
}
},
"/api/v1/users/me": {
"get": {
"tags": [
"users"
],
"summary": "Read Me",
"operationId": "read_me_api_v1_users_me_get",
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/UserRead"
}
}
}
}
}
}
},
"/api/v1/trees": {
"get": {
"tags": [
"trees"
],
"summary": "List My Trees",
"operationId": "list_my_trees_api_v1_trees_get",
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
"items": {
"$ref": "#/components/schemas/TreeRead"
},
"type": "array",
"title": "Response List My Trees Api V1 Trees Get"
}
}
}
}
}
},
"post": {
"tags": [
"trees"
],
"summary": "Create Tree",
"operationId": "create_tree_api_v1_trees_post",
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/TreeCreate"
}
}
},
"required": true
},
"responses": {
"201": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/TreeRead"
}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
}
}
},
"/api/v1/trees/{tree_id}": {
"get": {
"tags": [
"trees"
],
"summary": "Get Tree",
"operationId": "get_tree_api_v1_trees__tree_id__get",
"parameters": [
{
"name": "tree_id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid",
"title": "Tree Id"
}
}
],
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/TreeRead"
}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
}
}
},
"/api/v1/trees/{tree_id}/persons": {
"post": {
"tags": [
"persons"
],
"summary": "Create Person",
"operationId": "create_person_api_v1_trees__tree_id__persons_post",
"parameters": [
{
"name": "tree_id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid",
"title": "Tree Id"
}
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/PersonCreate"
}
}
}
},
"responses": {
"201": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/PersonRead"
}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
}
},
"get": {
"tags": [
"persons"
],
"summary": "List Persons",
"operationId": "list_persons_api_v1_trees__tree_id__persons_get",
"parameters": [
{
"name": "tree_id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid",
"title": "Tree Id"
}
}
],
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/PersonRead"
},
"title": "Response List Persons Api V1 Trees Tree Id Persons Get"
}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
}
}
}
},
"components": {
"schemas": {
"HTTPValidationError": {
"properties": {
"detail": {
"items": {
"$ref": "#/components/schemas/ValidationError"
},
"type": "array",
"title": "Detail"
}
},
"type": "object",
"title": "HTTPValidationError"
},
"LoginRequest": {
"properties": {
"email": {
"type": "string",
"title": "Email"
},
"password": {
"type": "string",
"title": "Password"
}
},
"type": "object",
"required": [
"email",
"password"
],
"title": "LoginRequest"
},
"PasswordResetConfirm": {
"properties": {
"token": {
"type": "string",
"title": "Token"
},
"new_password": {
"type": "string",
"minLength": 8,
"title": "New Password"
}
},
"type": "object",
"required": [
"token",
"new_password"
],
"title": "PasswordResetConfirm"
},
"PasswordResetRequest": {
"properties": {
"email": {
"type": "string",
"title": "Email"
}
},
"type": "object",
"required": [
"email"
],
"title": "PasswordResetRequest"
},
"PersonCreate": {
"properties": {
"given": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Given"
},
"surname": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Surname"
},
"gender": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Gender"
},
"is_living": {
"anyOf": [
{
"type": "boolean"
},
{
"type": "null"
}
],
"title": "Is Living"
},
"privacy": {
"$ref": "#/components/schemas/PersonPrivacy",
"default": "inherit"
},
"notes": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Notes"
}
},
"type": "object",
"title": "PersonCreate"
},
"PersonPrivacy": {
"type": "string",
"enum": [
"inherit",
"private",
"public"
],
"title": "PersonPrivacy",
"description": "Per-person override of the tree's visibility (PRD US-041)."
},
"PersonRead": {
"properties": {
"id": {
"type": "string",
"format": "uuid",
"title": "Id"
},
"tree_id": {
"type": "string",
"format": "uuid",
"title": "Tree Id"
},
"primary_name": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Primary Name"
},
"gender": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Gender"
},
"is_living": {
"anyOf": [
{
"type": "boolean"
},
{
"type": "null"
}
],
"title": "Is Living"
},
"privacy": {
"$ref": "#/components/schemas/PersonPrivacy"
},
"created_at": {
"type": "string",
"format": "date-time",
"title": "Created At"
}
},
"type": "object",
"required": [
"id",
"tree_id",
"gender",
"is_living",
"privacy",
"created_at"
],
"title": "PersonRead"
},
"RegisterRequest": {
"properties": {
"email": {
"type": "string",
"title": "Email"
},
"password": {
"type": "string",
"minLength": 8,
"title": "Password"
},
"display_name": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Display Name"
}
},
"type": "object",
"required": [
"email",
"password"
],
"title": "RegisterRequest"
},
"SessionRead": {
"properties": {
"user": {
"$ref": "#/components/schemas/UserRead"
},
"token": {
"type": "string",
"title": "Token"
},
"expires_at": {
"type": "string",
"format": "date-time",
"title": "Expires At"
}
},
"type": "object",
"required": [
"user",
"token",
"expires_at"
],
"title": "SessionRead"
},
"TokenRequest": {
"properties": {
"token": {
"type": "string",
"title": "Token"
}
},
"type": "object",
"required": [
"token"
],
"title": "TokenRequest"
},
"TreeCreate": {
"properties": {
"name": {
"type": "string",
"title": "Name"
},
"description": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Description"
},
"visibility": {
"$ref": "#/components/schemas/TreeVisibility",
"default": "private"
}
},
"type": "object",
"required": [
"name"
],
"title": "TreeCreate"
},
"TreeRead": {
"properties": {
"id": {
"type": "string",
"format": "uuid",
"title": "Id"
},
"name": {
"type": "string",
"title": "Name"
},
"description": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Description"
},
"visibility": {
"$ref": "#/components/schemas/TreeVisibility"
},
"owner_id": {
"type": "string",
"format": "uuid",
"title": "Owner Id"
},
"created_at": {
"type": "string",
"format": "date-time",
"title": "Created At"
}
},
"type": "object",
"required": [
"id",
"name",
"description",
"visibility",
"owner_id",
"created_at"
],
"title": "TreeRead"
},
"TreeVisibility": {
"type": "string",
"enum": [
"public",
"unlisted",
"private"
],
"title": "TreeVisibility"
},
"UserRead": {
"properties": {
"id": {
"type": "string",
"format": "uuid",
"title": "Id"
},
"email": {
"type": "string",
"title": "Email"
},
"display_name": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Display Name"
},
"email_verified_at": {
"anyOf": [
{
"type": "string",
"format": "date-time"
},
{
"type": "null"
}
],
"title": "Email Verified At"
},
"created_at": {
"type": "string",
"format": "date-time",
"title": "Created At"
}
},
"type": "object",
"required": [
"id",
"email",
"display_name",
"email_verified_at",
"created_at"
],
"title": "UserRead"
},
"ValidationError": {
"properties": {
"loc": {
"items": {
"anyOf": [
{
"type": "string"
},
{
"type": "integer"
}
]
},
"type": "array",
"title": "Location"
},
"msg": {
"type": "string",
"title": "Message"
},
"type": {
"type": "string",
"title": "Error Type"
},
"input": {
"title": "Input"
},
"ctx": {
"type": "object",
"title": "Context"
}
},
"type": "object",
"required": [
"loc",
"msg",
"type"
],
"title": "ValidationError"
}
}
}
}
+1926
View File
File diff suppressed because it is too large Load Diff
+32
View File
@@ -0,0 +1,32 @@
{
"name": "provenance-frontend",
"version": "0.0.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint",
"gen:api": "openapi-typescript ./openapi.json -o ./lib/api/schema.d.ts --default-non-nullable false"
},
"dependencies": {
"next": "^15.1.0",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"openapi-fetch": "^0.13.0",
"class-variance-authority": "^0.7.1",
"clsx": "^2.1.1",
"tailwind-merge": "^2.6.0",
"lucide-react": "^0.469.0"
},
"devDependencies": {
"typescript": "^5.7.0",
"@types/node": "^22.10.0",
"@types/react": "^19.0.0",
"@types/react-dom": "^19.0.0",
"tailwindcss": "^4.0.0",
"@tailwindcss/postcss": "^4.0.0",
"postcss": "^8.4.49",
"openapi-typescript": "^7.5.0"
}
}
+7
View File
@@ -0,0 +1,7 @@
const config = {
plugins: {
"@tailwindcss/postcss": {},
},
};
export default config;
View File
+21
View File
@@ -0,0 +1,21 @@
{
"compilerOptions": {
"target": "ES2022",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "bundler",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"incremental": true,
"plugins": [{ "name": "next" }],
"paths": { "@/*": ["./*"] }
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
"exclude": ["node_modules"]
}