chore: scaffold Next.js + Prisma schema + dev MariaDB

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
YugonitoandClaude Opus 5.5 committed 2026-10-27 17:57:05 +01:00
1 parent c4cee91ed7
commit 8d41c2fffe
27 files changed
+9616

No files matched your search

+4
View File
@@ -0,0 +1,4 @@
# Développement local (voir docker-compose.dev.yml)
DATABASE_URL="mysql://root:dev@localhost:3307/finances"
TEST_DATABASE_URL="mysql://root:dev@localhost:3307/finances_test"
SESSION_SECRET="change-me-to-32+chars-random-string-xxxxxxxx"
+3
View File
@@ -4,3 +4,6 @@ node_modules/
.env
backups/
*.log
next-env.d.ts
*.tsbuildinfo
/dist
+14
View File
@@ -0,0 +1,14 @@
# Base MariaDB locale pour le développement et les tests (port 3307).
services:
db:
image: mariadb:latest
environment:
MARIADB_ROOT_PASSWORD: dev
MARIADB_DATABASE: finances
ports:
- "3307:3306"
volumes:
- ./docker/dev-init.sql:/docker-entrypoint-initdb.d/dev-init.sql:ro
- dev_db:/var/lib/mysql
volumes:
dev_db:
+1
View File
@@ -0,0 +1 @@
CREATE DATABASE IF NOT EXISTS finances_test;
+25
View File
@@ -0,0 +1,25 @@
import { dirname } from "path";
import { fileURLToPath } from "url";
import { FlatCompat } from "@eslint/eslintrc";
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
});
const eslintConfig = [
...compat.extends("next/core-web-vitals", "next/typescript"),
{
ignores: [
"node_modules/**",
".next/**",
"out/**",
"build/**",
"next-env.d.ts",
],
},
];
export default eslintConfig;
+7
View File
@@ -0,0 +1,7 @@
import type { NextConfig } from "next";
const nextConfig: NextConfig = {
output: "standalone",
};
export default nextConfig;
+8735
View File
File diff suppressed because it is too large. Load diff
+42
View File
@@ -0,0 +1,42 @@
{
"name": "hcl-finances-manager",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "eslint",
"test": "vitest run",
"db:migrate": "prisma migrate dev",
"db:seed": "tsx prisma/seed.ts"
},
"dependencies": {
"@prisma/client": "^6.19.3",
"bcryptjs": "^3.0.3",
"iron-session": "^9.0.1",
"next": "15.5.28",
"prisma": "^6.19.3",
"react": "19.1.0",
"react-dom": "19.1.0",
"recharts": "^3.10.1",
"zod": "^4.6.7"
},
"devDependencies": {
"@eslint/eslintrc": "^3",
"@tailwindcss/postcss": "^4",
"@types/bcryptjs": "^2.4.6",
"@types/node": "^24.19.2",
"@types/react": "^19",
"@types/react-dom": "^19",
"eslint": "^9",
"eslint-config-next": "15.5.28",
"tailwindcss": "^4",
"tsx": "^4.23.15",
"typescript": "^5",
"vitest": "^5.0.5"
},
"prisma": {
"seed": "tsx prisma/seed.ts"
}
}
+5
View File
@@ -0,0 +1,5 @@
const config = {
plugins: ["@tailwindcss/postcss"],
};
export default config;
@@ -0,0 +1,210 @@
-- CreateTable
CREATE TABLE `User` (
`id` VARCHAR(191) NOT NULL,
`firstName` VARCHAR(191) NOT NULL,
`login` VARCHAR(191) NOT NULL,
`passwordHash` VARCHAR(191) NOT NULL,
`color` VARCHAR(191) NOT NULL,
`createdAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
UNIQUE INDEX `User_login_key`(`login`),
PRIMARY KEY (`id`)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
-- CreateTable
CREATE TABLE `Setting` (
`id` INTEGER NOT NULL DEFAULT 1,
`defaultSplit` JSON NOT NULL,
PRIMARY KEY (`id`)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
-- CreateTable
CREATE TABLE `Category` (
`id` VARCHAR(191) NOT NULL,
`name` VARCHAR(191) NOT NULL,
`emoji` VARCHAR(191) NOT NULL,
`kind` ENUM('INCOME', 'EXPENSE') NOT NULL,
`archived` BOOLEAN NOT NULL DEFAULT false,
`sortOrder` INTEGER NOT NULL DEFAULT 0,
UNIQUE INDEX `Category_name_kind_key`(`name`, `kind`),
PRIMARY KEY (`id`)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
-- CreateTable
CREATE TABLE `Operation` (
`id` VARCHAR(191) NOT NULL,
`kind` ENUM('INCOME', 'EXPENSE') NOT NULL,
`amount` DECIMAL(12, 2) NOT NULL,
`date` DATE NOT NULL,
`label` VARCHAR(191) NOT NULL,
`note` TEXT NULL,
`categoryId` VARCHAR(191) NOT NULL,
`accountUserId` VARCHAR(191) NOT NULL,
`status` ENUM('PLANNED', 'ACTUAL', 'SKIPPED') NOT NULL,
`recurringId` VARCHAR(191) NULL,
`occurrenceDate` DATE NULL,
`allocatedToRecurringId` VARCHAR(191) NULL,
`allocatedToOperationId` VARCHAR(191) NULL,
`allocationMode` ENUM('REDUCE_SHARED', 'BENEFICIARY_ONLY', 'CUSTOM') NULL,
`createdById` VARCHAR(191) NOT NULL,
`createdAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
`updatedAt` DATETIME(3) NOT NULL,
INDEX `Operation_date_idx`(`date`),
UNIQUE INDEX `Operation_recurringId_occurrenceDate_key`(`recurringId`, `occurrenceDate`),
PRIMARY KEY (`id`)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
-- CreateTable
CREATE TABLE `OperationSplit` (
`operationId` VARCHAR(191) NOT NULL,
`userId` VARCHAR(191) NOT NULL,
`basisPoints` INTEGER NOT NULL,
PRIMARY KEY (`operationId`, `userId`)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
-- CreateTable
CREATE TABLE `Recurring` (
`id` VARCHAR(191) NOT NULL,
`kind` ENUM('INCOME', 'EXPENSE') NOT NULL,
`amount` DECIMAL(12, 2) NOT NULL,
`label` VARCHAR(191) NOT NULL,
`categoryId` VARCHAR(191) NOT NULL,
`accountUserId` VARCHAR(191) NOT NULL,
`frequency` ENUM('MONTHLY', 'QUARTERLY', 'YEARLY') NOT NULL,
`dayOfMonth` INTEGER NOT NULL,
`startDate` DATE NOT NULL,
`endDate` DATE NULL,
`paused` BOOLEAN NOT NULL DEFAULT false,
`loanId` VARCHAR(191) NULL,
`allocatedToRecurringId` VARCHAR(191) NULL,
`allocationMode` ENUM('REDUCE_SHARED', 'BENEFICIARY_ONLY', 'CUSTOM') NULL,
`createdAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
UNIQUE INDEX `Recurring_loanId_key`(`loanId`),
PRIMARY KEY (`id`)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
-- CreateTable
CREATE TABLE `RecurringSplit` (
`recurringId` VARCHAR(191) NOT NULL,
`userId` VARCHAR(191) NOT NULL,
`basisPoints` INTEGER NOT NULL,
PRIMARY KEY (`recurringId`, `userId`)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
-- CreateTable
CREATE TABLE `Settlement` (
`id` VARCHAR(191) NOT NULL,
`fromUserId` VARCHAR(191) NOT NULL,
`toUserId` VARCHAR(191) NOT NULL,
`amount` DECIMAL(12, 2) NOT NULL,
`date` DATE NOT NULL,
`note` VARCHAR(191) NULL,
`createdAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
PRIMARY KEY (`id`)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
-- CreateTable
CREATE TABLE `Budget` (
`id` VARCHAR(191) NOT NULL,
`categoryId` VARCHAR(191) NOT NULL,
`monthlyAmount` DECIMAL(12, 2) NOT NULL,
`startMonth` CHAR(7) NOT NULL,
`endMonth` CHAR(7) NULL,
PRIMARY KEY (`id`)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
-- CreateTable
CREATE TABLE `Loan` (
`id` VARCHAR(191) NOT NULL,
`name` VARCHAR(191) NOT NULL,
`lender` VARCHAR(191) NULL,
`principal` DECIMAL(12, 2) NOT NULL,
`annualRate` DECIMAL(6, 3) NOT NULL,
`durationMonths` INTEGER NOT NULL,
`startDate` DATE NOT NULL,
`insuranceMonthly` DECIMAL(12, 2) NOT NULL DEFAULT 0,
`accountUserId` VARCHAR(191) NOT NULL,
`paymentOverride` DECIMAL(12, 2) NULL,
`referenceDate` DATE NULL,
`referenceRemainingCapital` DECIMAL(12, 2) NULL,
`createdAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
PRIMARY KEY (`id`)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
-- CreateTable
CREATE TABLE `LoanSplit` (
`loanId` VARCHAR(191) NOT NULL,
`userId` VARCHAR(191) NOT NULL,
`basisPoints` INTEGER NOT NULL,
PRIMARY KEY (`loanId`, `userId`)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
-- AddForeignKey
ALTER TABLE `Operation` ADD CONSTRAINT `Operation_categoryId_fkey` FOREIGN KEY (`categoryId`) REFERENCES `Category`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE `Operation` ADD CONSTRAINT `Operation_accountUserId_fkey` FOREIGN KEY (`accountUserId`) REFERENCES `User`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE `Operation` ADD CONSTRAINT `Operation_recurringId_fkey` FOREIGN KEY (`recurringId`) REFERENCES `Recurring`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE `Operation` ADD CONSTRAINT `Operation_allocatedToRecurringId_fkey` FOREIGN KEY (`allocatedToRecurringId`) REFERENCES `Recurring`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE `Operation` ADD CONSTRAINT `Operation_allocatedToOperationId_fkey` FOREIGN KEY (`allocatedToOperationId`) REFERENCES `Operation`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION;
-- AddForeignKey
ALTER TABLE `Operation` ADD CONSTRAINT `Operation_createdById_fkey` FOREIGN KEY (`createdById`) REFERENCES `User`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE `OperationSplit` ADD CONSTRAINT `OperationSplit_operationId_fkey` FOREIGN KEY (`operationId`) REFERENCES `Operation`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE `OperationSplit` ADD CONSTRAINT `OperationSplit_userId_fkey` FOREIGN KEY (`userId`) REFERENCES `User`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE `Recurring` ADD CONSTRAINT `Recurring_categoryId_fkey` FOREIGN KEY (`categoryId`) REFERENCES `Category`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE `Recurring` ADD CONSTRAINT `Recurring_accountUserId_fkey` FOREIGN KEY (`accountUserId`) REFERENCES `User`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE `Recurring` ADD CONSTRAINT `Recurring_loanId_fkey` FOREIGN KEY (`loanId`) REFERENCES `Loan`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE `Recurring` ADD CONSTRAINT `Recurring_allocatedToRecurringId_fkey` FOREIGN KEY (`allocatedToRecurringId`) REFERENCES `Recurring`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION;
-- AddForeignKey
ALTER TABLE `RecurringSplit` ADD CONSTRAINT `RecurringSplit_recurringId_fkey` FOREIGN KEY (`recurringId`) REFERENCES `Recurring`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE `RecurringSplit` ADD CONSTRAINT `RecurringSplit_userId_fkey` FOREIGN KEY (`userId`) REFERENCES `User`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE `Settlement` ADD CONSTRAINT `Settlement_fromUserId_fkey` FOREIGN KEY (`fromUserId`) REFERENCES `User`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE `Settlement` ADD CONSTRAINT `Settlement_toUserId_fkey` FOREIGN KEY (`toUserId`) REFERENCES `User`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE `Budget` ADD CONSTRAINT `Budget_categoryId_fkey` FOREIGN KEY (`categoryId`) REFERENCES `Category`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE `Loan` ADD CONSTRAINT `Loan_accountUserId_fkey` FOREIGN KEY (`accountUserId`) REFERENCES `User`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE `LoanSplit` ADD CONSTRAINT `LoanSplit_loanId_fkey` FOREIGN KEY (`loanId`) REFERENCES `Loan`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE `LoanSplit` ADD CONSTRAINT `LoanSplit_userId_fkey` FOREIGN KEY (`userId`) REFERENCES `User`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
+3
View File
@@ -0,0 +1,3 @@
# Please do not edit this file manually
# It should be added in your version-control system (e.g., Git)
provider = "mysql"
+201
View File
@@ -0,0 +1,201 @@
generator client {
provider = "prisma-client-js"
binaryTargets = ["native", "linux-musl-openssl-3.0.x"]
}
datasource db {
provider = "mysql"
url = env("DATABASE_URL")
}
enum OpKind {
INCOME
EXPENSE
}
enum OpStatus {
PLANNED
ACTUAL
SKIPPED
}
enum AllocationMode {
REDUCE_SHARED
BENEFICIARY_ONLY
CUSTOM
}
enum Frequency {
MONTHLY
QUARTERLY
YEARLY
}
model User {
id String @id @default(cuid())
firstName String
login String @unique
passwordHash String
color String
createdAt DateTime @default(now())
accountOperations Operation[] @relation("OperationAccount")
createdOperations Operation[] @relation("OperationCreator")
operationSplits OperationSplit[]
recurrings Recurring[]
recurringSplits RecurringSplit[]
settlementsFrom Settlement[] @relation("SettlementFrom")
settlementsTo Settlement[] @relation("SettlementTo")
loans Loan[]
loanSplits LoanSplit[]
}
model Setting {
id Int @id @default(1)
defaultSplit Json
}
model Category {
id String @id @default(cuid())
name String
emoji String
kind OpKind
archived Boolean @default(false)
sortOrder Int @default(0)
operations Operation[]
recurrings Recurring[]
budgets Budget[]
@@unique([name, kind])
}
model Operation {
id String @id @default(cuid())
kind OpKind
amount Decimal @db.Decimal(12, 2)
date DateTime @db.Date
label String
note String? @db.Text
categoryId String
category Category @relation(fields: [categoryId], references: [id], onDelete: Restrict)
accountUserId String
accountUser User @relation("OperationAccount", fields: [accountUserId], references: [id])
status OpStatus
recurringId String?
recurring Recurring? @relation("RecurringOccurrences", fields: [recurringId], references: [id], onDelete: SetNull)
occurrenceDate DateTime? @db.Date
allocatedToRecurringId String?
allocatedToRecurring Recurring? @relation("OperationAllocatedToRecurring", fields: [allocatedToRecurringId], references: [id], onDelete: SetNull)
allocatedToOperationId String?
allocatedToOperation Operation? @relation("OperationAllocatedToOperation", fields: [allocatedToOperationId], references: [id], onDelete: SetNull, onUpdate: NoAction)
allocatedFrom Operation[] @relation("OperationAllocatedToOperation")
allocationMode AllocationMode?
splits OperationSplit[]
createdById String
createdBy User @relation("OperationCreator", fields: [createdById], references: [id])
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@unique([recurringId, occurrenceDate])
@@index([date])
}
model OperationSplit {
operationId String
operation Operation @relation(fields: [operationId], references: [id], onDelete: Cascade)
userId String
user User @relation(fields: [userId], references: [id])
basisPoints Int
@@id([operationId, userId])
}
model Recurring {
id String @id @default(cuid())
kind OpKind
amount Decimal @db.Decimal(12, 2)
label String
categoryId String
category Category @relation(fields: [categoryId], references: [id], onDelete: Restrict)
accountUserId String
accountUser User @relation(fields: [accountUserId], references: [id])
frequency Frequency
dayOfMonth Int
startDate DateTime @db.Date
endDate DateTime? @db.Date
paused Boolean @default(false)
loanId String? @unique
loan Loan? @relation(fields: [loanId], references: [id], onDelete: Cascade)
allocatedToRecurringId String?
allocatedToRecurring Recurring? @relation("RecurringAllocatedToRecurring", fields: [allocatedToRecurringId], references: [id], onDelete: SetNull, onUpdate: NoAction)
allocatedFrom Recurring[] @relation("RecurringAllocatedToRecurring")
allocationMode AllocationMode?
splits RecurringSplit[]
occurrences Operation[] @relation("RecurringOccurrences")
allocatedOperations Operation[] @relation("OperationAllocatedToRecurring")
createdAt DateTime @default(now())
}
model RecurringSplit {
recurringId String
recurring Recurring @relation(fields: [recurringId], references: [id], onDelete: Cascade)
userId String
user User @relation(fields: [userId], references: [id])
basisPoints Int
@@id([recurringId, userId])
}
model Settlement {
id String @id @default(cuid())
fromUserId String
fromUser User @relation("SettlementFrom", fields: [fromUserId], references: [id])
toUserId String
toUser User @relation("SettlementTo", fields: [toUserId], references: [id])
amount Decimal @db.Decimal(12, 2)
date DateTime @db.Date
note String?
createdAt DateTime @default(now())
}
model Budget {
id String @id @default(cuid())
categoryId String
category Category @relation(fields: [categoryId], references: [id], onDelete: Cascade)
monthlyAmount Decimal @db.Decimal(12, 2)
startMonth String @db.Char(7)
endMonth String? @db.Char(7)
}
model Loan {
id String @id @default(cuid())
name String
lender String?
principal Decimal @db.Decimal(12, 2)
annualRate Decimal @db.Decimal(6, 3)
durationMonths Int
startDate DateTime @db.Date
insuranceMonthly Decimal @default(0) @db.Decimal(12, 2)
accountUserId String
accountUser User @relation(fields: [accountUserId], references: [id])
paymentOverride Decimal? @db.Decimal(12, 2)
referenceDate DateTime? @db.Date
referenceRemainingCapital Decimal? @db.Decimal(12, 2)
splits LoanSplit[]
recurring Recurring?
createdAt DateTime @default(now())
}
model LoanSplit {
loanId String
loan Loan @relation(fields: [loanId], references: [id], onDelete: Cascade)
userId String
user User @relation(fields: [userId], references: [id])
basisPoints Int
@@id([loanId, userId])
}
+45
View File
@@ -0,0 +1,45 @@
import { PrismaClient, type OpKind } from "@prisma/client";
// Catégories de départ (spec §10). Upsert idempotent : relancé à chaque démarrage du conteneur.
const CATEGORIES: { name: string; emoji: string; kind: OpKind }[] = [
{ name: "Logement", emoji: "🏠", kind: "EXPENSE" },
{ name: "Courses", emoji: "🛒", kind: "EXPENSE" },
{ name: "Restaurants", emoji: "🍽", kind: "EXPENSE" },
{ name: "Transport", emoji: "⛽", kind: "EXPENSE" },
{ name: "Auto", emoji: "🚗", kind: "EXPENSE" },
{ name: "Crédit", emoji: "🏦", kind: "EXPENSE" },
{ name: "Énergie", emoji: "⚡", kind: "EXPENSE" },
{ name: "Télécom", emoji: "📱", kind: "EXPENSE" },
{ name: "Abonnements", emoji: "📺", kind: "EXPENSE" },
{ name: "Santé", emoji: "💊", kind: "EXPENSE" },
{ name: "Loisirs", emoji: "🎉", kind: "EXPENSE" },
{ name: "Vacances", emoji: "✈️", kind: "EXPENSE" },
{ name: "Vêtements", emoji: "👕", kind: "EXPENSE" },
{ name: "Cadeaux", emoji: "🎁", kind: "EXPENSE" },
{ name: "Maison", emoji: "🛋", kind: "EXPENSE" },
{ name: "Impôts", emoji: "🧾", kind: "EXPENSE" },
{ name: "Divers", emoji: "📦", kind: "EXPENSE" },
{ name: "Salaire", emoji: "💼", kind: "INCOME" },
{ name: "Remboursement employeur", emoji: "🧾", kind: "INCOME" },
{ name: "IK", emoji: "🚗", kind: "INCOME" },
{ name: "Prime", emoji: "💶", kind: "INCOME" },
{ name: "Autres revenus", emoji: "➕", kind: "INCOME" },
];
export async function seed(prisma: PrismaClient) {
for (const [i, c] of CATEGORIES.entries()) {
await prisma.category.upsert({
where: { name_kind: { name: c.name, kind: c.kind } },
update: {},
create: { ...c, sortOrder: i },
});
}
await prisma.setting.upsert({ where: { id: 1 }, update: {}, create: { id: 1, defaultSplit: {} } });
}
if (require.main === module) {
const prisma = new PrismaClient();
seed(prisma)
.then(() => console.log(`Seed OK (${CATEGORIES.length} catégories)`))
.finally(() => prisma.$disconnect());
}
+1
View File
@@ -0,0 +1 @@
<svg fill="none" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><path d="M14.5 13.5V5.41a1 1 0 0 0-.3-.7L9.8.29A1 1 0 0 0 9.08 0H1.5v13.5A2.5 2.5 0 0 0 4 16h8a2.5 2.5 0 0 0 2.5-2.5m-1.5 0v-7H8v-5H3v12a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1M9.5 5V2.12L12.38 5zM5.13 5h-.62v1.25h2.12V5zm-.62 3h7.12v1.25H4.5zm.62 3h-.62v1.25h7.12V11z" clip-rule="evenodd" fill="#666" fill-rule="evenodd"/></svg>

After

Width:  |  Height:  |  Size: 391 B

+1
View File
@@ -0,0 +1 @@
<svg fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><g clip-path="url(#a)"><path fill-rule="evenodd" clip-rule="evenodd" d="M10.27 14.1a6.5 6.5 0 0 0 3.67-3.45q-1.24.21-2.7.34-.31 1.83-.97 3.1M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16m.48-1.52a7 7 0 0 1-.96 0H7.5a4 4 0 0 1-.84-1.32q-.38-.89-.63-2.08a40 40 0 0 0 3.92 0q-.25 1.2-.63 2.08a4 4 0 0 1-.84 1.31zm2.94-4.76q1.66-.15 2.95-.43a7 7 0 0 0 0-2.58q-1.3-.27-2.95-.43a18 18 0 0 1 0 3.44m-1.27-3.54a17 17 0 0 1 0 3.64 39 39 0 0 1-4.3 0 17 17 0 0 1 0-3.64 39 39 0 0 1 4.3 0m1.1-1.17q1.45.13 2.69.34a6.5 6.5 0 0 0-3.67-3.44q.65 1.26.98 3.1M8.48 1.5l.01.02q.41.37.84 1.31.38.89.63 2.08a40 40 0 0 0-3.92 0q.25-1.2.63-2.08a4 4 0 0 1 .85-1.32 7 7 0 0 1 .96 0m-2.75.4a6.5 6.5 0 0 0-3.67 3.44 29 29 0 0 1 2.7-.34q.31-1.83.97-3.1M4.58 6.28q-1.66.16-2.95.43a7 7 0 0 0 0 2.58q1.3.27 2.95.43a18 18 0 0 1 0-3.44m.17 4.71q-1.45-.12-2.69-.34a6.5 6.5 0 0 0 3.67 3.44q-.65-1.27-.98-3.1" fill="#666"/></g><defs><clipPath id="a"><path fill="#fff" d="M0 0h16v16H0z"/></clipPath></defs></svg>

After

Width:  |  Height:  |  Size: 1.0 KiB

+1
View File
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 394 80"><path fill="#000" d="M262 0h68.5v12.7h-27.2v66.6h-13.6V12.7H262V0ZM149 0v12.7H94v20.4h44.3v12.6H94v21h55v12.6H80.5V0h68.7zm34.3 0h-17.8l63.8 79.4h17.9l-32-39.7 32-39.6h-17.9l-23 28.6-23-28.6zm18.3 56.7-9-11-27.1 33.7h17.8l18.3-22.7z"/><path fill="#000" d="M81 79.3 17 0H0v79.3h13.6V17l50.2 62.3H81Zm252.6-.4c-1 0-1.8-.4-2.5-1s-1.1-1.6-1.1-2.6.3-1.8 1-2.5 1.6-1 2.6-1 1.8.3 2.5 1a3.4 3.4 0 0 1 .6 4.3 3.7 3.7 0 0 1-3 1.8zm23.2-33.5h6v23.3c0 2.1-.4 4-1.3 5.5a9.1 9.1 0 0 1-3.8 3.5c-1.6.8-3.5 1.3-5.7 1.3-2 0-3.7-.4-5.3-1s-2.8-1.8-3.7-3.2c-.9-1.3-1.4-3-1.4-5h6c.1.8.3 1.6.7 2.2s1 1.2 1.6 1.5c.7.4 1.5.5 2.4.5 1 0 1.8-.2 2.4-.6a4 4 0 0 0 1.6-1.8c.3-.8.5-1.8.5-3V45.5zm30.9 9.1a4.4 4.4 0 0 0-2-3.3 7.5 7.5 0 0 0-4.3-1.1c-1.3 0-2.4.2-3.3.5-.9.4-1.6 1-2 1.6a3.5 3.5 0 0 0-.3 4c.3.5.7.9 1.3 1.2l1.8 1 2 .5 3.2.8c1.3.3 2.5.7 3.7 1.2a13 13 0 0 1 3.2 1.8 8.1 8.1 0 0 1 3 6.5c0 2-.5 3.7-1.5 5.1a10 10 0 0 1-4.4 3.5c-1.8.8-4.1 1.2-6.8 1.2-2.6 0-4.9-.4-6.8-1.2-2-.8-3.4-2-4.5-3.5a10 10 0 0 1-1.7-5.6h6a5 5 0 0 0 3.5 4.6c1 .4 2.2.6 3.4.6 1.3 0 2.5-.2 3.5-.6 1-.4 1.8-1 2.4-1.7a4 4 0 0 0 .8-2.4c0-.9-.2-1.6-.7-2.2a11 11 0 0 0-2.1-1.4l-3.2-1-3.8-1c-2.8-.7-5-1.7-6.6-3.2a7.2 7.2 0 0 1-2.4-5.7 8 8 0 0 1 1.7-5 10 10 0 0 1 4.3-3.5c2-.8 4-1.2 6.4-1.2 2.3 0 4.4.4 6.2 1.2 1.8.8 3.2 2 4.3 3.4 1 1.4 1.5 3 1.5 5h-5.8z"/></svg>

After

Width:  |  Height:  |  Size: 1.3 KiB

+1
View File
@@ -0,0 +1 @@
<svg fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1155 1000"><path d="m577.3 0 577.4 1000H0z" fill="#fff"/></svg>

After

Width:  |  Height:  |  Size: 128 B

+1
View File
@@ -0,0 +1 @@
<svg fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill-rule="evenodd" clip-rule="evenodd" d="M1.5 2.5h13v10a1 1 0 0 1-1 1h-11a1 1 0 0 1-1-1zM0 1h16v11.5a2.5 2.5 0 0 1-2.5 2.5h-11A2.5 2.5 0 0 1 0 12.5zm3.75 4.5a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5M7 4.75a.75.75 0 1 1-1.5 0 .75.75 0 0 1 1.5 0m1.75.75a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5" fill="#666"/></svg>

After

Width:  |  Height:  |  Size: 385 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

+26
View File
@@ -0,0 +1,26 @@
@import "tailwindcss";
:root {
--background: #ffffff;
--foreground: #171717;
}
@theme inline {
--color-background: var(--background);
--color-foreground: var(--foreground);
--font-sans: var(--font-geist-sans);
--font-mono: var(--font-geist-mono);
}
@media (prefers-color-scheme: dark) {
:root {
--background: #0a0a0a;
--foreground: #ededed;
}
}
body {
background: var(--background);
color: var(--foreground);
font-family: Arial, Helvetica, sans-serif;
}
+34
View File
@@ -0,0 +1,34 @@
import type { Metadata } from "next";
import { Geist, Geist_Mono } from "next/font/google";
import "./globals.css";
const geistSans = Geist({
variable: "--font-geist-sans",
subsets: ["latin"],
});
const geistMono = Geist_Mono({
variable: "--font-geist-mono",
subsets: ["latin"],
});
export const metadata: Metadata = {
title: "Create Next App",
description: "Generated by create next app",
};
export default function RootLayout({
children,
}: Readonly<{
children: React.ReactNode;
}>) {
return (
<html lang="en">
<body
className={`${geistSans.variable} ${geistMono.variable} antialiased`}
>
{children}
</body>
</html>
);
}
+103
View File
@@ -0,0 +1,103 @@
import Image from "next/image";
export default function Home() {
return (
<div className="font-sans grid grid-rows-[20px_1fr_20px] items-center justify-items-center min-h-screen p-8 pb-20 gap-16 sm:p-20">
<main className="flex flex-col gap-[32px] row-start-2 items-center sm:items-start">
<Image
className="dark:invert"
src="/next.svg"
alt="Next.js logo"
width={180}
height={38}
priority
/>
<ol className="font-mono list-inside list-decimal text-sm/6 text-center sm:text-left">
<li className="mb-2 tracking-[-.01em]">
Get started by editing{" "}
<code className="bg-black/[.05] dark:bg-white/[.06] font-mono font-semibold px-1 py-0.5 rounded">
src/app/page.tsx
</code>
.
</li>
<li className="tracking-[-.01em]">
Save and see your changes instantly.
</li>
</ol>
<div className="flex gap-4 items-center flex-col sm:flex-row">
<a
className="rounded-full border border-solid border-transparent transition-colors flex items-center justify-center bg-foreground text-background gap-2 hover:bg-[#383838] dark:hover:bg-[#ccc] font-medium text-sm sm:text-base h-10 sm:h-12 px-4 sm:px-5 sm:w-auto"
href="https://vercel.com/new?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
target="_blank"
rel="noopener noreferrer"
>
<Image
className="dark:invert"
src="/vercel.svg"
alt="Vercel logomark"
width={20}
height={20}
/>
Deploy now
</a>
<a
className="rounded-full border border-solid border-black/[.08] dark:border-white/[.145] transition-colors flex items-center justify-center hover:bg-[#f2f2f2] dark:hover:bg-[#1a1a1a] hover:border-transparent font-medium text-sm sm:text-base h-10 sm:h-12 px-4 sm:px-5 w-full sm:w-auto md:w-[158px]"
href="https://nextjs.org/docs?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
target="_blank"
rel="noopener noreferrer"
>
Read our docs
</a>
</div>
</main>
<footer className="row-start-3 flex gap-[24px] flex-wrap items-center justify-center">
<a
className="flex items-center gap-2 hover:underline hover:underline-offset-4"
href="https://nextjs.org/learn?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
target="_blank"
rel="noopener noreferrer"
>
<Image
aria-hidden
src="/file.svg"
alt="File icon"
width={16}
height={16}
/>
Learn
</a>
<a
className="flex items-center gap-2 hover:underline hover:underline-offset-4"
href="https://vercel.com/templates?framework=next.js&utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
target="_blank"
rel="noopener noreferrer"
>
<Image
aria-hidden
src="/window.svg"
alt="Window icon"
width={16}
height={16}
/>
Examples
</a>
<a
className="flex items-center gap-2 hover:underline hover:underline-offset-4"
href="https://nextjs.org?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
target="_blank"
rel="noopener noreferrer"
>
<Image
aria-hidden
src="/globe.svg"
alt="Globe icon"
width={16}
height={16}
/>
Go to nextjs.org →
</a>
</footer>
</div>
);
}
+69
View File
@@ -0,0 +1,69 @@
// Les dates métier sont des chaînes "YYYY-MM-DD" et les mois "YYYY-MM" :
// aucune logique jour/mois ne passe par un Date JS, pour éviter tout décalage UTC/Paris.
const parisDay = new Intl.DateTimeFormat("en-CA", {
timeZone: "Europe/Paris",
year: "numeric",
month: "2-digit",
day: "2-digit",
});
const MONTHS_FR = [
"Janvier", "Février", "Mars", "Avril", "Mai", "Juin",
"Juillet", "Août", "Septembre", "Octobre", "Novembre", "Décembre",
];
const pad = (n: number, len = 2) => String(n).padStart(len, "0");
export function todayParis(now: Date = new Date()): string {
return parisDay.format(now);
}
export function currentMonthParis(now: Date = new Date()): string {
return monthOf(todayParis(now));
}
export function monthOf(iso: string): string {
return iso.slice(0, 7);
}
export function addMonths(month: string, n: number): string {
const [y, m] = month.split("-").map(Number);
const index = y * 12 + (m - 1) + n;
return `${pad(Math.floor(index / 12), 4)}-${pad((index % 12) + 1)}`;
}
/** Nombre de mois de `from` à `to` (positif si `to` est après). */
export function monthsBetween(from: string, to: string): number {
const [fy, fm] = from.split("-").map(Number);
const [ty, tm] = to.split("-").map(Number);
return ty * 12 + tm - (fy * 12 + fm);
}
export function daysInMonth(month: string): number {
const [y, m] = month.split("-").map(Number);
return new Date(Date.UTC(y, m, 0)).getUTCDate();
}
/** Jour `day` du mois, ramené au dernier jour si le mois est plus court. */
export function dateInMonth(month: string, day: number): string {
return `${month}-${pad(Math.min(day, daysInMonth(month)))}`;
}
export function toIsoDate(d: Date): string {
return `${pad(d.getUTCFullYear(), 4)}-${pad(d.getUTCMonth() + 1)}-${pad(d.getUTCDate())}`;
}
export function fromIsoDate(iso: string): Date {
return new Date(`${iso}T00:00:00.000Z`);
}
export function formatDateFr(iso: string): string {
const [y, m, d] = iso.split("-");
return `${d}/${m}/${y}`;
}
export function monthLabelFr(month: string): string {
const [y, m] = month.split("-").map(Number);
return `${MONTHS_FR[m - 1]} ${y}`;
}
+7
View File
@@ -0,0 +1,7 @@
import { PrismaClient } from "@prisma/client";
const globalForPrisma = globalThis as unknown as { prisma?: PrismaClient };
export const prisma = globalForPrisma.prisma ?? new PrismaClient();
if (process.env.NODE_ENV !== "production") globalForPrisma.prisma = prisma;
+38
View File
@@ -0,0 +1,38 @@
import { describe, expect, it } from "vitest";
import {
addMonths,
currentMonthParis,
daysInMonth,
formatDateFr,
fromIsoDate,
monthLabelFr,
monthOf,
toIsoDate,
todayParis,
} from "@/lib/dates";
describe("dates", () => {
it("todayParis follows the Paris calendar day, not UTC", () => {
expect(todayParis(new Date("2026-10-31T23:30:00Z"))).toBe("2026-11-01");
expect(todayParis(new Date("2026-10-31T22:30:00Z"))).toBe("2026-10-31");
expect(currentMonthParis(new Date("2026-10-31T23:30:00Z"))).toBe("2026-11");
});
it("does month arithmetic on strings", () => {
expect(monthOf("2026-10-31")).toBe("2026-10");
expect(addMonths("2026-11", 3)).toBe("2027-02");
expect(addMonths("2026-01", -1)).toBe("2025-12");
expect(daysInMonth("2028-02")).toBe(29);
expect(daysInMonth("2027-02")).toBe(28);
});
it("converts Prisma @db.Date values without timezone drift", () => {
expect(toIsoDate(new Date("2026-10-31T00:00:00Z"))).toBe("2026-10-31");
expect(fromIsoDate("2026-10-31").toISOString()).toBe("2026-10-31T00:00:00.000Z");
});
it("formats for French display", () => {
expect(formatDateFr("2026-10-05")).toBe("05/10/2026");
expect(monthLabelFr("2026-10")).toBe("Octobre 2026");
});
});
+27
View File
@@ -0,0 +1,27 @@
{
"compilerOptions": {
"target": "ES2017",
"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": {
"@/*": ["./src/*"]
}
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
"exclude": ["node_modules"]
}
+12
View File
@@ -0,0 +1,12 @@
import { defineConfig } from "vitest/config";
import path from "node:path";
export default defineConfig({
resolve: { alias: { "@": path.resolve(__dirname, "src") } },
test: {
environment: "node",
include: ["tests/**/*.test.ts"],
// Server tests share one MariaDB test database: run files sequentially.
fileParallelism: false,
},
});