Initial public release

Aurum — a self-hosted personal finance operating system: cash flow,
net worth tracking, budgets, goals, recurring payments, reports,
proactive alerts, and a compound-interest returns calculator, all
bilingual (RU/EN) and mobile-first. Ships as a three-container Docker
Compose stack (Postgres + FastAPI + nginx-served React frontend).

See README.md for setup and CONTRIBUTING.md for development.
This commit is contained in:
ZProger
2026-08-16 18:39:52 +03:00
commit fe9b079c12
199 changed files with 14410 additions and 0 deletions

View File

@@ -0,0 +1,93 @@
import { useEffect, useState } from "react";
import { Dialog } from "@/components/ui/Dialog";
import { Button } from "@/components/ui/Button";
import { Input, Label, Select } from "@/components/ui/Input";
import { useCreateAccount, useUpdateAccount } from "@/hooks/useAccounts";
import { useTranslation, type TranslationKey } from "@/lib/i18n";
import type { Account, AccountType } from "@/types";
interface AccountFormModalProps {
open: boolean;
onClose: () => void;
account?: Account | null;
}
const ACCOUNT_TYPES: AccountType[] = ["checking", "savings", "credit_card", "cash", "investment", "other"];
const EMPTY_FORM = { name: "", type: "checking" as AccountType };
export function AccountFormModal({ open, onClose, account }: AccountFormModalProps) {
const { t } = useTranslation();
const createAccount = useCreateAccount();
const updateAccount = useUpdateAccount();
const [form, setForm] = useState(EMPTY_FORM);
const [error, setError] = useState<string | null>(null);
useEffect(() => {
if (!open) return;
setForm(account ? { name: account.name, type: account.type } : EMPTY_FORM);
setError(null);
}, [open, account]);
const isSaving = createAccount.isPending || updateAccount.isPending;
async function handleSubmit(event: React.FormEvent) {
event.preventDefault();
setError(null);
try {
if (account) {
await updateAccount.mutateAsync({ id: account.id, input: form });
} else {
await createAccount.mutateAsync(form);
}
onClose();
} catch {
setError(t("account.form.saveError"));
}
}
return (
<Dialog open={open} onClose={onClose} title={account ? t("account.form.editTitle") : t("account.form.newTitle")}>
<form onSubmit={handleSubmit} className="space-y-3">
<div>
<Label htmlFor="account-name">{t("account.form.nameLabel")}</Label>
<Input
id="account-name"
required
placeholder={t("account.form.namePlaceholder")}
value={form.name}
onChange={(event) => setForm((prev) => ({ ...prev, name: event.target.value }))}
/>
</div>
<div>
<Label htmlFor="account-type">{t("account.form.typeLabel")}</Label>
<Select
id="account-type"
value={form.type}
onChange={(event) => setForm((prev) => ({ ...prev, type: event.target.value as AccountType }))}
>
{ACCOUNT_TYPES.map((type) => (
<option key={type} value={type}>
{t(`account.type.${type}` as TranslationKey)}
</option>
))}
</Select>
</div>
{error && <p className="text-sm text-danger">{error}</p>}
<div className="flex justify-end gap-2 pt-2">
<Button type="button" variant="ghost" onClick={onClose}>
{t("common.cancel")}
</Button>
<Button type="submit" disabled={isSaving}>
{isSaving ? t("common.saving") : t("common.save")}
</Button>
</div>
</form>
</Dialog>
);
}

View File

@@ -0,0 +1,90 @@
import { Archive, ArchiveRestore, Banknote, CreditCard, Package, Pencil, PiggyBank, TrendingUp, Trash2, Wallet, type LucideIcon } from "lucide-react";
import { formatCurrency } from "@/lib/format";
import { useTranslation, type TranslationKey } from "@/lib/i18n";
import type { Account, AccountType, AccountWithBalance } from "@/types";
interface AccountListProps {
items: AccountWithBalance[];
onEdit: (account: Account) => void;
onToggleArchived: (account: AccountWithBalance) => void;
onDelete: (account: AccountWithBalance) => void;
}
const TYPE_ICONS: Record<AccountType, LucideIcon> = {
checking: Wallet,
savings: PiggyBank,
credit_card: CreditCard,
cash: Banknote,
investment: TrendingUp,
other: Package,
};
export function AccountList({ items, onEdit, onToggleArchived, onDelete }: AccountListProps) {
const { t } = useTranslation();
if (items.length === 0) {
return <p className="py-10 text-center text-sm text-text-muted">{t("account.empty")}</p>;
}
return (
<ul className="divide-y divide-gridline">
{items.map((account) => {
const Icon = TYPE_ICONS[account.type];
const balance = Number(account.balance);
return (
<li key={account.id} className={`flex items-center gap-3 py-3 ${account.is_archived ? "opacity-50" : ""}`}>
<span className="flex h-9 w-9 shrink-0 items-center justify-center rounded-full bg-surface-2">
<Icon size={16} className="text-text-secondary" />
</span>
<span className="min-w-0 flex-1">
<span className="flex items-center gap-1.5 truncate text-sm font-medium text-text-primary">
{account.name}
{account.is_archived && (
<span className="shrink-0 rounded bg-surface-2 px-1 py-0.5 text-[10px] leading-none text-text-muted">
{t("account.archivedBadge")}
</span>
)}
</span>
<span className="block truncate text-xs text-text-muted">
{t(`account.type.${account.type}` as TranslationKey)}
</span>
</span>
<span
className="shrink-0 text-sm font-medium tabular-nums"
style={{ color: balance < 0 ? "var(--danger)" : "var(--text-primary)" }}
>
{formatCurrency(balance)}
</span>
<span className="flex shrink-0 gap-1">
<button
type="button"
aria-label={account.is_archived ? t("account.unarchiveLabel") : t("account.archiveLabel")}
onClick={() => onToggleArchived(account)}
className="rounded-md p-1.5 text-text-muted hover:bg-surface-2 hover:text-text-primary"
>
{account.is_archived ? <ArchiveRestore size={15} /> : <Archive size={15} />}
</button>
<button
type="button"
aria-label={t("common.edit")}
onClick={() => onEdit(account)}
className="rounded-md p-1.5 text-text-muted hover:bg-surface-2 hover:text-text-primary"
>
<Pencil size={15} />
</button>
<button
type="button"
aria-label={t("common.delete")}
onClick={() => onDelete(account)}
className="rounded-md p-1.5 text-text-muted hover:bg-surface-2 hover:text-danger"
>
<Trash2 size={15} />
</button>
</span>
</li>
);
})}
</ul>
);
}