feat: global update including storybook setup and backend fixes
- Web: Setup Storybook, added addons, configured Tailwind, added stories for UI components. - Backend: Updated API router, database, workers, and auth in common. - Stream Server: Removed SQLx queries and updated auth. - Docs & Scripts: Updated documentation and recovery scripts.
3
.gitignore
vendored
|
|
@ -82,3 +82,6 @@ chat_exports/!veza-stream-server/src/bin/
|
|||
/blob-report/
|
||||
/playwright/.cache/
|
||||
/playwright/.auth/
|
||||
|
||||
*storybook.log
|
||||
storybook-static
|
||||
|
|
|
|||
13
Makefile
|
|
@ -95,6 +95,12 @@ help: ## Show this dashboard
|
|||
setup: check-tools install-tools install-deps ## [HIGH] Full project initialization
|
||||
@$(ECHO_CMD) "${BOLD}${GREEN}✅ Setup Complete! Ready to rock with 'make dev'.${NC}"
|
||||
|
||||
web-minimal: ## [HIGH] Start Veza Web Minimal Journey (Backend + Frontend + DB)
|
||||
@./scripts/start_minimal.sh
|
||||
|
||||
stop-minimal: ## [HIGH] Stop Minimal Stack
|
||||
@./scripts/stop_minimal.sh
|
||||
|
||||
stop-all: ## [HIGH] Stop all services (Docker + Local)
|
||||
@$(ECHO_CMD) "${RED}🛑 Stopping all services...${NC}"
|
||||
@docker compose -f $(COMPOSE_FILE) down 2>/dev/null || true
|
||||
|
|
@ -600,7 +606,12 @@ incus-logs: ## [LOW] Show logs from Incus container (usage: make incus-logs SERV
|
|||
# ==============================================================================
|
||||
# TEST & QUALITY
|
||||
# ==============================================================================
|
||||
.PHONY: test lint fmt status
|
||||
.PHONY: test test-tmt lint fmt status
|
||||
|
||||
test-tmt: ## [MID] Run Unified TMT Pipeline
|
||||
@$(ECHO_CMD) "${BLUE}🧪 Running TMT Pipeline...${NC}"
|
||||
@command -v tmt >/dev/null 2>&1 || { $(ECHO_CMD) "${RED}❌ tmt is missing! Install with 'pip install tmt'${NC}"; exit 1; }
|
||||
@tmt run
|
||||
|
||||
test: infra-up ## [MID] Run All Tests (Fastest strategy)
|
||||
@$(ECHO_CMD) "${BLUE}🧪 Running Tests...${NC}"
|
||||
|
|
|
|||
19
apps/web/.storybook/main.ts
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
import type { StorybookConfig } from '@storybook/react-vite';
|
||||
|
||||
import { dirname, join } from "path"
|
||||
|
||||
function getAbsolutePath(value: string) {
|
||||
return dirname(require.resolve(join(value, "package.json")))
|
||||
}
|
||||
|
||||
const config: StorybookConfig = {
|
||||
"stories": [
|
||||
"../src/**/*.mdx",
|
||||
"../src/**/*.stories.@(js|jsx|mjs|ts|tsx)"
|
||||
],
|
||||
"addons": [
|
||||
getAbsolutePath('@storybook/addon-essentials')
|
||||
],
|
||||
"framework": getAbsolutePath('@storybook/react-vite')
|
||||
};
|
||||
export default config;
|
||||
22
apps/web/.storybook/preview.ts
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
import type { Preview } from '@storybook/react-vite';
|
||||
import '../src/index.css';
|
||||
|
||||
const preview: Preview = {
|
||||
parameters: {
|
||||
controls: {
|
||||
matchers: {
|
||||
color: /(background|color)$/i,
|
||||
date: /Date$/i,
|
||||
},
|
||||
},
|
||||
|
||||
a11y: {
|
||||
// 'todo' - show a11y violations in the test UI only
|
||||
// 'error' - fail CI on a11y violations
|
||||
// 'off' - skip a11y checks entirely
|
||||
test: 'todo',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export default preview;
|
||||
7
apps/web/.storybook/vitest.setup.ts
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
import * as a11yAddonAnnotations from "@storybook/addon-a11y/preview";
|
||||
import { setProjectAnnotations } from '@storybook/react-vite';
|
||||
import * as projectAnnotations from './preview';
|
||||
|
||||
// This is an important step to apply the right configuration when testing your stories.
|
||||
// More info at: https://storybook.js.org/docs/api/portable-stories/portable-stories-vitest#setprojectannotations
|
||||
setProjectAnnotations([a11yAddonAnnotations, projectAnnotations]);
|
||||
|
|
@ -1,3 +1,6 @@
|
|||
// For more info, see https://github.com/storybookjs/eslint-plugin-storybook#configuration-flat-config-format
|
||||
import storybook from "eslint-plugin-storybook";
|
||||
|
||||
import js from '@eslint/js';
|
||||
import typescript from '@typescript-eslint/eslint-plugin';
|
||||
import typescriptParser from '@typescript-eslint/parser';
|
||||
|
|
@ -6,225 +9,221 @@ import reactHooks from 'eslint-plugin-react-hooks';
|
|||
import reactRefresh from 'eslint-plugin-react-refresh';
|
||||
import jsxA11y from 'eslint-plugin-jsx-a11y';
|
||||
|
||||
export default [
|
||||
js.configs.recommended,
|
||||
{
|
||||
files: ['**/*.{ts,tsx,js,jsx}'],
|
||||
languageOptions: {
|
||||
parser: typescriptParser,
|
||||
parserOptions: {
|
||||
ecmaFeatures: {
|
||||
jsx: true,
|
||||
},
|
||||
ecmaVersion: 2022,
|
||||
sourceType: 'module',
|
||||
},
|
||||
globals: {
|
||||
// Browser globals
|
||||
window: 'readonly',
|
||||
document: 'readonly',
|
||||
localStorage: 'readonly',
|
||||
sessionStorage: 'readonly',
|
||||
console: 'readonly',
|
||||
setTimeout: 'readonly',
|
||||
clearTimeout: 'readonly',
|
||||
setInterval: 'readonly',
|
||||
clearInterval: 'readonly',
|
||||
fetch: 'readonly',
|
||||
WebSocket: 'readonly',
|
||||
File: 'readonly',
|
||||
FormData: 'readonly',
|
||||
CustomEvent: 'readonly',
|
||||
Event: 'readonly',
|
||||
CloseEvent: 'readonly',
|
||||
MessageEvent: 'readonly',
|
||||
KeyboardEvent: 'readonly',
|
||||
HTMLElement: 'readonly',
|
||||
HTMLDivElement: 'readonly',
|
||||
HTMLInputElement: 'readonly',
|
||||
HTMLButtonElement: 'readonly',
|
||||
HTMLAnchorElement: 'readonly',
|
||||
HTMLParagraphElement: 'readonly',
|
||||
HTMLHeadingElement: 'readonly',
|
||||
HTMLTextAreaElement: 'readonly',
|
||||
HTMLSelectElement: 'readonly',
|
||||
HTMLImageElement: 'readonly',
|
||||
HTMLAudioElement: 'readonly',
|
||||
Element: 'readonly',
|
||||
Node: 'readonly',
|
||||
MouseEvent: 'readonly',
|
||||
Blob: 'readonly',
|
||||
FileReader: 'readonly',
|
||||
Image: 'readonly',
|
||||
global: 'readonly',
|
||||
NodeJS: 'readonly',
|
||||
Buffer: 'readonly',
|
||||
crypto: 'readonly',
|
||||
performance: 'readonly',
|
||||
require: 'readonly',
|
||||
process: 'readonly',
|
||||
// URL API globals
|
||||
URL: 'readonly',
|
||||
URLSearchParams: 'readonly',
|
||||
// DOM API globals
|
||||
DOMRect: 'readonly',
|
||||
DOMRectReadOnly: 'readonly',
|
||||
Headers: 'readonly',
|
||||
navigator: 'readonly',
|
||||
WindowEventMap: 'readonly',
|
||||
requestAnimationFrame: 'readonly',
|
||||
cancelAnimationFrame: 'readonly',
|
||||
Notification: 'readonly',
|
||||
NotificationOptions: 'readonly',
|
||||
NotificationPermission: 'readonly',
|
||||
IntersectionObserver: 'readonly',
|
||||
IntersectionObserverInit: 'readonly',
|
||||
MessageChannel: 'readonly',
|
||||
confirm: 'readonly',
|
||||
// Service Worker globals
|
||||
self: 'readonly',
|
||||
caches: 'readonly',
|
||||
ServiceWorkerRegistration: 'readonly',
|
||||
Cache: 'readonly',
|
||||
CacheStorage: 'readonly',
|
||||
Response: 'readonly',
|
||||
Request: 'readonly',
|
||||
clients: 'readonly',
|
||||
// React globals
|
||||
React: 'readonly',
|
||||
// Test globals
|
||||
beforeAll: 'readonly',
|
||||
afterAll: 'readonly',
|
||||
afterEach: 'readonly',
|
||||
beforeEach: 'readonly',
|
||||
describe: 'readonly',
|
||||
it: 'readonly',
|
||||
test: 'readonly',
|
||||
expect: 'readonly',
|
||||
vi: 'readonly',
|
||||
vitest: 'readonly',
|
||||
waitFor: 'readonly',
|
||||
jest: 'readonly',
|
||||
AbortController: 'readonly',
|
||||
AbortSignal: 'readonly',
|
||||
BroadcastChannel: 'readonly',
|
||||
DOMException: 'readonly',
|
||||
atob: 'readonly',
|
||||
PerformanceNavigationTiming: 'readonly',
|
||||
PerformanceObserver: 'readonly',
|
||||
HTMLFormElement: 'readonly',
|
||||
HTMLTableElement: 'readonly',
|
||||
HTMLTableSectionElement: 'readonly',
|
||||
HTMLTableRowElement: 'readonly',
|
||||
HTMLTableCellElement: 'readonly',
|
||||
HTMLTableCaptionElement: 'readonly',
|
||||
HTMLSpanElement: 'readonly',
|
||||
HTMLCanvasElement: 'readonly',
|
||||
HTMLLabelElement: 'readonly',
|
||||
FileList: 'readonly',
|
||||
MediaQueryListEvent: 'readonly',
|
||||
IntersectionObserver: 'readonly',
|
||||
IntersectionObserverEntry: 'readonly',
|
||||
IntersectionObserverCallback: 'readonly',
|
||||
ResizeObserver: 'readonly',
|
||||
ResizeObserverEntry: 'readonly',
|
||||
HeadersInit: 'readonly',
|
||||
EventListener: 'readonly',
|
||||
export default [js.configs.recommended, {
|
||||
files: ['**/*.{ts,tsx,js,jsx}'],
|
||||
languageOptions: {
|
||||
parser: typescriptParser,
|
||||
parserOptions: {
|
||||
ecmaFeatures: {
|
||||
jsx: true,
|
||||
},
|
||||
ecmaVersion: 2022,
|
||||
sourceType: 'module',
|
||||
},
|
||||
plugins: {
|
||||
'@typescript-eslint': typescript,
|
||||
'react': react,
|
||||
'react-hooks': reactHooks,
|
||||
'react-refresh': reactRefresh,
|
||||
'jsx-a11y': jsxA11y,
|
||||
},
|
||||
rules: {
|
||||
// TypeScript
|
||||
'@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_' }],
|
||||
'@typescript-eslint/explicit-function-return-type': 'off',
|
||||
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
||||
'@typescript-eslint/no-explicit-any': 'off',
|
||||
'@typescript-eslint/no-non-null-assertion': 'warn',
|
||||
|
||||
// React
|
||||
'react/react-in-jsx-scope': 'off',
|
||||
'react/prop-types': 'off',
|
||||
'react-hooks/rules-of-hooks': 'error',
|
||||
'react-hooks/exhaustive-deps': 'warn',
|
||||
'react-refresh/only-export-components': [
|
||||
'warn',
|
||||
{ allowConstantExport: true }
|
||||
],
|
||||
|
||||
// General
|
||||
'no-console': 'off',
|
||||
'no-debugger': 'error',
|
||||
'prefer-const': 'error',
|
||||
'no-var': 'error',
|
||||
'object-shorthand': 'error',
|
||||
'prefer-template': 'error',
|
||||
'no-unused-vars': 'off', // Handled by @typescript-eslint/no-unused-vars
|
||||
'no-useless-escape': 'error',
|
||||
'no-prototype-builtins': 'warn',
|
||||
|
||||
// Typography: Enforce type scale usage
|
||||
// Warn on arbitrary text sizes in className strings (e.g., text-[10px], text-[9px])
|
||||
// Note: SVG chart text (text-[2px], text-[1.5px]) may need exceptions - review case by case
|
||||
'no-restricted-syntax': [
|
||||
'warn',
|
||||
{
|
||||
selector:
|
||||
"Literal[value=/text-\\[\\d+(\\.\\d+)?(px|rem)\\]/], TemplateElement[value.raw=/text-\\[\\d+(\\.\\d+)?(px|rem)\\]/]",
|
||||
message:
|
||||
'Use type scale classes (text-xs, text-sm, text-base, text-lg, text-xl, text-2xl, text-3xl, text-4xl) instead of arbitrary sizes. SVG chart text (text-[2px], text-[1.5px]) may be an exception - add eslint-disable comment if needed.',
|
||||
},
|
||||
// Spacing: Enforce spacing scale usage
|
||||
// Warn on arbitrary spacing values that don't follow 4px base scale
|
||||
// Valid scale values: 0, 1, 2, 3, 4, 5, 6, 8, 10, 12, 16, 20, 24
|
||||
// Arbitrary values like gap-[7px], p-[9px], etc. should use scale values instead
|
||||
{
|
||||
selector:
|
||||
"Literal[value=/(gap-|p-|m-|px-|py-|mx-|my-|space-[xy]-)\\[\\d+(\\.\\d+)?(px|rem)\\]/], TemplateElement[value.raw=/(gap-|p-|m-|px-|py-|mx-|my-|space-[xy]-)\\[\\d+(\\.\\d+)?(px|rem)\\]/]",
|
||||
message:
|
||||
'Use spacing scale classes (gap-0 through gap-24, p-0 through p-24, etc.) instead of arbitrary sizes. Valid scale values follow 4px base: 0, 1, 2, 3, 4, 5, 6, 8, 10, 12, 16, 20, 24. For exceptions, add eslint-disable comment.',
|
||||
},
|
||||
// Colors: Prevent Tailwind default colors (use Kodo design system colors instead)
|
||||
// Warn on default Tailwind color classes: slate, gray, zinc, neutral, stone, red, orange, amber, yellow, lime, green, emerald, teal, cyan, sky, blue, indigo, violet, purple, fuchsia, pink, rose
|
||||
// Allow: kodo-* colors, arbitrary values like text-[#fff], and color utilities without shades
|
||||
{
|
||||
selector:
|
||||
"Literal[value=/(text-|bg-|border-|ring-|outline-|divide-|placeholder-|from-|via-|to-|accent-|caret-|fill-|stroke-)(slate|gray|zinc|neutral|stone|red|orange|amber|yellow|lime|green|emerald|teal|cyan|sky|blue|indigo|violet|purple|fuchsia|pink|rose)-(50|100|200|300|400|500|600|700|800|900|950)/], TemplateElement[value.raw=/(text-|bg-|border-|ring-|outline-|divide-|placeholder-|from-|via-|to-|accent-|caret-|fill-|stroke-)(slate|gray|zinc|neutral|stone|red|orange|amber|yellow|lime|green|emerald|teal|cyan|sky|blue|indigo|violet|purple|fuchsia|pink|rose)-(50|100|200|300|400|500|600|700|800|900|950)/]",
|
||||
message:
|
||||
'Use Kodo design system colors (kodo-cyan, kodo-red, kodo-lime, kodo-steel, etc.) instead of Tailwind default colors. See apps/web/src/styles/COLOR_USAGE.md for color mapping. For exceptions (e.g., test files), add eslint-disable comment.',
|
||||
},
|
||||
// Components: Enforce Button component usage (prevent native button elements)
|
||||
// Warn on native <button> elements - use <Button> component from @/components/ui/button instead
|
||||
{
|
||||
selector: 'JSXOpeningElement[name.name="button"]',
|
||||
message:
|
||||
'Use the Button component from @/components/ui/button instead of native <button> elements. This ensures consistent styling, accessibility, and design system compliance. For exceptions (e.g., test files, third-party components), add eslint-disable comment.',
|
||||
},
|
||||
],
|
||||
},
|
||||
settings: {
|
||||
react: {
|
||||
version: 'detect',
|
||||
},
|
||||
globals: {
|
||||
// Browser globals
|
||||
window: 'readonly',
|
||||
document: 'readonly',
|
||||
localStorage: 'readonly',
|
||||
sessionStorage: 'readonly',
|
||||
console: 'readonly',
|
||||
setTimeout: 'readonly',
|
||||
clearTimeout: 'readonly',
|
||||
setInterval: 'readonly',
|
||||
clearInterval: 'readonly',
|
||||
fetch: 'readonly',
|
||||
WebSocket: 'readonly',
|
||||
File: 'readonly',
|
||||
FormData: 'readonly',
|
||||
CustomEvent: 'readonly',
|
||||
Event: 'readonly',
|
||||
CloseEvent: 'readonly',
|
||||
MessageEvent: 'readonly',
|
||||
KeyboardEvent: 'readonly',
|
||||
HTMLElement: 'readonly',
|
||||
HTMLDivElement: 'readonly',
|
||||
HTMLInputElement: 'readonly',
|
||||
HTMLButtonElement: 'readonly',
|
||||
HTMLAnchorElement: 'readonly',
|
||||
HTMLParagraphElement: 'readonly',
|
||||
HTMLHeadingElement: 'readonly',
|
||||
HTMLTextAreaElement: 'readonly',
|
||||
HTMLSelectElement: 'readonly',
|
||||
HTMLImageElement: 'readonly',
|
||||
HTMLAudioElement: 'readonly',
|
||||
Element: 'readonly',
|
||||
Node: 'readonly',
|
||||
MouseEvent: 'readonly',
|
||||
Blob: 'readonly',
|
||||
FileReader: 'readonly',
|
||||
Image: 'readonly',
|
||||
global: 'readonly',
|
||||
NodeJS: 'readonly',
|
||||
Buffer: 'readonly',
|
||||
crypto: 'readonly',
|
||||
performance: 'readonly',
|
||||
require: 'readonly',
|
||||
process: 'readonly',
|
||||
// URL API globals
|
||||
URL: 'readonly',
|
||||
URLSearchParams: 'readonly',
|
||||
// DOM API globals
|
||||
DOMRect: 'readonly',
|
||||
DOMRectReadOnly: 'readonly',
|
||||
Headers: 'readonly',
|
||||
navigator: 'readonly',
|
||||
WindowEventMap: 'readonly',
|
||||
requestAnimationFrame: 'readonly',
|
||||
cancelAnimationFrame: 'readonly',
|
||||
Notification: 'readonly',
|
||||
NotificationOptions: 'readonly',
|
||||
NotificationPermission: 'readonly',
|
||||
IntersectionObserver: 'readonly',
|
||||
IntersectionObserverInit: 'readonly',
|
||||
MessageChannel: 'readonly',
|
||||
confirm: 'readonly',
|
||||
// Service Worker globals
|
||||
self: 'readonly',
|
||||
caches: 'readonly',
|
||||
ServiceWorkerRegistration: 'readonly',
|
||||
Cache: 'readonly',
|
||||
CacheStorage: 'readonly',
|
||||
Response: 'readonly',
|
||||
Request: 'readonly',
|
||||
clients: 'readonly',
|
||||
// React globals
|
||||
React: 'readonly',
|
||||
// Test globals
|
||||
beforeAll: 'readonly',
|
||||
afterAll: 'readonly',
|
||||
afterEach: 'readonly',
|
||||
beforeEach: 'readonly',
|
||||
describe: 'readonly',
|
||||
it: 'readonly',
|
||||
test: 'readonly',
|
||||
expect: 'readonly',
|
||||
vi: 'readonly',
|
||||
vitest: 'readonly',
|
||||
waitFor: 'readonly',
|
||||
jest: 'readonly',
|
||||
AbortController: 'readonly',
|
||||
AbortSignal: 'readonly',
|
||||
BroadcastChannel: 'readonly',
|
||||
DOMException: 'readonly',
|
||||
atob: 'readonly',
|
||||
PerformanceNavigationTiming: 'readonly',
|
||||
PerformanceObserver: 'readonly',
|
||||
HTMLFormElement: 'readonly',
|
||||
HTMLTableElement: 'readonly',
|
||||
HTMLTableSectionElement: 'readonly',
|
||||
HTMLTableRowElement: 'readonly',
|
||||
HTMLTableCellElement: 'readonly',
|
||||
HTMLTableCaptionElement: 'readonly',
|
||||
HTMLSpanElement: 'readonly',
|
||||
HTMLCanvasElement: 'readonly',
|
||||
HTMLLabelElement: 'readonly',
|
||||
FileList: 'readonly',
|
||||
MediaQueryListEvent: 'readonly',
|
||||
IntersectionObserver: 'readonly',
|
||||
IntersectionObserverEntry: 'readonly',
|
||||
IntersectionObserverCallback: 'readonly',
|
||||
ResizeObserver: 'readonly',
|
||||
ResizeObserverEntry: 'readonly',
|
||||
HeadersInit: 'readonly',
|
||||
EventListener: 'readonly',
|
||||
},
|
||||
},
|
||||
{
|
||||
ignores: [
|
||||
'node_modules/',
|
||||
'dist/',
|
||||
'build/',
|
||||
'target/',
|
||||
'_archive/',
|
||||
'archive/',
|
||||
'*.config.js',
|
||||
'*.config.ts',
|
||||
'*.config.cjs',
|
||||
'**/ui.backup/**',
|
||||
plugins: {
|
||||
'@typescript-eslint': typescript,
|
||||
'react': react,
|
||||
'react-hooks': reactHooks,
|
||||
'react-refresh': reactRefresh,
|
||||
'jsx-a11y': jsxA11y,
|
||||
},
|
||||
rules: {
|
||||
// TypeScript
|
||||
'@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_' }],
|
||||
'@typescript-eslint/explicit-function-return-type': 'off',
|
||||
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
||||
'@typescript-eslint/no-explicit-any': 'off',
|
||||
'@typescript-eslint/no-non-null-assertion': 'warn',
|
||||
|
||||
// React
|
||||
'react/react-in-jsx-scope': 'off',
|
||||
'react/prop-types': 'off',
|
||||
'react-hooks/rules-of-hooks': 'error',
|
||||
'react-hooks/exhaustive-deps': 'warn',
|
||||
'react-refresh/only-export-components': [
|
||||
'warn',
|
||||
{ allowConstantExport: true }
|
||||
],
|
||||
|
||||
// General
|
||||
'no-console': 'off',
|
||||
'no-debugger': 'error',
|
||||
'prefer-const': 'error',
|
||||
'no-var': 'error',
|
||||
'object-shorthand': 'error',
|
||||
'prefer-template': 'error',
|
||||
'no-unused-vars': 'off', // Handled by @typescript-eslint/no-unused-vars
|
||||
'no-useless-escape': 'error',
|
||||
'no-prototype-builtins': 'warn',
|
||||
|
||||
// Typography: Enforce type scale usage
|
||||
// Warn on arbitrary text sizes in className strings (e.g., text-[10px], text-[9px])
|
||||
// Note: SVG chart text (text-[2px], text-[1.5px]) may need exceptions - review case by case
|
||||
'no-restricted-syntax': [
|
||||
'warn',
|
||||
{
|
||||
selector:
|
||||
"Literal[value=/text-\\[\\d+(\\.\\d+)?(px|rem)\\]/], TemplateElement[value.raw=/text-\\[\\d+(\\.\\d+)?(px|rem)\\]/]",
|
||||
message:
|
||||
'Use type scale classes (text-xs, text-sm, text-base, text-lg, text-xl, text-2xl, text-3xl, text-4xl) instead of arbitrary sizes. SVG chart text (text-[2px], text-[1.5px]) may be an exception - add eslint-disable comment if needed.',
|
||||
},
|
||||
// Spacing: Enforce spacing scale usage
|
||||
// Warn on arbitrary spacing values that don't follow 4px base scale
|
||||
// Valid scale values: 0, 1, 2, 3, 4, 5, 6, 8, 10, 12, 16, 20, 24
|
||||
// Arbitrary values like gap-[7px], p-[9px], etc. should use scale values instead
|
||||
{
|
||||
selector:
|
||||
"Literal[value=/(gap-|p-|m-|px-|py-|mx-|my-|space-[xy]-)\\[\\d+(\\.\\d+)?(px|rem)\\]/], TemplateElement[value.raw=/(gap-|p-|m-|px-|py-|mx-|my-|space-[xy]-)\\[\\d+(\\.\\d+)?(px|rem)\\]/]",
|
||||
message:
|
||||
'Use spacing scale classes (gap-0 through gap-24, p-0 through p-24, etc.) instead of arbitrary sizes. Valid scale values follow 4px base: 0, 1, 2, 3, 4, 5, 6, 8, 10, 12, 16, 20, 24. For exceptions, add eslint-disable comment.',
|
||||
},
|
||||
// Colors: Prevent Tailwind default colors (use Kodo design system colors instead)
|
||||
// Warn on default Tailwind color classes: slate, gray, zinc, neutral, stone, red, orange, amber, yellow, lime, green, emerald, teal, cyan, sky, blue, indigo, violet, purple, fuchsia, pink, rose
|
||||
// Allow: kodo-* colors, arbitrary values like text-[#fff], and color utilities without shades
|
||||
{
|
||||
selector:
|
||||
"Literal[value=/(text-|bg-|border-|ring-|outline-|divide-|placeholder-|from-|via-|to-|accent-|caret-|fill-|stroke-)(slate|gray|zinc|neutral|stone|red|orange|amber|yellow|lime|green|emerald|teal|cyan|sky|blue|indigo|violet|purple|fuchsia|pink|rose)-(50|100|200|300|400|500|600|700|800|900|950)/], TemplateElement[value.raw=/(text-|bg-|border-|ring-|outline-|divide-|placeholder-|from-|via-|to-|accent-|caret-|fill-|stroke-)(slate|gray|zinc|neutral|stone|red|orange|amber|yellow|lime|green|emerald|teal|cyan|sky|blue|indigo|violet|purple|fuchsia|pink|rose)-(50|100|200|300|400|500|600|700|800|900|950)/]",
|
||||
message:
|
||||
'Use Kodo design system colors (kodo-cyan, kodo-red, kodo-lime, kodo-steel, etc.) instead of Tailwind default colors. See apps/web/src/styles/COLOR_USAGE.md for color mapping. For exceptions (e.g., test files), add eslint-disable comment.',
|
||||
},
|
||||
// Components: Enforce Button component usage (prevent native button elements)
|
||||
// Warn on native <button> elements - use <Button> component from @/components/ui/button instead
|
||||
{
|
||||
selector: 'JSXOpeningElement[name.name="button"]',
|
||||
message:
|
||||
'Use the Button component from @/components/ui/button instead of native <button> elements. This ensures consistent styling, accessibility, and design system compliance. For exceptions (e.g., test files, third-party components), add eslint-disable comment.',
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
settings: {
|
||||
react: {
|
||||
version: 'detect',
|
||||
},
|
||||
},
|
||||
}, {
|
||||
ignores: [
|
||||
'node_modules/',
|
||||
'dist/',
|
||||
'build/',
|
||||
'target/',
|
||||
'_archive/',
|
||||
'archive/',
|
||||
'*.config.js',
|
||||
'*.config.ts',
|
||||
'*.config.cjs',
|
||||
'**/ui.backup/**',
|
||||
],
|
||||
}, ...storybook.configs["flat/recommended"]];
|
||||
|
|
|
|||
17393
apps/web/package-lock.json
generated
|
|
@ -37,7 +37,9 @@
|
|||
"qa:loki": "make loki",
|
||||
"qa:a11y": "make a11y",
|
||||
"qa:all": "make qa-all",
|
||||
"prepare": "husky"
|
||||
"prepare": "husky",
|
||||
"storybook": "storybook dev -p 6006",
|
||||
"build-storybook": "storybook build"
|
||||
},
|
||||
"dependencies": {
|
||||
"@dnd-kit/core": "^6.3.1",
|
||||
|
|
@ -79,6 +81,10 @@
|
|||
"@lhci/cli": "^0.12.0",
|
||||
"@openapitools/openapi-generator-cli": "^2.27.0",
|
||||
"@playwright/test": "^1.41.2",
|
||||
"@storybook/addon-essentials": "^8.6.15",
|
||||
"@storybook/addon-interactions": "^8.6.15",
|
||||
"@storybook/builder-vite": "^8.6.15",
|
||||
"@storybook/react-vite": "^8.6.15",
|
||||
"@tailwindcss/postcss": "^4.0.0",
|
||||
"@testing-library/jest-dom": "^6.4.2",
|
||||
"@testing-library/react": "^14.2.1",
|
||||
|
|
@ -92,6 +98,7 @@
|
|||
"@typescript-eslint/eslint-plugin": "^8.0.0",
|
||||
"@typescript-eslint/parser": "^8.0.0",
|
||||
"@vitejs/plugin-react": "^4.2.1",
|
||||
"@vitest/browser": "^3.2.4",
|
||||
"@vitest/coverage-v8": "^3.2.4",
|
||||
"autoprefixer": "^10.4.17",
|
||||
"babel-plugin-react-remove-properties": "^0.3.1",
|
||||
|
|
@ -107,7 +114,9 @@
|
|||
"msw": "^2.11.2",
|
||||
"newman": "^6.1.0",
|
||||
"pa11y-ci": "^3.0.1",
|
||||
"playwright": "^1.58.1",
|
||||
"prettier": "^3.2.5",
|
||||
"storybook": "^8.6.15",
|
||||
"tailwindcss": "^4.0.0",
|
||||
"tw-animate-css": "^1.4.0",
|
||||
"typescript": "^5.3.3",
|
||||
|
|
|
|||
26
apps/web/src/components/Button.stories.tsx
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import { Button } from './Button';
|
||||
|
||||
const meta: Meta<typeof Button> = {
|
||||
title: 'Components/Button',
|
||||
component: Button,
|
||||
tags: ['autodocs'],
|
||||
};
|
||||
|
||||
export default meta;
|
||||
|
||||
type Story = StoryObj<typeof Button>;
|
||||
|
||||
export const Primary: Story = {
|
||||
args: {
|
||||
label: 'Valider',
|
||||
variant: 'primary',
|
||||
},
|
||||
};
|
||||
|
||||
export const Secondary: Story = {
|
||||
args: {
|
||||
label: 'Annuler',
|
||||
variant: 'secondary',
|
||||
},
|
||||
};
|
||||
18
apps/web/src/components/Button.tsx
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
type ButtonProps = {
|
||||
label: string;
|
||||
variant?: 'primary' | 'secondary';
|
||||
};
|
||||
|
||||
export function Button({ label, variant = 'primary' }: ButtonProps) {
|
||||
const base = 'px-4 py-2 rounded font-medium';
|
||||
const styles = {
|
||||
primary: 'bg-black text-white',
|
||||
secondary: 'bg-gray-200 text-black',
|
||||
};
|
||||
|
||||
return (
|
||||
<button className={`${base} ${styles[variant]}`}>
|
||||
{label}
|
||||
</button>
|
||||
);
|
||||
}
|
||||
60
apps/web/src/components/ui/Badge.stories.tsx
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import { Badge } from './badge';
|
||||
import { Star } from 'lucide-react';
|
||||
|
||||
const meta = {
|
||||
title: 'UI/Badge',
|
||||
component: Badge,
|
||||
tags: ['autodocs'],
|
||||
argTypes: {
|
||||
variant: {
|
||||
control: 'select',
|
||||
options: ['cyan', 'magenta', 'lime', 'gold', 'terminal'],
|
||||
},
|
||||
size: {
|
||||
control: 'select',
|
||||
options: ['sm', 'md', 'lg'],
|
||||
},
|
||||
dot: { control: 'boolean' },
|
||||
count: { control: 'number' },
|
||||
label: { control: 'text' },
|
||||
},
|
||||
args: {
|
||||
label: 'Badge',
|
||||
variant: 'cyan',
|
||||
size: 'md',
|
||||
}
|
||||
} satisfies Meta<typeof Badge>;
|
||||
|
||||
export default meta;
|
||||
type Story = StoryObj<typeof meta>;
|
||||
|
||||
export const Default: Story = {};
|
||||
|
||||
export const Variants = {
|
||||
render: () => (
|
||||
<div className="flex gap-2">
|
||||
<Badge variant="cyan" label="Cyan" />
|
||||
<Badge variant="magenta" label="Magenta" />
|
||||
<Badge variant="lime" label="Lime" />
|
||||
<Badge variant="gold" label="Gold" />
|
||||
<Badge variant="terminal" label="Terminal" />
|
||||
</div>
|
||||
),
|
||||
};
|
||||
|
||||
export const WithIcon: Story = {
|
||||
args: {
|
||||
icon: <Star className="w-3 h-3" />,
|
||||
label: 'Premium',
|
||||
variant: 'gold',
|
||||
},
|
||||
};
|
||||
|
||||
export const WithCount: Story = {
|
||||
args: {
|
||||
label: 'Notifications',
|
||||
count: 5,
|
||||
variant: 'magenta',
|
||||
},
|
||||
};
|
||||
84
apps/web/src/components/ui/Card.stories.tsx
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import { Card, CardHeader, CardTitle, CardDescription, CardContent, CardFooter } from './card';
|
||||
import { Button } from './button';
|
||||
|
||||
const meta = {
|
||||
title: 'UI/Card',
|
||||
component: Card,
|
||||
tags: ['autodocs'],
|
||||
argTypes: {
|
||||
variant: {
|
||||
control: 'select',
|
||||
options: ['default', 'elevated', 'ghost', 'outline', 'muted', 'glass', 'interactive', 'glow', 'glowMagenta', 'spotlight'],
|
||||
},
|
||||
padding: {
|
||||
control: 'select',
|
||||
options: ['none', 'sm', 'default', 'lg'],
|
||||
},
|
||||
},
|
||||
args: {
|
||||
variant: 'default',
|
||||
padding: 'default',
|
||||
}
|
||||
} satisfies Meta<typeof Card>;
|
||||
|
||||
export default meta;
|
||||
type Story = StoryObj<typeof meta>;
|
||||
|
||||
export const Default: Story = {
|
||||
render: (args) => (
|
||||
<Card {...args} className="w-[350px]">
|
||||
<CardHeader>
|
||||
<CardTitle>Create project</CardTitle>
|
||||
<CardDescription>Deploy your new project in one-click.</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<div className="flex flex-col space-y-2 text-sm text-muted-foreground">
|
||||
<p>Project Name: Veza App</p>
|
||||
<p>Framework: React</p>
|
||||
</div>
|
||||
</CardContent>
|
||||
<CardFooter className="flex justify-between">
|
||||
<Button variant="outline">Cancel</Button>
|
||||
<Button>Deploy</Button>
|
||||
</CardFooter>
|
||||
</Card>
|
||||
),
|
||||
};
|
||||
|
||||
export const Interactive: Story = {
|
||||
args: {
|
||||
variant: 'interactive',
|
||||
},
|
||||
render: (args) => (
|
||||
<Card {...args} className="w-[350px]">
|
||||
<CardHeader>
|
||||
<CardTitle>Interactive Card</CardTitle>
|
||||
<CardDescription>Hover over me to see the effect.</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<p className="text-sm text-muted-foreground">This card responds to user interaction.</p>
|
||||
</CardContent>
|
||||
</Card>
|
||||
),
|
||||
};
|
||||
|
||||
export const Spotlight: Story = {
|
||||
args: {
|
||||
variant: 'spotlight',
|
||||
spotlight: true,
|
||||
},
|
||||
render: (args) => (
|
||||
<div className="p-10 bg-black flex justify-center">
|
||||
<Card {...args} className="w-[350px] text-white">
|
||||
<CardHeader>
|
||||
<CardTitle>Spotlight Effect</CardTitle>
|
||||
<CardDescription className="text-gray-400">Move your mouse over the card.</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<p className="text-sm">The spotlight effect follows your cursor.</p>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
),
|
||||
};
|
||||
44
apps/web/src/components/ui/Checkbox.stories.tsx
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
// import { fn } from '@storybook/test';
|
||||
import { Checkbox } from './checkbox';
|
||||
|
||||
const meta = {
|
||||
title: 'UI/Checkbox',
|
||||
component: Checkbox,
|
||||
tags: ['autodocs'],
|
||||
argTypes: {
|
||||
label: { control: 'text' },
|
||||
disabled: { control: 'boolean' },
|
||||
checked: { control: 'boolean' },
|
||||
},
|
||||
args: {
|
||||
label: 'Accept terms and conditions',
|
||||
onCheckedChange: () => { }, // fn()
|
||||
}
|
||||
} satisfies Meta<typeof Checkbox>;
|
||||
|
||||
export default meta;
|
||||
type Story = StoryObj<typeof meta>;
|
||||
|
||||
export const Default: Story = {};
|
||||
|
||||
export const Checked: Story = {
|
||||
args: {
|
||||
checked: true,
|
||||
},
|
||||
};
|
||||
|
||||
export const Disabled: Story = {
|
||||
args: {
|
||||
disabled: true,
|
||||
label: 'Disabled option',
|
||||
},
|
||||
};
|
||||
|
||||
export const DisabledChecked: Story = {
|
||||
args: {
|
||||
disabled: true,
|
||||
checked: true,
|
||||
label: 'Disabled and checked',
|
||||
},
|
||||
};
|
||||
53
apps/web/src/components/ui/Input.stories.tsx
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import { Input, SearchInput } from './input';
|
||||
import { Mail, Lock } from 'lucide-react';
|
||||
|
||||
const meta = {
|
||||
title: 'UI/Input',
|
||||
component: Input,
|
||||
tags: ['autodocs'],
|
||||
argTypes: {
|
||||
type: { control: 'select', options: ['text', 'password', 'email', 'number'] },
|
||||
disabled: { control: 'boolean' },
|
||||
label: { control: 'text' },
|
||||
},
|
||||
args: {
|
||||
placeholder: 'Enter text...',
|
||||
}
|
||||
} satisfies Meta<typeof Input>;
|
||||
|
||||
export default meta;
|
||||
type Story = StoryObj<typeof meta>;
|
||||
|
||||
export const Default: Story = {};
|
||||
|
||||
export const WithLabel: Story = {
|
||||
args: {
|
||||
label: 'Email Address',
|
||||
placeholder: 'name@example.com',
|
||||
},
|
||||
};
|
||||
|
||||
export const WithIcon: Story = {
|
||||
args: {
|
||||
label: 'Email',
|
||||
icon: <Mail className="w-4 h-4" />,
|
||||
placeholder: 'Email',
|
||||
},
|
||||
};
|
||||
|
||||
export const Password: Story = {
|
||||
args: {
|
||||
label: 'Password',
|
||||
type: 'password',
|
||||
icon: <Lock className="w-4 h-4" />,
|
||||
placeholder: 'Password',
|
||||
},
|
||||
};
|
||||
|
||||
export const Search: Story = {
|
||||
render: (args) => <SearchInput {...args} />,
|
||||
args: {
|
||||
placeholder: 'Search...',
|
||||
},
|
||||
};
|
||||
54
apps/web/src/stories/Button.stories.ts
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
|
||||
// import { fn } from 'storybook/test';
|
||||
|
||||
import { Button } from './Button';
|
||||
|
||||
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export
|
||||
const meta = {
|
||||
title: 'Example/Button',
|
||||
component: Button,
|
||||
parameters: {
|
||||
// Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/configure/story-layout
|
||||
layout: 'centered',
|
||||
},
|
||||
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
|
||||
tags: ['autodocs'],
|
||||
// More on argTypes: https://storybook.js.org/docs/api/argtypes
|
||||
argTypes: {
|
||||
backgroundColor: { control: 'color' },
|
||||
},
|
||||
// Use `fn` to spy on the onClick arg, which will appear in the actions panel once invoked: https://storybook.js.org/docs/essentials/actions#story-args
|
||||
// args: { onClick: fn() },
|
||||
} satisfies Meta<typeof Button>;
|
||||
|
||||
export default meta;
|
||||
type Story = StoryObj<typeof meta>;
|
||||
|
||||
// More on writing stories with args: https://storybook.js.org/docs/writing-stories/args
|
||||
export const Primary: Story = {
|
||||
args: {
|
||||
primary: true,
|
||||
label: 'Button',
|
||||
},
|
||||
};
|
||||
|
||||
export const Secondary: Story = {
|
||||
args: {
|
||||
label: 'Button',
|
||||
},
|
||||
};
|
||||
|
||||
export const Large: Story = {
|
||||
args: {
|
||||
size: 'large',
|
||||
label: 'Button',
|
||||
},
|
||||
};
|
||||
|
||||
export const Small: Story = {
|
||||
args: {
|
||||
size: 'small',
|
||||
label: 'Button',
|
||||
},
|
||||
};
|
||||
37
apps/web/src/stories/Button.tsx
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
import React from 'react';
|
||||
|
||||
import './button.css';
|
||||
|
||||
export interface ButtonProps {
|
||||
/** Is this the principal call to action on the page? */
|
||||
primary?: boolean;
|
||||
/** What background color to use */
|
||||
backgroundColor?: string;
|
||||
/** How large should the button be? */
|
||||
size?: 'small' | 'medium' | 'large';
|
||||
/** Button contents */
|
||||
label: string;
|
||||
/** Optional click handler */
|
||||
onClick?: () => void;
|
||||
}
|
||||
|
||||
/** Primary UI component for user interaction */
|
||||
export const Button = ({
|
||||
primary = false,
|
||||
size = 'medium',
|
||||
backgroundColor,
|
||||
label,
|
||||
...props
|
||||
}: ButtonProps) => {
|
||||
const mode = primary ? 'storybook-button--primary' : 'storybook-button--secondary';
|
||||
return (
|
||||
<button
|
||||
type="button"
|
||||
className={['storybook-button', `storybook-button--${size}`, mode].join(' ')}
|
||||
style={{ backgroundColor }}
|
||||
{...props}
|
||||
>
|
||||
{label}
|
||||
</button>
|
||||
);
|
||||
};
|
||||
364
apps/web/src/stories/Configure.mdx
Normal file
|
|
@ -0,0 +1,364 @@
|
|||
import { Meta } from "@storybook/addon-docs/blocks";
|
||||
|
||||
import Github from "./assets/github.svg";
|
||||
import Discord from "./assets/discord.svg";
|
||||
import Youtube from "./assets/youtube.svg";
|
||||
import Tutorials from "./assets/tutorials.svg";
|
||||
import Styling from "./assets/styling.png";
|
||||
import Context from "./assets/context.png";
|
||||
import Assets from "./assets/assets.png";
|
||||
import Docs from "./assets/docs.png";
|
||||
import Share from "./assets/share.png";
|
||||
import FigmaPlugin from "./assets/figma-plugin.png";
|
||||
import Testing from "./assets/testing.png";
|
||||
import Accessibility from "./assets/accessibility.png";
|
||||
import Theming from "./assets/theming.png";
|
||||
import AddonLibrary from "./assets/addon-library.png";
|
||||
|
||||
export const RightArrow = () => <svg
|
||||
viewBox="0 0 14 14"
|
||||
width="8px"
|
||||
height="14px"
|
||||
style={{
|
||||
marginLeft: '4px',
|
||||
display: 'inline-block',
|
||||
shapeRendering: 'inherit',
|
||||
verticalAlign: 'middle',
|
||||
fill: 'currentColor',
|
||||
'path fill': 'currentColor'
|
||||
}}
|
||||
>
|
||||
<path d="m11.1 7.35-5.5 5.5a.5.5 0 0 1-.7-.7L10.04 7 4.9 1.85a.5.5 0 1 1 .7-.7l5.5 5.5c.2.2.2.5 0 .7Z" />
|
||||
</svg>
|
||||
|
||||
<Meta title="Configure your project" />
|
||||
|
||||
<div className="sb-container">
|
||||
<div className='sb-section-title'>
|
||||
# Configure your project
|
||||
|
||||
Because Storybook works separately from your app, you'll need to configure it for your specific stack and setup. Below, explore guides for configuring Storybook with popular frameworks and tools. If you get stuck, learn how you can ask for help from our community.
|
||||
</div>
|
||||
<div className="sb-section">
|
||||
<div className="sb-section-item">
|
||||
<img
|
||||
src={Styling}
|
||||
alt="A wall of logos representing different styling technologies"
|
||||
/>
|
||||
<h4 className="sb-section-item-heading">Add styling and CSS</h4>
|
||||
<p className="sb-section-item-paragraph">Like with web applications, there are many ways to include CSS within Storybook. Learn more about setting up styling within Storybook.</p>
|
||||
<a
|
||||
href="https://storybook.js.org/docs/configure/styling-and-css/?renderer=react&ref=configure"
|
||||
target="_blank"
|
||||
>Learn more<RightArrow /></a>
|
||||
</div>
|
||||
<div className="sb-section-item">
|
||||
<img
|
||||
src={Context}
|
||||
alt="An abstraction representing the composition of data for a component"
|
||||
/>
|
||||
<h4 className="sb-section-item-heading">Provide context and mocking</h4>
|
||||
<p className="sb-section-item-paragraph">Often when a story doesn't render, it's because your component is expecting a specific environment or context (like a theme provider) to be available.</p>
|
||||
<a
|
||||
href="https://storybook.js.org/docs/writing-stories/decorators/?renderer=react&ref=configure#context-for-mocking"
|
||||
target="_blank"
|
||||
>Learn more<RightArrow /></a>
|
||||
</div>
|
||||
<div className="sb-section-item">
|
||||
<img src={Assets} alt="A representation of typography and image assets" />
|
||||
<div>
|
||||
<h4 className="sb-section-item-heading">Load assets and resources</h4>
|
||||
<p className="sb-section-item-paragraph">To link static files (like fonts) to your projects and stories, use the
|
||||
`staticDirs` configuration option to specify folders to load when
|
||||
starting Storybook.</p>
|
||||
<a
|
||||
href="https://storybook.js.org/docs/configure/images-and-assets/?renderer=react&ref=configure"
|
||||
target="_blank"
|
||||
>Learn more<RightArrow /></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="sb-container">
|
||||
<div className='sb-section-title'>
|
||||
# Do more with Storybook
|
||||
|
||||
Now that you know the basics, let's explore other parts of Storybook that will improve your experience. This list is just to get you started. You can customise Storybook in many ways to fit your needs.
|
||||
</div>
|
||||
|
||||
<div className="sb-section">
|
||||
<div className="sb-features-grid">
|
||||
<div className="sb-grid-item">
|
||||
<img src={Docs} alt="A screenshot showing the autodocs tag being set, pointing a docs page being generated" />
|
||||
<h4 className="sb-section-item-heading">Autodocs</h4>
|
||||
<p className="sb-section-item-paragraph">Auto-generate living,
|
||||
interactive reference documentation from your components and stories.</p>
|
||||
<a
|
||||
href="https://storybook.js.org/docs/writing-docs/autodocs/?renderer=react&ref=configure"
|
||||
target="_blank"
|
||||
>Learn more<RightArrow /></a>
|
||||
</div>
|
||||
<div className="sb-grid-item">
|
||||
<img src={Share} alt="A browser window showing a Storybook being published to a chromatic.com URL" />
|
||||
<h4 className="sb-section-item-heading">Publish to Chromatic</h4>
|
||||
<p className="sb-section-item-paragraph">Publish your Storybook to review and collaborate with your entire team.</p>
|
||||
<a
|
||||
href="https://storybook.js.org/docs/sharing/publish-storybook/?renderer=react&ref=configure#publish-storybook-with-chromatic"
|
||||
target="_blank"
|
||||
>Learn more<RightArrow /></a>
|
||||
</div>
|
||||
<div className="sb-grid-item">
|
||||
<img src={FigmaPlugin} alt="Windows showing the Storybook plugin in Figma" />
|
||||
<h4 className="sb-section-item-heading">Figma Plugin</h4>
|
||||
<p className="sb-section-item-paragraph">Embed your stories into Figma to cross-reference the design and live
|
||||
implementation in one place.</p>
|
||||
<a
|
||||
href="https://storybook.js.org/docs/sharing/design-integrations/?renderer=react&ref=configure#embed-storybook-in-figma-with-the-plugin"
|
||||
target="_blank"
|
||||
>Learn more<RightArrow /></a>
|
||||
</div>
|
||||
<div className="sb-grid-item">
|
||||
<img src={Testing} alt="Screenshot of tests passing and failing" />
|
||||
<h4 className="sb-section-item-heading">Testing</h4>
|
||||
<p className="sb-section-item-paragraph">Use stories to test a component in all its variations, no matter how
|
||||
complex.</p>
|
||||
<a
|
||||
href="https://storybook.js.org/docs/writing-tests/?renderer=react&ref=configure"
|
||||
target="_blank"
|
||||
>Learn more<RightArrow /></a>
|
||||
</div>
|
||||
<div className="sb-grid-item">
|
||||
<img src={Accessibility} alt="Screenshot of accessibility tests passing and failing" />
|
||||
<h4 className="sb-section-item-heading">Accessibility</h4>
|
||||
<p className="sb-section-item-paragraph">Automatically test your components for a11y issues as you develop.</p>
|
||||
<a
|
||||
href="https://storybook.js.org/docs/writing-tests/accessibility-testing/?renderer=react&ref=configure"
|
||||
target="_blank"
|
||||
>Learn more<RightArrow /></a>
|
||||
</div>
|
||||
<div className="sb-grid-item">
|
||||
<img src={Theming} alt="Screenshot of Storybook in light and dark mode" />
|
||||
<h4 className="sb-section-item-heading">Theming</h4>
|
||||
<p className="sb-section-item-paragraph">Theme Storybook's UI to personalize it to your project.</p>
|
||||
<a
|
||||
href="https://storybook.js.org/docs/configure/theming/?renderer=react&ref=configure"
|
||||
target="_blank"
|
||||
>Learn more<RightArrow /></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className='sb-addon'>
|
||||
<div className='sb-addon-text'>
|
||||
<h4>Addons</h4>
|
||||
<p className="sb-section-item-paragraph">Integrate your tools with Storybook to connect workflows.</p>
|
||||
<a
|
||||
href="https://storybook.js.org/addons/?ref=configure"
|
||||
target="_blank"
|
||||
>Discover all addons<RightArrow /></a>
|
||||
</div>
|
||||
<div className='sb-addon-img'>
|
||||
<img src={AddonLibrary} alt="Integrate your tools with Storybook to connect workflows." />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="sb-section sb-socials">
|
||||
<div className="sb-section-item">
|
||||
<img src={Github} alt="Github logo" className="sb-explore-image"/>
|
||||
Join our contributors building the future of UI development.
|
||||
|
||||
<a
|
||||
href="https://github.com/storybookjs/storybook"
|
||||
target="_blank"
|
||||
>Star on GitHub<RightArrow /></a>
|
||||
</div>
|
||||
<div className="sb-section-item">
|
||||
<img src={Discord} alt="Discord logo" className="sb-explore-image"/>
|
||||
<div>
|
||||
Get support and chat with frontend developers.
|
||||
|
||||
<a
|
||||
href="https://discord.gg/storybook"
|
||||
target="_blank"
|
||||
>Join Discord server<RightArrow /></a>
|
||||
</div>
|
||||
</div>
|
||||
<div className="sb-section-item">
|
||||
<img src={Youtube} alt="Youtube logo" className="sb-explore-image"/>
|
||||
<div>
|
||||
Watch tutorials, feature previews and interviews.
|
||||
|
||||
<a
|
||||
href="https://www.youtube.com/@chromaticui"
|
||||
target="_blank"
|
||||
>Watch on YouTube<RightArrow /></a>
|
||||
</div>
|
||||
</div>
|
||||
<div className="sb-section-item">
|
||||
<img src={Tutorials} alt="A book" className="sb-explore-image"/>
|
||||
<p>Follow guided walkthroughs on for key workflows.</p>
|
||||
|
||||
<a
|
||||
href="https://storybook.js.org/tutorials/?ref=configure"
|
||||
target="_blank"
|
||||
>Discover tutorials<RightArrow /></a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
{`
|
||||
.sb-container {
|
||||
margin-bottom: 48px;
|
||||
}
|
||||
|
||||
.sb-section {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
gap: 20px;
|
||||
}
|
||||
|
||||
img {
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
.sb-section-title {
|
||||
margin-bottom: 32px;
|
||||
}
|
||||
|
||||
.sb-section a:not(h1 a, h2 a, h3 a) {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.sb-section-item, .sb-grid-item {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.sb-section-item-heading {
|
||||
padding-top: 20px !important;
|
||||
padding-bottom: 5px !important;
|
||||
margin: 0 !important;
|
||||
}
|
||||
.sb-section-item-paragraph {
|
||||
margin: 0;
|
||||
padding-bottom: 10px;
|
||||
}
|
||||
|
||||
.sb-chevron {
|
||||
margin-left: 5px;
|
||||
}
|
||||
|
||||
.sb-features-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
grid-gap: 32px 20px;
|
||||
}
|
||||
|
||||
.sb-socials {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(4, 1fr);
|
||||
}
|
||||
|
||||
.sb-socials p {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.sb-explore-image {
|
||||
max-height: 32px;
|
||||
align-self: flex-start;
|
||||
}
|
||||
|
||||
.sb-addon {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
position: relative;
|
||||
background-color: #EEF3F8;
|
||||
border-radius: 5px;
|
||||
border: 1px solid rgba(0, 0, 0, 0.05);
|
||||
background: #EEF3F8;
|
||||
height: 180px;
|
||||
margin-bottom: 48px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.sb-addon-text {
|
||||
padding-left: 48px;
|
||||
max-width: 240px;
|
||||
}
|
||||
|
||||
.sb-addon-text h4 {
|
||||
padding-top: 0px;
|
||||
}
|
||||
|
||||
.sb-addon-img {
|
||||
position: absolute;
|
||||
left: 345px;
|
||||
top: 0;
|
||||
height: 100%;
|
||||
width: 200%;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.sb-addon-img img {
|
||||
width: 650px;
|
||||
transform: rotate(-15deg);
|
||||
margin-left: 40px;
|
||||
margin-top: -72px;
|
||||
box-shadow: 0 0 1px rgba(255, 255, 255, 0);
|
||||
backface-visibility: hidden;
|
||||
}
|
||||
|
||||
@media screen and (max-width: 800px) {
|
||||
.sb-addon-img {
|
||||
left: 300px;
|
||||
}
|
||||
}
|
||||
|
||||
@media screen and (max-width: 600px) {
|
||||
.sb-section {
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.sb-features-grid {
|
||||
grid-template-columns: repeat(1, 1fr);
|
||||
}
|
||||
|
||||
.sb-socials {
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
}
|
||||
|
||||
.sb-addon {
|
||||
height: 280px;
|
||||
align-items: flex-start;
|
||||
padding-top: 32px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.sb-addon-text {
|
||||
padding-left: 24px;
|
||||
}
|
||||
|
||||
.sb-addon-img {
|
||||
right: 0;
|
||||
left: 0;
|
||||
top: 130px;
|
||||
bottom: 0;
|
||||
overflow: hidden;
|
||||
height: auto;
|
||||
width: 124%;
|
||||
}
|
||||
|
||||
.sb-addon-img img {
|
||||
width: 1200px;
|
||||
transform: rotate(-12deg);
|
||||
margin-left: 0;
|
||||
margin-top: 48px;
|
||||
margin-bottom: -40px;
|
||||
margin-left: -24px;
|
||||
}
|
||||
}
|
||||
`}
|
||||
</style>
|
||||
34
apps/web/src/stories/Header.stories.ts
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
|
||||
// import { fn } from 'storybook/test';
|
||||
|
||||
import { Header } from './Header';
|
||||
|
||||
const meta = {
|
||||
title: 'Example/Header',
|
||||
component: Header,
|
||||
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
|
||||
tags: ['autodocs'],
|
||||
parameters: {
|
||||
// More on how to position stories at: https://storybook.js.org/docs/configure/story-layout
|
||||
layout: 'fullscreen',
|
||||
},
|
||||
args: {
|
||||
onLogin: () => { },
|
||||
onLogout: () => { },
|
||||
onCreateAccount: () => { },
|
||||
},
|
||||
} satisfies Meta<typeof Header>;
|
||||
|
||||
export default meta;
|
||||
type Story = StoryObj<typeof meta>;
|
||||
|
||||
export const LoggedIn: Story = {
|
||||
args: {
|
||||
user: {
|
||||
name: 'Jane Doe',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export const LoggedOut: Story = {};
|
||||
56
apps/web/src/stories/Header.tsx
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
import React from 'react';
|
||||
|
||||
import { Button } from './Button';
|
||||
import './header.css';
|
||||
|
||||
type User = {
|
||||
name: string;
|
||||
};
|
||||
|
||||
export interface HeaderProps {
|
||||
user?: User;
|
||||
onLogin?: () => void;
|
||||
onLogout?: () => void;
|
||||
onCreateAccount?: () => void;
|
||||
}
|
||||
|
||||
export const Header = ({ user, onLogin, onLogout, onCreateAccount }: HeaderProps) => (
|
||||
<header>
|
||||
<div className="storybook-header">
|
||||
<div>
|
||||
<svg width="32" height="32" viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg">
|
||||
<g fill="none" fillRule="evenodd">
|
||||
<path
|
||||
d="M10 0h12a10 10 0 0110 10v12a10 10 0 01-10 10H10A10 10 0 010 22V10A10 10 0 0110 0z"
|
||||
fill="#FFF"
|
||||
/>
|
||||
<path
|
||||
d="M5.3 10.6l10.4 6v11.1l-10.4-6v-11zm11.4-6.2l9.7 5.5-9.7 5.6V4.4z"
|
||||
fill="#555AB9"
|
||||
/>
|
||||
<path
|
||||
d="M27.2 10.6v11.2l-10.5 6V16.5l10.5-6zM15.7 4.4v11L6 10l9.7-5.5z"
|
||||
fill="#91BAF8"
|
||||
/>
|
||||
</g>
|
||||
</svg>
|
||||
<h1>Acme</h1>
|
||||
</div>
|
||||
<div>
|
||||
{user ? (
|
||||
<>
|
||||
<span className="welcome">
|
||||
Welcome, <b>{user.name}</b>!
|
||||
</span>
|
||||
<Button size="small" onClick={onLogout} label="Log out" />
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<Button size="small" onClick={onLogin} label="Log in" />
|
||||
<Button primary size="small" onClick={onCreateAccount} label="Sign up" />
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
);
|
||||
33
apps/web/src/stories/Page.stories.ts
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
|
||||
// import { expect, userEvent, within } from 'storybook/test';
|
||||
|
||||
import { Page } from './Page';
|
||||
|
||||
const meta = {
|
||||
title: 'Example/Page',
|
||||
component: Page,
|
||||
parameters: {
|
||||
// More on how to position stories at: https://storybook.js.org/docs/configure/story-layout
|
||||
layout: 'fullscreen',
|
||||
},
|
||||
} satisfies Meta<typeof Page>;
|
||||
|
||||
export default meta;
|
||||
type Story = StoryObj<typeof meta>;
|
||||
|
||||
export const LoggedOut: Story = {};
|
||||
|
||||
// More on component testing: https://storybook.js.org/docs/writing-tests/interaction-testing
|
||||
export const LoggedIn: Story = {
|
||||
// play: async ({ canvasElement }) => {
|
||||
// const canvas = within(canvasElement);
|
||||
// const loginButton = canvas.getByRole('button', { name: /Log in/i });
|
||||
// await expect(loginButton).toBeInTheDocument();
|
||||
// await userEvent.click(loginButton);
|
||||
// await expect(loginButton).not.toBeInTheDocument();
|
||||
//
|
||||
// const logoutButton = canvas.getByRole('button', { name: /Log out/i });
|
||||
// await expect(logoutButton).toBeInTheDocument();
|
||||
// },
|
||||
};
|
||||
73
apps/web/src/stories/Page.tsx
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
import React from 'react';
|
||||
|
||||
import { Header } from './Header';
|
||||
import './page.css';
|
||||
|
||||
type User = {
|
||||
name: string;
|
||||
};
|
||||
|
||||
export const Page: React.FC = () => {
|
||||
const [user, setUser] = React.useState<User>();
|
||||
|
||||
return (
|
||||
<article>
|
||||
<Header
|
||||
user={user}
|
||||
onLogin={() => setUser({ name: 'Jane Doe' })}
|
||||
onLogout={() => setUser(undefined)}
|
||||
onCreateAccount={() => setUser({ name: 'Jane Doe' })}
|
||||
/>
|
||||
|
||||
<section className="storybook-page">
|
||||
<h2>Pages in Storybook</h2>
|
||||
<p>
|
||||
We recommend building UIs with a{' '}
|
||||
<a href="https://componentdriven.org" target="_blank" rel="noopener noreferrer">
|
||||
<strong>component-driven</strong>
|
||||
</a>{' '}
|
||||
process starting with atomic components and ending with pages.
|
||||
</p>
|
||||
<p>
|
||||
Render pages with mock data. This makes it easy to build and review page states without
|
||||
needing to navigate to them in your app. Here are some handy patterns for managing page
|
||||
data in Storybook:
|
||||
</p>
|
||||
<ul>
|
||||
<li>
|
||||
Use a higher-level connected component. Storybook helps you compose such data from the
|
||||
"args" of child component stories
|
||||
</li>
|
||||
<li>
|
||||
Assemble data in the page component from your services. You can mock these services out
|
||||
using Storybook.
|
||||
</li>
|
||||
</ul>
|
||||
<p>
|
||||
Get a guided tutorial on component-driven development at{' '}
|
||||
<a href="https://storybook.js.org/tutorials/" target="_blank" rel="noopener noreferrer">
|
||||
Storybook tutorials
|
||||
</a>
|
||||
. Read more in the{' '}
|
||||
<a href="https://storybook.js.org/docs" target="_blank" rel="noopener noreferrer">
|
||||
docs
|
||||
</a>
|
||||
.
|
||||
</p>
|
||||
<div className="tip-wrapper">
|
||||
<span className="tip">Tip</span> Adjust the width of the canvas with the{' '}
|
||||
<svg width="10" height="10" viewBox="0 0 12 12" xmlns="http://www.w3.org/2000/svg">
|
||||
<g fill="none" fillRule="evenodd">
|
||||
<path
|
||||
d="M1.5 5.2h4.8c.3 0 .5.2.5.4v5.1c-.1.2-.3.3-.4.3H1.4a.5.5 0 01-.5-.4V5.7c0-.3.2-.5.5-.5zm0-2.1h6.9c.3 0 .5.2.5.4v7a.5.5 0 01-1 0V4H1.5a.5.5 0 010-1zm0-2.1h9c.3 0 .5.2.5.4v9.1a.5.5 0 01-1 0V2H1.5a.5.5 0 010-1zm4.3 5.2H2V10h3.8V6.2z"
|
||||
id="a"
|
||||
fill="#999"
|
||||
/>
|
||||
</g>
|
||||
</svg>
|
||||
Viewports addon in the toolbar
|
||||
</div>
|
||||
</section>
|
||||
</article>
|
||||
);
|
||||
};
|
||||
BIN
apps/web/src/stories/assets/accessibility.png
Normal file
|
After Width: | Height: | Size: 41 KiB |
1
apps/web/src/stories/assets/accessibility.svg
Normal file
|
|
@ -0,0 +1 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" fill="none" viewBox="0 0 48 48"><title>Accessibility</title><circle cx="24.334" cy="24" r="24" fill="#A849FF" fill-opacity=".3"/><path fill="#A470D5" fill-rule="evenodd" d="M27.8609 11.585C27.8609 9.59506 26.2497 7.99023 24.2519 7.99023C22.254 7.99023 20.6429 9.65925 20.6429 11.585C20.6429 13.575 22.254 15.1799 24.2519 15.1799C26.2497 15.1799 27.8609 13.575 27.8609 11.585ZM21.8922 22.6473C21.8467 23.9096 21.7901 25.4788 21.5897 26.2771C20.9853 29.0462 17.7348 36.3314 17.3325 37.2275C17.1891 37.4923 17.1077 37.7955 17.1077 38.1178C17.1077 39.1519 17.946 39.9902 18.9802 39.9902C19.6587 39.9902 20.253 39.6293 20.5814 39.0889L20.6429 38.9874L24.2841 31.22C24.2841 31.22 27.5529 37.9214 27.9238 38.6591C28.2948 39.3967 28.8709 39.9902 29.7168 39.9902C30.751 39.9902 31.5893 39.1519 31.5893 38.1178C31.5893 37.7951 31.3639 37.2265 31.3639 37.2265C30.9581 36.3258 27.698 29.0452 27.0938 26.2771C26.8975 25.4948 26.847 23.9722 26.8056 22.7236C26.7927 22.333 26.7806 21.9693 26.7653 21.6634C26.7008 21.214 27.0231 20.8289 27.4097 20.7005L35.3366 18.3253C36.3033 18.0685 36.8834 16.9773 36.6256 16.0144C36.3678 15.0515 35.2722 14.4737 34.3055 14.7305C34.3055 14.7305 26.8619 17.1057 24.2841 17.1057C21.7062 17.1057 14.456 14.7947 14.456 14.7947C13.4893 14.5379 12.3937 14.9873 12.0715 15.9502C11.7493 16.9131 12.3293 18.0044 13.3604 18.3253L21.2873 20.7005C21.674 20.8289 21.9318 21.214 21.9318 21.6634C21.9174 21.9493 21.9053 22.2857 21.8922 22.6473Z" clip-rule="evenodd"/></svg>
|
||||
|
After Width: | Height: | Size: 1.5 KiB |
BIN
apps/web/src/stories/assets/addon-library.png
Normal file
|
After Width: | Height: | Size: 456 KiB |
BIN
apps/web/src/stories/assets/assets.png
Normal file
|
After Width: | Height: | Size: 3.8 KiB |
BIN
apps/web/src/stories/assets/avif-test-image.avif
Normal file
BIN
apps/web/src/stories/assets/context.png
Normal file
|
After Width: | Height: | Size: 6 KiB |
1
apps/web/src/stories/assets/discord.svg
Normal file
|
|
@ -0,0 +1 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" width="33" height="32" fill="none" viewBox="0 0 33 32"><g clip-path="url(#clip0_10031_177575)"><mask id="mask0_10031_177575" style="mask-type:luminance" width="33" height="25" x="0" y="4" maskUnits="userSpaceOnUse"><path fill="#fff" d="M32.5034 4.00195H0.503906V28.7758H32.5034V4.00195Z"/></mask><g mask="url(#mask0_10031_177575)"><path fill="#5865F2" d="M27.5928 6.20817C25.5533 5.27289 23.3662 4.58382 21.0794 4.18916C21.0378 4.18154 20.9962 4.20057 20.9747 4.23864C20.6935 4.73863 20.3819 5.3909 20.1637 5.90358C17.7042 5.53558 15.2573 5.53558 12.8481 5.90358C12.6299 5.37951 12.307 4.73863 12.0245 4.23864C12.003 4.20184 11.9614 4.18281 11.9198 4.18916C9.63431 4.58255 7.44721 5.27163 5.40641 6.20817C5.38874 6.21578 5.3736 6.22848 5.36355 6.24497C1.21508 12.439 0.078646 18.4809 0.636144 24.4478C0.638667 24.477 0.655064 24.5049 0.677768 24.5227C3.41481 26.5315 6.06609 27.7511 8.66815 28.5594C8.70979 28.5721 8.75392 28.5569 8.78042 28.5226C9.39594 27.6826 9.94461 26.7968 10.4151 25.8653C10.4428 25.8107 10.4163 25.746 10.3596 25.7244C9.48927 25.3945 8.66058 24.9922 7.86343 24.5354C7.80038 24.4986 7.79533 24.4084 7.85333 24.3653C8.02108 24.2397 8.18888 24.109 8.34906 23.977C8.37804 23.9529 8.41842 23.9478 8.45249 23.963C13.6894 26.3526 19.359 26.3526 24.5341 23.963C24.5682 23.9465 24.6086 23.9516 24.6388 23.9757C24.799 24.1077 24.9668 24.2397 25.1358 24.3653C25.1938 24.4084 25.19 24.4986 25.127 24.5354C24.3298 25.0011 23.5011 25.3945 22.6296 25.7232C22.5728 25.7447 22.5476 25.8107 22.5754 25.8653C23.0559 26.7955 23.6046 27.6812 24.2087 28.5213C24.234 28.5569 24.2794 28.5721 24.321 28.5594C26.9357 27.7511 29.5869 26.5315 32.324 24.5227C32.348 24.5049 32.3631 24.4783 32.3656 24.4491C33.0328 17.5506 31.2481 11.5584 27.6344 6.24623C27.6256 6.22848 27.6105 6.21578 27.5928 6.20817ZM11.1971 20.8146C9.62043 20.8146 8.32129 19.3679 8.32129 17.5913C8.32129 15.8146 9.59523 14.368 11.1971 14.368C12.8115 14.368 14.0981 15.8273 14.0729 17.5913C14.0729 19.3679 12.7989 20.8146 11.1971 20.8146ZM21.8299 20.8146C20.2533 20.8146 18.9541 19.3679 18.9541 17.5913C18.9541 15.8146 20.228 14.368 21.8299 14.368C23.4444 14.368 24.7309 15.8273 24.7057 17.5913C24.7057 19.3679 23.4444 20.8146 21.8299 20.8146Z"/></g></g><defs><clipPath id="clip0_10031_177575"><rect width="32" height="32" fill="#fff" transform="translate(0.5)"/></clipPath></defs></svg>
|
||||
|
After Width: | Height: | Size: 2.3 KiB |
BIN
apps/web/src/stories/assets/docs.png
Normal file
|
After Width: | Height: | Size: 27 KiB |
BIN
apps/web/src/stories/assets/figma-plugin.png
Normal file
|
After Width: | Height: | Size: 43 KiB |
1
apps/web/src/stories/assets/github.svg
Normal file
|
|
@ -0,0 +1 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="none" viewBox="0 0 32 32"><path fill="#161614" d="M16.0001 0C7.16466 0 0 7.17472 0 16.0256C0 23.1061 4.58452 29.1131 10.9419 31.2322C11.7415 31.3805 12.0351 30.8845 12.0351 30.4613C12.0351 30.0791 12.0202 28.8167 12.0133 27.4776C7.56209 28.447 6.62283 25.5868 6.62283 25.5868C5.89499 23.7345 4.8463 23.2419 4.8463 23.2419C3.39461 22.2473 4.95573 22.2678 4.95573 22.2678C6.56242 22.3808 7.40842 23.9192 7.40842 23.9192C8.83547 26.3691 11.1514 25.6609 12.0645 25.2514C12.2081 24.2156 12.6227 23.5087 13.0803 23.1085C9.52648 22.7032 5.7906 21.3291 5.7906 15.1886C5.7906 13.4389 6.41563 12.0094 7.43916 10.8871C7.27303 10.4834 6.72537 8.85349 7.59415 6.64609C7.59415 6.64609 8.93774 6.21539 11.9953 8.28877C13.2716 7.9337 14.6404 7.75563 16.0001 7.74953C17.3599 7.75563 18.7297 7.9337 20.0084 8.28877C23.0623 6.21539 24.404 6.64609 24.404 6.64609C25.2749 8.85349 24.727 10.4834 24.5608 10.8871C25.5868 12.0094 26.2075 13.4389 26.2075 15.1886C26.2075 21.3437 22.4645 22.699 18.9017 23.0957C19.4756 23.593 19.9869 24.5683 19.9869 26.0634C19.9869 28.2077 19.9684 29.9334 19.9684 30.4613C19.9684 30.8877 20.2564 31.3874 21.0674 31.2301C27.4213 29.1086 32 23.1037 32 16.0256C32 7.17472 24.8364 0 16.0001 0ZM5.99257 22.8288C5.95733 22.9084 5.83227 22.9322 5.71834 22.8776C5.60229 22.8253 5.53711 22.7168 5.57474 22.6369C5.60918 22.5549 5.7345 22.5321 5.85029 22.587C5.9666 22.6393 6.03284 22.7489 5.99257 22.8288ZM6.7796 23.5321C6.70329 23.603 6.55412 23.5701 6.45291 23.4581C6.34825 23.3464 6.32864 23.197 6.40601 23.125C6.4847 23.0542 6.62937 23.0874 6.73429 23.1991C6.83895 23.3121 6.85935 23.4605 6.7796 23.5321ZM7.31953 24.4321C7.2215 24.5003 7.0612 24.4363 6.96211 24.2938C6.86407 24.1513 6.86407 23.9804 6.96422 23.9119C7.06358 23.8435 7.2215 23.905 7.32191 24.0465C7.41968 24.1914 7.41968 24.3623 7.31953 24.4321ZM8.23267 25.4743C8.14497 25.5712 7.95818 25.5452 7.82146 25.413C7.68156 25.2838 7.64261 25.1004 7.73058 25.0035C7.81934 24.9064 8.00719 24.9337 8.14497 25.0648C8.28381 25.1938 8.3262 25.3785 8.23267 25.4743ZM9.41281 25.8262C9.37413 25.9517 9.19423 26.0088 9.013 25.9554C8.83203 25.9005 8.7136 25.7535 8.75016 25.6266C8.78778 25.5003 8.96848 25.4408 9.15104 25.4979C9.33174 25.5526 9.45044 25.6985 9.41281 25.8262ZM10.7559 25.9754C10.7604 26.1076 10.6067 26.2172 10.4165 26.2196C10.2252 26.2238 10.0704 26.1169 10.0683 25.9868C10.0683 25.8534 10.2185 25.7448 10.4098 25.7416C10.6001 25.7379 10.7559 25.8441 10.7559 25.9754ZM12.0753 25.9248C12.0981 26.0537 11.9658 26.1862 11.7769 26.2215C11.5912 26.2554 11.4192 26.1758 11.3957 26.0479C11.3726 25.9157 11.5072 25.7833 11.6927 25.7491C11.8819 25.7162 12.0512 25.7937 12.0753 25.9248Z"/></svg>
|
||||
|
After Width: | Height: | Size: 2.7 KiB |
BIN
apps/web/src/stories/assets/share.png
Normal file
|
After Width: | Height: | Size: 40 KiB |
BIN
apps/web/src/stories/assets/styling.png
Normal file
|
After Width: | Height: | Size: 7.1 KiB |
BIN
apps/web/src/stories/assets/testing.png
Normal file
|
After Width: | Height: | Size: 48 KiB |
BIN
apps/web/src/stories/assets/theming.png
Normal file
|
After Width: | Height: | Size: 43 KiB |
1
apps/web/src/stories/assets/tutorials.svg
Normal file
|
|
@ -0,0 +1 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" width="33" height="32" fill="none" viewBox="0 0 33 32"><g clip-path="url(#clip0_10031_177597)"><path fill="#B7F0EF" fill-rule="evenodd" d="M17 7.87059C17 6.48214 17.9812 5.28722 19.3431 5.01709L29.5249 2.99755C31.3238 2.64076 33 4.01717 33 5.85105V22.1344C33 23.5229 32.0188 24.7178 30.6569 24.9879L20.4751 27.0074C18.6762 27.3642 17 25.9878 17 24.1539L17 7.87059Z" clip-rule="evenodd" opacity=".7"/><path fill="#87E6E5" fill-rule="evenodd" d="M1 5.85245C1 4.01857 2.67623 2.64215 4.47507 2.99895L14.6569 5.01848C16.0188 5.28861 17 6.48354 17 7.87198V24.1553C17 25.9892 15.3238 27.3656 13.5249 27.0088L3.34311 24.9893C1.98119 24.7192 1 23.5242 1 22.1358V5.85245Z" clip-rule="evenodd"/><path fill="#61C1FD" fill-rule="evenodd" d="M15.543 5.71289C15.543 5.71289 16.8157 5.96289 17.4002 6.57653C17.9847 7.19016 18.4521 9.03107 18.4521 9.03107C18.4521 9.03107 18.4521 25.1106 18.4521 26.9629C18.4521 28.8152 19.3775 31.4174 19.3775 31.4174L17.4002 28.8947L16.2575 31.4174C16.2575 31.4174 15.543 29.0765 15.543 27.122C15.543 25.1674 15.543 5.71289 15.543 5.71289Z" clip-rule="evenodd"/></g><defs><clipPath id="clip0_10031_177597"><rect width="32" height="32" fill="#fff" transform="translate(0.5)"/></clipPath></defs></svg>
|
||||
|
After Width: | Height: | Size: 1.2 KiB |
1
apps/web/src/stories/assets/youtube.svg
Normal file
|
|
@ -0,0 +1 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="none" viewBox="0 0 32 32"><path fill="#ED1D24" d="M31.3313 8.44657C30.9633 7.08998 29.8791 6.02172 28.5022 5.65916C26.0067 5.00026 16 5.00026 16 5.00026C16 5.00026 5.99333 5.00026 3.4978 5.65916C2.12102 6.02172 1.03665 7.08998 0.668678 8.44657C0 10.9053 0 16.0353 0 16.0353C0 16.0353 0 21.1652 0.668678 23.6242C1.03665 24.9806 2.12102 26.0489 3.4978 26.4116C5.99333 27.0703 16 27.0703 16 27.0703C16 27.0703 26.0067 27.0703 28.5022 26.4116C29.8791 26.0489 30.9633 24.9806 31.3313 23.6242C32 21.1652 32 16.0353 32 16.0353C32 16.0353 32 10.9053 31.3313 8.44657Z"/><path fill="#fff" d="M12.7266 20.6934L21.0902 16.036L12.7266 11.3781V20.6934Z"/></svg>
|
||||
|
After Width: | Height: | Size: 716 B |
30
apps/web/src/stories/button.css
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
.storybook-button {
|
||||
display: inline-block;
|
||||
cursor: pointer;
|
||||
border: 0;
|
||||
border-radius: 3em;
|
||||
font-weight: 700;
|
||||
line-height: 1;
|
||||
font-family: 'Nunito Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
|
||||
}
|
||||
.storybook-button--primary {
|
||||
background-color: #555ab9;
|
||||
color: white;
|
||||
}
|
||||
.storybook-button--secondary {
|
||||
box-shadow: rgba(0, 0, 0, 0.15) 0px 0px 0px 1px inset;
|
||||
background-color: transparent;
|
||||
color: #333;
|
||||
}
|
||||
.storybook-button--small {
|
||||
padding: 10px 16px;
|
||||
font-size: 12px;
|
||||
}
|
||||
.storybook-button--medium {
|
||||
padding: 11px 20px;
|
||||
font-size: 14px;
|
||||
}
|
||||
.storybook-button--large {
|
||||
padding: 12px 24px;
|
||||
font-size: 16px;
|
||||
}
|
||||
32
apps/web/src/stories/header.css
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
.storybook-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
border-bottom: 1px solid rgba(0, 0, 0, 0.1);
|
||||
padding: 15px 20px;
|
||||
font-family: 'Nunito Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
|
||||
}
|
||||
|
||||
.storybook-header svg {
|
||||
display: inline-block;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
.storybook-header h1 {
|
||||
display: inline-block;
|
||||
vertical-align: top;
|
||||
margin: 6px 0 6px 10px;
|
||||
font-weight: 700;
|
||||
font-size: 20px;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.storybook-header button + button {
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
.storybook-header .welcome {
|
||||
margin-right: 10px;
|
||||
color: #333;
|
||||
font-size: 14px;
|
||||
}
|
||||
68
apps/web/src/stories/page.css
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
.storybook-page {
|
||||
margin: 0 auto;
|
||||
padding: 48px 20px;
|
||||
max-width: 600px;
|
||||
color: #333;
|
||||
font-size: 14px;
|
||||
line-height: 24px;
|
||||
font-family: 'Nunito Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
|
||||
}
|
||||
|
||||
.storybook-page h2 {
|
||||
display: inline-block;
|
||||
vertical-align: top;
|
||||
margin: 0 0 4px;
|
||||
font-weight: 700;
|
||||
font-size: 32px;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.storybook-page p {
|
||||
margin: 1em 0;
|
||||
}
|
||||
|
||||
.storybook-page a {
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
.storybook-page ul {
|
||||
margin: 1em 0;
|
||||
padding-left: 30px;
|
||||
}
|
||||
|
||||
.storybook-page li {
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.storybook-page .tip {
|
||||
display: inline-block;
|
||||
vertical-align: top;
|
||||
margin-right: 10px;
|
||||
border-radius: 1em;
|
||||
background: #e7fdd8;
|
||||
padding: 4px 12px;
|
||||
color: #357a14;
|
||||
font-weight: 700;
|
||||
font-size: 11px;
|
||||
line-height: 12px;
|
||||
}
|
||||
|
||||
.storybook-page .tip-wrapper {
|
||||
margin-top: 40px;
|
||||
margin-bottom: 40px;
|
||||
font-size: 13px;
|
||||
line-height: 20px;
|
||||
}
|
||||
|
||||
.storybook-page .tip-wrapper svg {
|
||||
display: inline-block;
|
||||
vertical-align: top;
|
||||
margin-top: 3px;
|
||||
margin-right: 4px;
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
}
|
||||
|
||||
.storybook-page .tip-wrapper svg path {
|
||||
fill: #1ea7fd;
|
||||
}
|
||||
|
|
@ -1,7 +1,14 @@
|
|||
import { defineConfig } from 'vitest/config';
|
||||
import react from '@vitejs/plugin-react';
|
||||
import path from 'path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import { storybookTest } from '@storybook/addon-vitest/vitest-plugin';
|
||||
const dirname =
|
||||
typeof __dirname !== 'undefined'
|
||||
? __dirname
|
||||
: path.dirname(fileURLToPath(import.meta.url));
|
||||
|
||||
// More info at: https://storybook.js.org/docs/next/writing-tests/integrations/vitest-addon
|
||||
export default defineConfig({
|
||||
plugins: [react()],
|
||||
test: {
|
||||
|
|
@ -30,6 +37,128 @@ export default defineConfig({
|
|||
},
|
||||
},
|
||||
},
|
||||
projects: [
|
||||
{
|
||||
extends: true,
|
||||
plugins: [
|
||||
// The plugin will run tests for the stories defined in your Storybook config
|
||||
// See options at: https://storybook.js.org/docs/next/writing-tests/integrations/vitest-addon#storybooktest
|
||||
storybookTest({
|
||||
configDir: path.join(dirname, '.storybook'),
|
||||
}),
|
||||
],
|
||||
test: {
|
||||
name: 'storybook',
|
||||
browser: {
|
||||
enabled: true,
|
||||
headless: true,
|
||||
provider: 'playwright',
|
||||
instances: [
|
||||
{
|
||||
browser: 'chromium',
|
||||
},
|
||||
],
|
||||
},
|
||||
setupFiles: ['.storybook/vitest.setup.ts'],
|
||||
},
|
||||
},
|
||||
{
|
||||
extends: true,
|
||||
plugins: [
|
||||
// The plugin will run tests for the stories defined in your Storybook config
|
||||
// See options at: https://storybook.js.org/docs/next/writing-tests/integrations/vitest-addon#storybooktest
|
||||
storybookTest({
|
||||
configDir: path.join(dirname, '.storybook'),
|
||||
}),
|
||||
],
|
||||
test: {
|
||||
name: 'storybook',
|
||||
browser: {
|
||||
enabled: true,
|
||||
headless: true,
|
||||
provider: 'playwright',
|
||||
instances: [
|
||||
{
|
||||
browser: 'chromium',
|
||||
},
|
||||
],
|
||||
},
|
||||
setupFiles: ['.storybook/vitest.setup.ts'],
|
||||
},
|
||||
},
|
||||
{
|
||||
extends: true,
|
||||
plugins: [
|
||||
// The plugin will run tests for the stories defined in your Storybook config
|
||||
// See options at: https://storybook.js.org/docs/next/writing-tests/integrations/vitest-addon#storybooktest
|
||||
storybookTest({
|
||||
configDir: path.join(dirname, '.storybook'),
|
||||
}),
|
||||
],
|
||||
test: {
|
||||
name: 'storybook',
|
||||
browser: {
|
||||
enabled: true,
|
||||
headless: true,
|
||||
provider: 'playwright',
|
||||
instances: [
|
||||
{
|
||||
browser: 'chromium',
|
||||
},
|
||||
],
|
||||
},
|
||||
setupFiles: ['.storybook/vitest.setup.ts'],
|
||||
},
|
||||
},
|
||||
{
|
||||
extends: true,
|
||||
plugins: [
|
||||
// The plugin will run tests for the stories defined in your Storybook config
|
||||
// See options at: https://storybook.js.org/docs/next/writing-tests/integrations/vitest-addon#storybooktest
|
||||
storybookTest({
|
||||
configDir: path.join(dirname, '.storybook'),
|
||||
}),
|
||||
],
|
||||
test: {
|
||||
name: 'storybook',
|
||||
browser: {
|
||||
enabled: true,
|
||||
headless: true,
|
||||
provider: 'playwright',
|
||||
instances: [
|
||||
{
|
||||
browser: 'chromium',
|
||||
},
|
||||
],
|
||||
},
|
||||
setupFiles: ['.storybook/vitest.setup.ts'],
|
||||
},
|
||||
},
|
||||
{
|
||||
extends: true,
|
||||
plugins: [
|
||||
// The plugin will run tests for the stories defined in your Storybook config
|
||||
// See options at: https://storybook.js.org/docs/next/writing-tests/integrations/vitest-addon#storybooktest
|
||||
storybookTest({
|
||||
configDir: path.join(dirname, '.storybook'),
|
||||
}),
|
||||
],
|
||||
test: {
|
||||
name: 'storybook',
|
||||
browser: {
|
||||
enabled: true,
|
||||
headless: true,
|
||||
provider: 'playwright',
|
||||
instances: [
|
||||
{
|
||||
browser: 'chromium',
|
||||
},
|
||||
],
|
||||
},
|
||||
setupFiles: ['.storybook/vitest.setup.ts'],
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
resolve: {
|
||||
alias: {
|
||||
|
|
|
|||
1
apps/web/vitest.shims.d.ts
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
/// <reference types="@vitest/browser/providers/playwright" />
|
||||
37
docs/BOOT_MODE_STATUS.md
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
# Veza Web - Mode Boot (Dégradé)
|
||||
|
||||
> **État** : 🟠 FONCTIONNEL PARTIEL
|
||||
> **Mode** : `VEZA_MODE=boot`
|
||||
|
||||
Ce document liste les fonctionnalités explicitement désactivées ou simulées pour permettre le démarrage de l'application Web sans l'infrastructure complète.
|
||||
|
||||
## ⛔ Services Désactivés
|
||||
Les services suivants ne sont **PAS** lancés. Toute tentative d'interaction échouera ou sera ignorée.
|
||||
|
||||
| Composant | Status | Conséquence Utilisateur |
|
||||
|-----------|--------|-------------------------|
|
||||
| **RabbitMQ** | ❌ OFF | Pas de notifications temps réel, pas de tâches asynchrones. |
|
||||
| **ClamAV** | ❌ OFF | Les uploads de fichiers ne sont PAS scannés pour les virus. |
|
||||
| **S3 Storage** | ❌ OFF | Les fichiers sont stockés localement dans `uploads/` (pas de cloud). |
|
||||
| **Chat Server** | ❌ OFF | La messagerie instantanée ne fonctionne pas (chargement infini ou erreur). |
|
||||
| **Stream Server** | ❌ OFF | Le streaming audio/vidéo est indisponible. |
|
||||
| **Workers** | ❌ OFF | Les emails (inscription, reset password) ne sont pas envoyés (logs uniquement). |
|
||||
|
||||
## ⚠️ Fonctionnalités Simulées / Mockées
|
||||
Certaines parties du code ont été modifiées pour "faire semblant" de marcher afin d'éviter les crashs.
|
||||
|
||||
- **Uploads** : Acceptés aveuglément sans validation antivirus.
|
||||
- **Emails** : Le service d'envoi d'email loggue le contenu dans la console au lieu d'utiliser SMTP.
|
||||
|
||||
## ✅ Parcours Utilisateur Actif
|
||||
Le "Happy Path" minimal suivant est garanti fonctionnel :
|
||||
|
||||
1. **Inscription / Connexion** (JWT)
|
||||
2. **Affichage Dashboard**
|
||||
3. **Création de Playlist** (Persistance en base Postgres)
|
||||
4. **Modification de Profil** (Basique)
|
||||
|
||||
## 🛠️ Comment lancer ce mode
|
||||
```bash
|
||||
./scripts/start_boot.sh
|
||||
```
|
||||
38
docs/BUDGETS.md
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
# VEZA RESOURCE BUDGETS (THE CONTRACT)
|
||||
|
||||
Ce fichier définit les limites **physiques** acceptables pour le projet.
|
||||
Les tests automatisés (`tmt/tests/...`) utilisent ces valeurs comme conditions d'échec.
|
||||
|
||||
> **Règle d'or** : Tout changement dans ce fichier exige un **commit dédié** et une **justification écrite** expliquant pourquoi l'augmentation est inévitable et bénéfique pour l'utilisateur final (pas pour le développeur).
|
||||
|
||||
## 1. Frontend (Web)
|
||||
|
||||
| Métrique | Limite (Max) | Justification | Script de Contrôle |
|
||||
| :--- | :--- | :--- | :--- |
|
||||
| **Bundle Size** (Total) | **5000 KB** (5MB) | Téléchargement < 10s en 3G (4Mbps). | `tests/frontend/bundle_size.sh` |
|
||||
| **Main Entry JS** | **800 KB** | Parsing/Execution rapide sur CPU mobile bas de gamme. | `tests/frontend/bundle_size.sh` |
|
||||
| **Temps de Build** | **120 s** | Feedback loop rapide. Empêche la complexité du toolchain. | `tests/frontend/build_perf.sh` |
|
||||
|
||||
## 2. Backend (API Go)
|
||||
|
||||
| Métrique | Limite (Max) | Justification | Script de Contrôle |
|
||||
| :--- | :--- | :--- | :--- |
|
||||
| **Temps de Démarrage** | **2 s** | Cold start rapide, redémarrage auto transparent. | `tests/backend/startup_time.sh` |
|
||||
| **Mémoire RSS (Idle)** | **100 MB** | Doit cohabiter avec DB + Services sur 1Go RAM total. | `tests/backend/memory_budget.sh` |
|
||||
| **Binaires .test** | **0** | Aucun binaire de test ne doit polluer le repo. | `.gitignore` |
|
||||
|
||||
## 3. Services (Rust)
|
||||
|
||||
| Métrique | Limite (Max) | Justification | Script de Contrôle |
|
||||
| :--- | :--- | :--- | :--- |
|
||||
| **Warnings** | **0** | Zéro tolérance au bruit. | `tests/services/rust_clippy.sh` |
|
||||
| **Compilation** | *Suivi* | Pas de limite dure encore, mais surveillé. | - |
|
||||
|
||||
## 4. Protocole d'Augmentation
|
||||
|
||||
Si vous devez augmenter un budget :
|
||||
|
||||
1. Ouvrez une **Issue** titrée : `[BUDGET] Request to increase <Metric>`.
|
||||
2. Prouvez que vous avez d'abord tenté d'optimiser.
|
||||
3. Expliquez l'impact sur un utilisateur avec un Celeron N4000 et 4GB RAM.
|
||||
4. Obtenez l'approbation d'un mainteneur "Garde des Sceaux".
|
||||
48
docs/FRUGALITY.md
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
# VEZA FRUGALITY MANIFESTO
|
||||
|
||||
> **"Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away."** — Antoine de Saint-Exupéry
|
||||
|
||||
This document is the **Supreme Law** of the Veza codebase.
|
||||
It supersedes all other documentation, feature requests, or developer preferences.
|
||||
|
||||
## 1. The Prohibitions (Non-Negotiable)
|
||||
|
||||
These are not guidelines. These are **interdictions**.
|
||||
|
||||
* 🔴 **Un test lent n’est pas un test vital.**
|
||||
* Si un test prend plus de quelques secondes, il doit être déplacé dans `legacy` ou supprimé.
|
||||
* Le pipeline Vital doit être instantané.
|
||||
|
||||
* 🔴 **Un warning Rust ou Go est un défaut de conception.**
|
||||
* Il n'y a pas de "petit warning". Le code bruyant cache les vrais problèmes.
|
||||
* Tout warning bloque le merge.
|
||||
|
||||
* 🔴 **Une dépendance frontend non justifiée est un bug.**
|
||||
* Ajouter une librairie de 50KB pour éviter d'écrire 10 lignes de CSS est une faute professionnelle.
|
||||
* Tout ajout à `package.json` doit être défendu par écrit.
|
||||
|
||||
* 🔴 **Un dépassement de budget n’est pas “temporaire”.**
|
||||
* On n'augmente pas la RAM "juste pour le MVP".
|
||||
* Si ça ne rentre pas, on simplifie la feature, on ne demande pas plus de ressources.
|
||||
|
||||
## 2. Invariants Matériels
|
||||
|
||||
Veza est conçu pour le **tiers-monde numérique**, pas pour la Silicon Valley.
|
||||
|
||||
* **CPU**: 1 Core. Pas de multithreading gratuit.
|
||||
* **RAM**: 1 Go pour l'ensemble du stack (Backend + DB + Services).
|
||||
* **GPU**: 0. Le logiciel doit fonctionner en rendu software pur (`LIBGL_ALWAYS_SOFTWARE=1`).
|
||||
* **Réseau**: Doit survivre à 3G H+ et aux coupures intermittentes.
|
||||
|
||||
## 3. La Règle du Frontend
|
||||
|
||||
**Aucun nouveau test frontend n'est VITAL par défaut.**
|
||||
|
||||
* Le frontend est volatile. Le tester excessivement crée de la rigidité, pas de la robustesse.
|
||||
* Un test frontend n'entre dans `plans/vital.fmf` que s'il prouve qu'il protège un invariant critique (ex: "L'app démarre", "Le chat s'affiche").
|
||||
* Tout le reste va dans `plans/legacy.fmf` ou n'existe pas.
|
||||
|
||||
## 4. Modification de la Loi
|
||||
|
||||
Ce document peut être amendé, mais seulement après un **débat explicite**.
|
||||
On ne change pas la constitution en douce dans une PR de feature.
|
||||
72
docs/GLOBAL_PROJECT_STATE_2026.md
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
# 🏥 Audit Global de l'État du Projet Veza (Février 2026)
|
||||
|
||||
> **Verdict Rapide** : Le patient est en vie (il respire), mais il est sous assistance respiratoire ("Boot Mode"). L'architecture est solide mais encombrée par une dette technique visible (TODOs) et une documentation pléthorique qui frôle la saturation cognitive.
|
||||
|
||||
---
|
||||
|
||||
## 1. État de Fonctionnement (Runtime)
|
||||
|
||||
### ✅ Ce qui marche (Le Coeur)
|
||||
* **Infrastructure Vitale** : Postgres (5432) et Redis (6379) sont stables.
|
||||
* **Backend API** : Le serveur Go tourne sur le port `8080`.
|
||||
* Route `/health` : OK (200).
|
||||
* Connexion DB : OK.
|
||||
* Migrations : Appliquées (001 à 931).
|
||||
* **Frontend** : Vite sert l'application sur le port `5173`.
|
||||
* Build : Rapide (Hot Module Replacement actif).
|
||||
* Stack : React 18, TypeScript, Tailwind 4.
|
||||
|
||||
### ⛔ Ce qui est "Mort" (Volontairement)
|
||||
Le mode `VEZA_MODE=boot` a amputé le système de ses membres complexes :
|
||||
* **RabbitMQ** : Éteint. Conséquence : Pas d'événements asynchrones.
|
||||
* **ClamAV** : Éteint. Conséquence : Sécurité des uploads = 0.
|
||||
* **Chat & Stream Servers** : Éteints. Conséquence : Les fonctionnalités "Core" (musique, chat) sont des coquilles vides.
|
||||
* **S3** : Éteint. Conséquence : Stockage local uniquement.
|
||||
|
||||
---
|
||||
|
||||
## 2. Analyse du Codebase
|
||||
|
||||
### 🧠 Backend (`veza-backend-api`)
|
||||
* **Architecture** : Structure Go standard (`cmd/`, `internal/`) mais dense.
|
||||
* **Dette Technique** : 🚨 **210+ TODOs/FIXMEs** détectés.
|
||||
* Beacoup de "Refactor après stabilisation".
|
||||
* Des pans entiers de logique sont annotés comme "Legacy" ou "À migrer".
|
||||
* **Points Forts** :
|
||||
* Gestion de config robuste (`godotenv`, validation stricte).
|
||||
* Middleware structuré (Rate Limiting, CORS, Auth).
|
||||
* Instrumentation présente (Prometheus, Sentry).
|
||||
|
||||
### 🎨 Frontend (`apps/web`)
|
||||
* **Modernité** : Stack très à jour (Vite 7, Tailwind 4, Zuid/Zustand).
|
||||
* **Complexité** : Le `package.json` révèle une "usine à gaz" de tests :
|
||||
* 4 frameworks de tests différents : `vitest`, `playwright`, `backstopjs`, `pa11y`.
|
||||
* Cela indique une volonté de qualité extrême, mais potentiellement dure à maintenir.
|
||||
* **Migration** : Traces de migration d'interface (`KODO_MIGRATION`). Le Design System semble être en transition.
|
||||
|
||||
---
|
||||
|
||||
## 3. Documentation & Process
|
||||
* **Surcharge Informationnelle** : Le dossier `docs/` contient **54 fichiers**.
|
||||
* Il y a des audits de tout (migration, UI, backend, tests, transactions...).
|
||||
* ⚠️ **Risque** : Difficile de distinguer la "Vérité Terrain" de "l'Archive Historique".
|
||||
* **Tests (TMT)** : Une infrastructure de test sophistiquée (`tmt`) est en place, couvrant unitaires, intégration et E2E. C'est un actif majeur pour la stabilité future.
|
||||
|
||||
---
|
||||
|
||||
## 4. Recommandations "Chirurgicales"
|
||||
|
||||
### Immédiat (Next 24h)
|
||||
1. **Nettoyer la Vue** : Archiver les vieux audits dans `docs/archive/` pour ne garder que les specs actives.
|
||||
2. **Tester le "Happy Path"** : Puisque l'app tourne, vérifier manuellement l'inscription et la création de playlist pour valider le "Boot Mode".
|
||||
|
||||
### Moyen Terme (Next Sprint)
|
||||
1. **Réanimer un Membre** : Réactiver **RabbitMQ** en priorité pour rétablir l'asynchronisme.
|
||||
2. **Triage des TODOs** : 200 TODOs, c'est trop. Il faut en supprimer 50% (obsolètes) et transformer les 50% restants en tickets Jira/Github.
|
||||
3. **Stubber les Services Manquants** : Au lieu de désactiver le Chat, créer un "Mock Server" simple qui répond 200 OK pour que l'UI ne tourne pas dans le vide.
|
||||
|
||||
---
|
||||
|
||||
## Conclusion
|
||||
Veza n'est pas un "MVP bricolé". C'est un système industriel complexe qui a été mis en pause. Le "Boot Mode" a permis de redémarrer le cœur.
|
||||
La prochaine étape n'est pas de "coder des features", mais de **reconnecter les organes vitaux un par un**.
|
||||
42
docs/MINIMAL_WEB.md
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
# Veza Minimal Web Stack
|
||||
|
||||
> **Goal**: Run a functional end-to-end version of Veza with the absolute minimum resources.
|
||||
|
||||
## 🚀 How to Run
|
||||
|
||||
```bash
|
||||
# 1. Start everything (DB, Redis, Backend, Frontend)
|
||||
make web-minimal
|
||||
|
||||
# 2. View in Browser
|
||||
# http://localhost:5173
|
||||
```
|
||||
|
||||
## 🛠️ Components
|
||||
- **Frontend**: Vite Dev Server (Port 5173). Bundled minimal.
|
||||
- **Backend**: Go API (Port 8080).
|
||||
- **Database**: Postgres + Redis (Docker).
|
||||
- **Ignored**: Chat Server, Stream Server, Workers, S3, MinIO.
|
||||
|
||||
## ✅ Verified User Journey
|
||||
We have verified that the following core loop works:
|
||||
1. **Registration** (New User)
|
||||
2. **Login** (JWT Token access)
|
||||
3. **Create Playlist** (Write to DB)
|
||||
4. **List Playlists** (Read from DB)
|
||||
|
||||
You can verify this yourself by running:
|
||||
```bash
|
||||
./scripts/verify_minimal_journey.sh
|
||||
```
|
||||
|
||||
## ⚠️ Known Limitations
|
||||
- **Profile Endpoint**: The `/api/v1/profile` or `/auth/me` endpoint returns 404 in some contexts. The frontend likely relies on the User object returned during Login.
|
||||
- **Chat**: Disabled. Chat page will likely fail or show loading.
|
||||
- **Uploads**: Disabled/Mocked. S3 is not running.
|
||||
- **Critical JS**: We are still missing `<noscript>` tags (as reported by TMT).
|
||||
|
||||
## 🔧 Technical Fixes Applied
|
||||
- **JWT_SECRET**: Increased length to meet 32-char security requirement.
|
||||
- **Backend Router**: Fixed a panic caused by duplicate `/health` route registration.
|
||||
- **Env**: Auto-generated minimal `.env` if missing.
|
||||
28
docs/TEST_PROTOCOL_BOOT.md
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
# Protocole de Test Manuel "Boot Mode"
|
||||
|
||||
Ce test vise à valider le "Happy Path" critique et identifier les frictions réelles.
|
||||
|
||||
## 🎯 Objectif
|
||||
Valider que l'utilisateur peut **s'inscrire** et **créer de la valeur** (une playlist) sans rencontrer d'erreur bloquante (Page blanche, Crash, 500).
|
||||
|
||||
## 📝 Script (10 Étapes Max)
|
||||
|
||||
1. **Home** : Accéder à `http://localhost:5173`. Vérifier que la page charge.
|
||||
2. **Nav** : Cliquer sur "S'inscrire" (Register).
|
||||
3. **Form** : Remplir :
|
||||
* User: `boot_tester`
|
||||
* Email: `boot@test.com`
|
||||
* Pass: `BootMode123!`
|
||||
4. **Submit** : Valider. Vérifier la redirection (Login ou Dashboard).
|
||||
5. **Login** (si nécessaire) : Se connecter avec les identifiants.
|
||||
6. **Dashboard** : Vérifier l'affichage du tableau de bord (pas de loader infini).
|
||||
7. **Playlist** : Cliquer sur "Créer une playlist".
|
||||
8. **Input** : Titre: "My Boot Playlist". Valider.
|
||||
9. **Verify** : Vérifier que la playlist apparaît dans la liste.
|
||||
10. **Logout** : Se déconnecter.
|
||||
|
||||
## 🛑 Critères d'Échec (Stop immédiat)
|
||||
* Page blanche (White Screen of Death).
|
||||
* Erreur 500 sur /register ou /login.
|
||||
* Boutons inactifs (clic sans effet).
|
||||
* Loader infini (+10s).
|
||||
1831
package-lock.json
generated
119
scripts/start_boot.sh
Executable file
|
|
@ -0,0 +1,119 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# Colors
|
||||
GREEN='\033[0;32m'
|
||||
BLUE='\033[0;34m'
|
||||
YELLOW='\033[0;33m'
|
||||
RED='\033[0;31m'
|
||||
NC='\033[0m'
|
||||
|
||||
echo -e "${BLUE}🚀 Force-Starting Veza Web (Boot Mode)...${NC}"
|
||||
echo -e "${YELLOW}⚠️ WARNING: Many services will be disabled or mocked.${NC}"
|
||||
|
||||
# ==========================================
|
||||
# 1. Force Environment Configuration
|
||||
# ==========================================
|
||||
# We export these BEFORE loading .env so they take precedence if .env exists,
|
||||
# or we just rely on the fact that we set them here.
|
||||
|
||||
export VEZA_MODE=boot
|
||||
# Disable RabbitMQ (Message Broker)
|
||||
export RABBITMQ_ENABLE=false
|
||||
export RABBITMQ_URL=""
|
||||
# Disable ClamAV (Virus Scanning)
|
||||
export ENABLE_CLAMAV=false
|
||||
export CLAMAV_REQUIRED=false
|
||||
# Disable S3 (File Storage)
|
||||
export AWS_S3_ENABLED=false
|
||||
# Disable Config Watcher (Hot Reload Config)
|
||||
export CONFIG_WATCH=false
|
||||
# Ensure Redis is Enabled (Needed for Session/Auth)
|
||||
export REDIS_ENABLE=true
|
||||
# Ensure Database is Enabled
|
||||
# export DATABASE_URL (Assumed from .env or set below)
|
||||
|
||||
# Load other vars from .env if present, but DO NOT override the above
|
||||
if [ -f .env ]; then
|
||||
echo -e "${BLUE}📄 Loading .env (skipping forced overrides)...${NC}"
|
||||
# Using set -a to export variables
|
||||
set -a
|
||||
# Source .env but ignore lines that would overwrite our forced vars
|
||||
# Actually, standard sourcing overwrites. We need to be careful.
|
||||
# Strategy: Load .env first, THEN enforce overrides.
|
||||
source .env
|
||||
set +a
|
||||
fi
|
||||
|
||||
# RE-ENFORCE OVERRIDES because .env might have overwritten them
|
||||
export RABBITMQ_ENABLE=false
|
||||
export ENABLE_CLAMAV=false
|
||||
export CLAMAV_REQUIRED=false
|
||||
export AWS_S3_ENABLED=false
|
||||
export CONFIG_WATCH=false
|
||||
|
||||
echo -e "${BLUE}🔧 Active Configuration:${NC}"
|
||||
echo -e " RABBITMQ_ENABLE: ${RED}$RABBITMQ_ENABLE${NC}"
|
||||
echo -e " ENABLE_CLAMAV: ${RED}$ENABLE_CLAMAV${NC}"
|
||||
echo -e " AWS_S3_ENABLED: ${RED}$AWS_S3_ENABLED${NC}"
|
||||
|
||||
# ==========================================
|
||||
# 2. Infra (Postgres + Redis ONLY)
|
||||
# ==========================================
|
||||
echo -e "${BLUE}📦 Starting Critical Infra (Postgres + Redis)...${NC}"
|
||||
# We explicitly do NOT start rabbitmq
|
||||
docker compose -f docker-compose.yml up -d postgres redis
|
||||
|
||||
# Wait for DB
|
||||
echo -e "${BLUE}⏳ Waiting for DB...${NC}"
|
||||
until docker compose -f docker-compose.yml exec -T postgres pg_isready -U veza > /dev/null 2>&1; do echo -n "."; sleep 1; done
|
||||
echo -e " ${GREEN}OK${NC}"
|
||||
|
||||
# ==========================================
|
||||
# 3. Migrations
|
||||
# ==========================================
|
||||
echo -e "${BLUE}🔄 Checking Migrations...${NC}"
|
||||
# We assume the user has Go installed or we should use docker?
|
||||
# The original script used local Go. We stick to that.
|
||||
if command -v go &> /dev/null; then
|
||||
(cd veza-backend-api && go run cmd/migrate_tool/main.go up) || echo -e "${YELLOW}⚠️ Migration failed (ignoring in boot mode)${NC}"
|
||||
else
|
||||
echo -e "${YELLOW}⚠️ Go not found, skipping migrations.${NC}"
|
||||
fi
|
||||
|
||||
# ==========================================
|
||||
# 4. Start Backend
|
||||
# ==========================================
|
||||
echo -e "${BLUE}⚙️ Starting Backend API (port 8080)...${NC}"
|
||||
# Check if port 8080 is busy
|
||||
if lsof -i :8080 -t >/dev/null 2>&1; then
|
||||
echo -e "${YELLOW}⚠️ Port 8080 is busy. Killing old process...${NC}"
|
||||
kill -9 $(lsof -t -i:8080) || true
|
||||
fi
|
||||
|
||||
# Start Backend in background
|
||||
(cd veza-backend-api && go run cmd/modern-server/main.go) > backend_boot.log 2>&1 &
|
||||
BACKEND_PID=$!
|
||||
echo $BACKEND_PID > backend.pid
|
||||
echo -e "${GREEN}✅ Backend running (PID: $BACKEND_PID). Logs: backend_boot.log${NC}"
|
||||
|
||||
# ==========================================
|
||||
# 5. Start Frontend
|
||||
# ==========================================
|
||||
echo -e "${BLUE}🎨 Starting Frontend (port 5173)...${NC}"
|
||||
# Check if port 5173 is busy
|
||||
if lsof -i :5173 -t >/dev/null 2>&1; then
|
||||
echo -e "${YELLOW}⚠️ Port 5173 is busy. Killing old process...${NC}"
|
||||
kill -9 $(lsof -t -i:5173) || true
|
||||
fi
|
||||
|
||||
(cd apps/web && npm run dev) > frontend_boot.log 2>&1 &
|
||||
FRONTEND_PID=$!
|
||||
echo $FRONTEND_PID > frontend.pid
|
||||
|
||||
echo -e "${GREEN}✅ boot mode active.${NC}"
|
||||
echo -e "${GREEN}👉 App: http://localhost:5173${NC}"
|
||||
echo -e "${BLUE}Type 'kill $BACKEND_PID $FRONTEND_PID' to stop manually if needed.${NC}"
|
||||
|
||||
# Wait for frontend to ensure script doesn't exit immediately
|
||||
wait $FRONTEND_PID
|
||||
54
scripts/start_minimal.sh
Executable file
|
|
@ -0,0 +1,54 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# Colors
|
||||
GREEN='\033[0;32m'
|
||||
BLUE='\033[0;34m'
|
||||
NC='\033[0m'
|
||||
|
||||
echo -e "${BLUE}🚀 Starting Veza Minimal Web Stack...${NC}"
|
||||
|
||||
# Source env
|
||||
if [ -f .env ]; then
|
||||
export $(grep -v '^#' .env | xargs)
|
||||
fi
|
||||
|
||||
# 1. Start Infrastructure (Background)
|
||||
echo -e "${BLUE}📦 Starting Database & Redis...${NC}"
|
||||
docker compose -f docker-compose.yml up -d postgres redis
|
||||
# Wait for DB
|
||||
echo -e "${BLUE}⏳ Waiting for DB...${NC}"
|
||||
until docker compose -f docker-compose.yml exec -T postgres pg_isready -U veza > /dev/null 2>&1; do echo -n "."; sleep 1; done
|
||||
echo -e " ${GREEN}OK${NC}"
|
||||
|
||||
# 2. Check/Run Migrations (Go)
|
||||
echo -e "${BLUE}🔄 Checking Migrations...${NC}"
|
||||
cd veza-backend-api
|
||||
go run cmd/migrate_tool/main.go up
|
||||
cd ..
|
||||
|
||||
# 3. Start Backend (Background)
|
||||
echo -e "${BLUE}⚙️ Starting Backend API (port 8080)...${NC}"
|
||||
# Use standard run, not hot reload for stability in this script, or use air if available?
|
||||
# Let's use simple go run to be robust.
|
||||
(cd veza-backend-api && go run cmd/modern-server/main.go) > backend.log 2>&1 &
|
||||
BACKEND_PID=$!
|
||||
echo $BACKEND_PID > backend.pid
|
||||
echo -e "${GREEN}✅ Backend running (PID: $BACKEND_PID). Logs: backend.log${NC}"
|
||||
|
||||
# 4. Start Frontend
|
||||
echo -e "${BLUE}🎨 Starting Frontend (port 5173)...${NC}"
|
||||
echo -e "${GREEN}👉 App will be available at http://localhost:5173${NC}"
|
||||
(cd apps/web && npm run dev) > frontend.log 2>&1 &
|
||||
FRONTEND_PID=$!
|
||||
echo $FRONTEND_PID > frontend.pid
|
||||
|
||||
echo -e "${GREEN}✅ All services started.${NC}"
|
||||
echo -e "${BLUE}Type 'make stop-minimal' to stop.${NC}"
|
||||
|
||||
# Wait for user input or keep alive?
|
||||
# We exit, letting processes run in background?
|
||||
# Usually 'make' commands blocking is better for the user to Ctrl+C.
|
||||
# But 'npm run dev' is interactive-ish.
|
||||
# Let's block on the frontend process.
|
||||
wait $FRONTEND_PID
|
||||
17
scripts/stop_minimal.sh
Executable file
|
|
@ -0,0 +1,17 @@
|
|||
#!/bin/bash
|
||||
echo "🛑 Stopping Minimal Stack..."
|
||||
|
||||
if [ -f backend.pid ]; then
|
||||
kill $(cat backend.pid) 2>/dev/null || true
|
||||
rm backend.pid
|
||||
fi
|
||||
|
||||
if [ -f frontend.pid ]; then
|
||||
kill $(cat frontend.pid) 2>/dev/null || true
|
||||
rm frontend.pid
|
||||
fi
|
||||
|
||||
# Stop Docker infra
|
||||
docker compose -f docker-compose.yml stop postgres redis
|
||||
|
||||
echo "✅ Stopped."
|
||||
79
scripts/verify_minimal_journey.sh
Executable file
|
|
@ -0,0 +1,79 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
API_URL="http://localhost:8080/api/v1"
|
||||
EMAIL="monitor_$(date +%s)@veza.app"
|
||||
PASSWORD="Password123!"
|
||||
USERNAME="monitor_user_$(date +%s)"
|
||||
|
||||
echo "🔹 1. Registering User ($EMAIL)..."
|
||||
REGISTER_PAYLOAD=$(jq -n \
|
||||
--arg email "$EMAIL" \
|
||||
--arg password "$PASSWORD" \
|
||||
--arg username "$USERNAME" \
|
||||
'{email: $email, password: $password, password_confirmation: $password, username: $username, full_name: "Monitor User"}')
|
||||
|
||||
curl -s -X POST "$API_URL/auth/register" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "$REGISTER_PAYLOAD" > register_response.json
|
||||
|
||||
echo " Response: $(cat register_response.json)"
|
||||
|
||||
echo "🔹 2. Logging In..."
|
||||
LOGIN_PAYLOAD=$(jq -n \
|
||||
--arg email "$EMAIL" \
|
||||
--arg password "$PASSWORD" \
|
||||
'{email: $email, password: $password}')
|
||||
|
||||
LOGIN_RESPONSE=$(curl -s -X POST "$API_URL/auth/login" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "$LOGIN_PAYLOAD")
|
||||
|
||||
echo " Login Response: $LOGIN_RESPONSE"
|
||||
|
||||
# Extract Token
|
||||
TOKEN=$(echo "$LOGIN_RESPONSE" | jq -r '.data.token.access_token')
|
||||
|
||||
if [ "$TOKEN" == "null" ] || [ -z "$TOKEN" ]; then
|
||||
echo "❌ Login Failed."
|
||||
exit 1
|
||||
fi
|
||||
echo " ✅ Token acquired."
|
||||
|
||||
# Check Profile
|
||||
echo "🔹 3. Verifying Profile..."
|
||||
# Based on logs, /profile works
|
||||
curl -s -X GET "$API_URL/profile" \
|
||||
-H "Authorization: Bearer $TOKEN" > profile_response.json
|
||||
|
||||
if grep -q "$USERNAME" profile_response.json; then
|
||||
echo " ✅ Profile Verified."
|
||||
else
|
||||
echo "❌ Profile Verification Failed. Response: $(cat profile_response.json)"
|
||||
# Continue to playlist to see if that works
|
||||
fi
|
||||
|
||||
echo "🔹 4. Creating Playlist (Central Action)..."
|
||||
PLAYLIST_NAME="My Demo Playlist $(date +%s)"
|
||||
# Change 'name' to 'title'
|
||||
PLAYLIST_PAYLOAD=$(jq -n --arg name "$PLAYLIST_NAME" '{title: $name, description: "Created by automated check", is_public: true}')
|
||||
|
||||
curl -s -X POST "$API_URL/playlists" \
|
||||
-H "Authorization: Bearer $TOKEN" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "$PLAYLIST_PAYLOAD" > playlist_response.json
|
||||
|
||||
echo " Response: $(cat playlist_response.json)"
|
||||
|
||||
echo "🔹 5. Verifying Persistence..."
|
||||
curl -s -X GET "$API_URL/playlists" \
|
||||
-H "Authorization: Bearer $TOKEN" > playlists_list.json
|
||||
|
||||
if grep -q "$PLAYLIST_NAME" playlists_list.json; then
|
||||
echo "✅ SUCCESS: Playlist found in list. Journey Complete."
|
||||
else
|
||||
echo "❌ FAILURE: Playlist not found."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
rm register_response.json profile_response.json playlist_response.json playlists_list.json
|
||||
|
|
@ -66,10 +66,14 @@ echo "👤 Creating test user..."
|
|||
TEST_EMAIL=test@veza.app TEST_PASSWORD=test123 TEST_USERNAME=testuser go run cmd/tools/create_test_user/main.go 2>&1 | grep -E "(Created|Updated|Email|Username|Password)" || echo "⚠️ User may already exist"
|
||||
|
||||
echo "🚀 Starting backend..."
|
||||
echo "🚀 Starting backend..."
|
||||
# Stay in veza-backend-api directory to ensure correct CWD for migrations/config
|
||||
nohup ./bin/veza-api > ../backend.log 2>&1 &
|
||||
echo $! > ../backend.pid
|
||||
echo "✅ Backend started (PID: $(cat ../backend.pid))"
|
||||
|
||||
cd ..
|
||||
nohup ./veza-backend-api/bin/veza-api > backend.log 2>&1 &
|
||||
echo $! > backend.pid
|
||||
echo "✅ Backend started (PID: $(cat backend.pid))"
|
||||
|
||||
|
||||
sleep 3
|
||||
|
||||
|
|
|
|||
41
tmt/README.md
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
# Veza Unified Testing Pipeline (TMT)
|
||||
|
||||
> **Philosophy**: Sobriety, Frugality, Accessibility.
|
||||
> **The Law**: [docs/FRUGALITY.md](../docs/FRUGALITY.md)
|
||||
> **The Contract**: [docs/BUDGETS.md](../docs/BUDGETS.md)
|
||||
|
||||
This directory contains the definition of Veza's unified testing pipeline.
|
||||
It is the **Executive Branch** that enforcing the laws defined in `FRUGALITY.md` and `BUDGETS.md`.
|
||||
|
||||
## 🛑 The Rules
|
||||
|
||||
1. **VITAL Tests Block Everything**: If a test in `plans/vital.fmf` fails, the commit is rejected.
|
||||
2. **Contractual Budgets**: Resource limits are defined in `docs/BUDGETS.md`. Tests verify these limits.
|
||||
3. **No New Frontend Tests**: By default, new frontend tests are `legacy`. You must prove a test is `vital` to promote it.
|
||||
|
||||
## Directory Structure
|
||||
|
||||
- `plans/`:
|
||||
- **`vital.fmf`**: **TIER 1**. The "must pass" suite. Runs fast, strictly, and enforces budgets.
|
||||
- **`legacy.fmf`**: **TIER 2**. Slow/Old tests. Informational only.
|
||||
- `tests/`: Actual test scripts.
|
||||
- `frontend/`: Linked to `BUDGETS.md`.
|
||||
- `backend/`: Linked to `BUDGETS.md`.
|
||||
- `services/`: Strict Rust checks.
|
||||
|
||||
## How to Run
|
||||
|
||||
### Vital Tests (The Standard)
|
||||
```bash
|
||||
tmt run plan --name /vital
|
||||
```
|
||||
|
||||
### Full Suite (Including Regressions/Legacy)
|
||||
```bash
|
||||
tmt run
|
||||
```
|
||||
|
||||
## Environment Variables
|
||||
The pipeline enforces:
|
||||
- `GOMAXPROCS=1`: Simulate single-core environment.
|
||||
- `LIBGL_ALWAYS_SOFTWARE=1`: Disable GPU.
|
||||
14
tmt/plans/legacy.fmf
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
summary: Secondary / Legacy Tests
|
||||
description: |
|
||||
Tests that are useful but:
|
||||
- Are too slow.
|
||||
- Are flaky.
|
||||
- Test features not critical to the "Core Ethics".
|
||||
Failures here are "Warnings", not "Blockers".
|
||||
|
||||
discover:
|
||||
how: fmf
|
||||
filter: tier: 2
|
||||
|
||||
execute:
|
||||
how: tmt
|
||||
18
tmt/plans/vital.fmf
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
summary: Vital Tests (The Law)
|
||||
description: |
|
||||
These tests are non-negotiable.
|
||||
They execute the Frugality Manifesto.
|
||||
If these fail, the product is broken.
|
||||
|
||||
discover:
|
||||
how: fmf
|
||||
filter: tier: 1
|
||||
|
||||
execute:
|
||||
how: tmt
|
||||
|
||||
environment:
|
||||
# Forces Low-Power Behavior
|
||||
GOMAXPROCS: "1"
|
||||
LIBGL_ALWAYS_SOFTWARE: "1"
|
||||
RUST_BACKTRACE: "0"
|
||||
38
tmt/tests/backend/core_isolation.sh
Executable file
|
|
@ -0,0 +1,38 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
REPO_ROOT=$(git rev-parse --show-toplevel)
|
||||
BACKEND_DIR="$REPO_ROOT/veza-backend-api"
|
||||
CORE_DIR="internal/core"
|
||||
|
||||
echo "📍 Backend Core Isolation Check"
|
||||
|
||||
cd "$BACKEND_DIR"
|
||||
|
||||
if [ ! -d "$CORE_DIR" ]; then
|
||||
echo "⚠️ $CORE_DIR does not exist. Skipping."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "🔎 Analyzing dependencies of $CORE_DIR..."
|
||||
|
||||
# List all imports of packages in internal/core
|
||||
IMPORTS=$(go list -f '{{.Imports}}' ./$CORE_DIR/...)
|
||||
|
||||
# Check for forbidden packages
|
||||
FORBIDDEN="database/sql github.com/lib/pq github.com/jackc/pgx"
|
||||
|
||||
FAILED=0
|
||||
for PKG in $FORBIDDEN; do
|
||||
if echo "$IMPORTS" | grep -q "$PKG"; then
|
||||
echo "❌ Violation: $CORE_DIR depends on $PKG"
|
||||
FAILED=1
|
||||
fi
|
||||
done
|
||||
|
||||
if [ $FAILED -eq 1 ]; then
|
||||
echo "❌ Core isolation check FAILED. Core domain logic must not be coupled to DB drivers."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "✅ Core isolation verified."
|
||||
27
tmt/tests/backend/integration.sh
Executable file
|
|
@ -0,0 +1,27 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
REPO_ROOT=$(git rev-parse --show-toplevel)
|
||||
BACKEND_DIR="$REPO_ROOT/veza-backend-api"
|
||||
|
||||
echo "📍 Backend Integration Tests"
|
||||
echo "📂 Backend Directory: $BACKEND_DIR"
|
||||
|
||||
cd "$BACKEND_DIR"
|
||||
|
||||
# Check if DB is reachable (optional, or rely on test failure)
|
||||
# We assume existing environment setup (docker-compose up) or we skip
|
||||
# For now, we run the tests in the 'tests' directory if they exist
|
||||
# Or standard go test ./... with tags
|
||||
|
||||
echo "🧪 Running Integration Tests..."
|
||||
# Assuming integration tests are marked or in specific folders
|
||||
# If 'tests/' folder exists and has go files:
|
||||
if [ -d "tests" ]; then
|
||||
go test ./tests/... -v
|
||||
else
|
||||
echo "⚠️ No 'tests' directory found. Running all tests."
|
||||
go test ./... -v
|
||||
fi
|
||||
|
||||
echo "✅ Integration tests completed."
|
||||
32
tmt/tests/backend/main.fmf
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
summary: Backend Tests (Go)
|
||||
tier: 1
|
||||
component: backend
|
||||
test: ./unit.sh
|
||||
duration: 15m
|
||||
require:
|
||||
- go
|
||||
|
||||
/unit:
|
||||
summary: Unit Tests (Low Power)
|
||||
test: ./unit.sh
|
||||
tier: 1
|
||||
|
||||
/integration:
|
||||
summary: Integration Tests
|
||||
test: ./integration.sh
|
||||
tier: 2
|
||||
|
||||
/core-isolation:
|
||||
summary: Core Isolation Check
|
||||
test: ./core_isolation.sh
|
||||
tier: 1
|
||||
|
||||
/startup-time:
|
||||
summary: Startup Time Budget
|
||||
test: ./startup_time.sh
|
||||
tier: 1
|
||||
|
||||
/memory-budget:
|
||||
summary: Memory Budget Check
|
||||
test: ./memory_budget.sh
|
||||
tier: 1
|
||||
39
tmt/tests/backend/memory_budget.sh
Executable file
|
|
@ -0,0 +1,39 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# CONTRACT: docs/BUDGETS.md
|
||||
# DO NOT CHANGE THESE VALUES WITHOUT UPDATING THE CONTRACT FIRST.
|
||||
MAX_RSS_MB=100
|
||||
|
||||
REPO_ROOT=$(git rev-parse --show-toplevel)
|
||||
BACKEND_DIR="$REPO_ROOT/veza-backend-api"
|
||||
|
||||
echo "📍 Backend Memory Budget Check"
|
||||
echo "📜 Contract: docs/BUDGETS.md"
|
||||
echo "🧠 Budget: ${MAX_RSS_MB}MB RSS (Idle)"
|
||||
|
||||
cd "$BACKEND_DIR"
|
||||
go build -o server_mem_check ./cmd/modern-server/main.go
|
||||
|
||||
# Start
|
||||
./server_mem_check > /dev/null 2>&1 &
|
||||
PID=$!
|
||||
sleep 2
|
||||
|
||||
# Measure RSS
|
||||
RSS_KB=$(ps -o rss= -p $PID | awk '{print $1}')
|
||||
RSS_MB=$((RSS_KB / 1024))
|
||||
|
||||
echo "📊 Current RSS: ${RSS_MB}MB"
|
||||
|
||||
kill $PID
|
||||
rm -f server_mem_check
|
||||
|
||||
if [ "$RSS_MB" -gt "$MAX_RSS_MB" ]; then
|
||||
echo "❌ FATAL: Memory budget exceeded!"
|
||||
echo " Limit: ${MAX_RSS_MB}MB"
|
||||
echo " Actual: ${RSS_MB}MB"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "✅ Memory usage within budget."
|
||||
45
tmt/tests/backend/startup_time.sh
Executable file
|
|
@ -0,0 +1,45 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# CONTRACT: docs/BUDGETS.md
|
||||
# DO NOT CHANGE THESE VALUES WITHOUT UPDATING THE CONTRACT FIRST.
|
||||
MAX_STARTUP_SECONDS=2
|
||||
|
||||
REPO_ROOT=$(git rev-parse --show-toplevel)
|
||||
BACKEND_DIR="$REPO_ROOT/veza-backend-api"
|
||||
|
||||
echo "📍 Backend Startup Time Check"
|
||||
echo "📜 Contract: docs/BUDGETS.md"
|
||||
echo "⏱️ Budget: ${MAX_STARTUP_SECONDS}s to reach ready state"
|
||||
|
||||
cd "$BACKEND_DIR"
|
||||
|
||||
# Build first to not count compilation time
|
||||
go build -o server_perf_check ./cmd/modern-server/main.go
|
||||
|
||||
# Start server in background, measuring time to first log output or port open
|
||||
# This is a naive check: we expect it to NOT crash and to output something quickly.
|
||||
# For a real "readiness" check we'd wait for a health endpoint, but for "startup" usually
|
||||
# the initialization phase is what we care about blocking.
|
||||
|
||||
echo "🚀 Starting server..."
|
||||
start_ts=$(date +%s%N)
|
||||
|
||||
# Start and kill immediately after a brief sleep to ensure it creates processes
|
||||
./server_perf_check &
|
||||
PID=$!
|
||||
sleep 1
|
||||
# Check if still running
|
||||
if kill -0 $PID 2>/dev/null; then
|
||||
echo "✅ Server started and is running."
|
||||
kill $PID
|
||||
else
|
||||
echo "❌ Server crashed immediately."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# In a real scenario, we would curl localhost:8080/health and measure time.
|
||||
# For now, we enforce that the binary is small enough to load and run instantly.
|
||||
|
||||
echo "✅ Startup check passed (Naive implementation)."
|
||||
rm -f server_perf_check
|
||||
17
tmt/tests/backend/unit.sh
Executable file
|
|
@ -0,0 +1,17 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
REPO_ROOT=$(git rev-parse --show-toplevel)
|
||||
BACKEND_DIR="$REPO_ROOT/veza-backend-api"
|
||||
|
||||
echo "📍 Backend Unit Tests (Low Power Mode)"
|
||||
|
||||
cd "$BACKEND_DIR"
|
||||
|
||||
export GOMAXPROCS=1
|
||||
echo "⚙️ Constraint: GOMAXPROCS=1"
|
||||
|
||||
echo "🧪 Running Unit Tests..."
|
||||
go test ./internal/... -v -short
|
||||
|
||||
echo "✅ Unit tests completed."
|
||||
26
tmt/tests/frontend/build.sh
Executable file
|
|
@ -0,0 +1,26 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# Define root and web directories
|
||||
REPO_ROOT=$(git rev-parse --show-toplevel)
|
||||
WEB_DIR="$REPO_ROOT/apps/web"
|
||||
|
||||
echo "📍 Frontend Build Test"
|
||||
echo "📂 Web Directory: $WEB_DIR"
|
||||
|
||||
cd "$WEB_DIR"
|
||||
|
||||
# Ensure we are in a clean state or at least dependencies are there
|
||||
if [ ! -d "node_modules" ]; then
|
||||
echo "📦 Installing dependencies..."
|
||||
npm ci
|
||||
else
|
||||
echo "✅ Dependencies found (skipping full install for speed, use clean env for strictness)"
|
||||
# For a purely strict test we might want npm ci always, but for local dev speed:
|
||||
# npm ci
|
||||
fi
|
||||
|
||||
echo "🔨 Building project..."
|
||||
npm run build
|
||||
|
||||
echo "✅ Build successful"
|
||||
36
tmt/tests/frontend/build_perf.sh
Executable file
|
|
@ -0,0 +1,36 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# CONTRACT: docs/BUDGETS.md
|
||||
# DO NOT CHANGE THESE VALUES WITHOUT UPDATING THE CONTRACT FIRST.
|
||||
MAX_BUILD_SECONDS=120
|
||||
|
||||
REPO_ROOT=$(git rev-parse --show-toplevel)
|
||||
WEB_DIR="$REPO_ROOT/apps/web"
|
||||
|
||||
echo "📍 Frontend Build Performance Check"
|
||||
echo "📜 Contract: docs/BUDGETS.md"
|
||||
echo "⏱️ Budget: ${MAX_BUILD_SECONDS}s"
|
||||
|
||||
cd "$WEB_DIR"
|
||||
|
||||
START_TIME=$(date +%s)
|
||||
|
||||
# Run build independently of the other build test to measure PURE time
|
||||
# In a real CI, we might skip if artifact exists, but here we enforce speed of build
|
||||
npm run build > /dev/null 2>&1
|
||||
|
||||
END_TIME=$(date +%s)
|
||||
DURATION=$((END_TIME - START_TIME))
|
||||
|
||||
echo "📊 Build took: ${DURATION}s"
|
||||
|
||||
if [ "$DURATION" -gt "$MAX_BUILD_SECONDS" ]; then
|
||||
echo "❌ FATAL: Build deemed TOO SLOW for a vital component."
|
||||
echo " Limit: ${MAX_BUILD_SECONDS}s"
|
||||
echo " Actual: ${DURATION}s"
|
||||
echo " See docs/FRUGALITY.md for policy."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "✅ Build speed within limits."
|
||||
34
tmt/tests/frontend/bundle_size.sh
Executable file
|
|
@ -0,0 +1,34 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# CONTRACT: docs/BUDGETS.md
|
||||
# DO NOT CHANGE THESE VALUES WITHOUT UPDATING THE CONTRACT FIRST.
|
||||
MAX_TOTAL_SIZE_KB=5000 # 5MB
|
||||
MAX_JS_ENTRY_KB=800 # 800KB
|
||||
|
||||
REPO_ROOT=$(git rev-parse --show-toplevel)
|
||||
WEB_DIR="$REPO_ROOT/apps/web"
|
||||
DIST_DIR="$WEB_DIR/dist"
|
||||
|
||||
echo "📍 Frontend Bundle Size Check (Strict)"
|
||||
echo "📜 Contract: docs/BUDGETS.md"
|
||||
|
||||
if [ ! -d "$DIST_DIR" ]; then
|
||||
echo "❌ Dist directory not found. Run build first."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Calculate total size
|
||||
TOTAL_SIZE_KB=$(du -sk "$DIST_DIR" | cut -f1)
|
||||
|
||||
echo "📊 Total Bundle Size: ${TOTAL_SIZE_KB}KB"
|
||||
echo " Invariant Limit: ${MAX_TOTAL_SIZE_KB}KB"
|
||||
|
||||
if [ "$TOTAL_SIZE_KB" -gt "$MAX_TOTAL_SIZE_KB" ]; then
|
||||
echo "❌ FATAL: OBESITY DETECTED."
|
||||
echo " The bundle exceeds the hard limit set in the Frugality Manifesto."
|
||||
echo " You must reduce the size or initiate a formal debate to change the limit."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "✅ Bundle adheres to strict diet."
|
||||
27
tmt/tests/frontend/main.fmf
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
summary: Frontend Tests (Web)
|
||||
tier: 1
|
||||
component: frontend
|
||||
test: ./build.sh
|
||||
duration: 10m
|
||||
require:
|
||||
- npm
|
||||
|
||||
/build:
|
||||
summary: Build Test
|
||||
test: ./build.sh
|
||||
tier: 1
|
||||
|
||||
/build-perf:
|
||||
summary: Build Time Budget
|
||||
test: ./build_perf.sh
|
||||
tier: 1
|
||||
|
||||
/bundle-size:
|
||||
summary: Bundle Size Check (Strict)
|
||||
test: ./bundle_size.sh
|
||||
tier: 1
|
||||
|
||||
/no-critical-js:
|
||||
summary: No Critical JS Check
|
||||
test: ./no_critical_js.sh
|
||||
tier: 1
|
||||
31
tmt/tests/frontend/no_critical_js.sh
Executable file
|
|
@ -0,0 +1,31 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
REPO_ROOT=$(git rev-parse --show-toplevel)
|
||||
WEB_DIR="$REPO_ROOT/apps/web"
|
||||
INDEX_HTML="$WEB_DIR/index.html"
|
||||
|
||||
echo "📍 Frontend No-Critical-JS Check"
|
||||
|
||||
if [ ! -f "$INDEX_HTML" ]; then
|
||||
echo "❌ index.html not found!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "🔎 Checking for <noscript> tag in index.html..."
|
||||
|
||||
if grep -q "<noscript>" "$INDEX_HTML"; then
|
||||
echo "✅ <noscript> tag found."
|
||||
else
|
||||
echo "❌ <noscript> tag MISSING. The app is invisible without JS."
|
||||
echo " Please add a <noscript> tag with a basic message."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Optional: Check if root is not empty (SSR/Prerendering check)
|
||||
# This is stricter, maybe for later.
|
||||
# if grep -Pqz '<div id="root">.+</div>' "$INDEX_HTML"; then
|
||||
# echo "✅ Root div has initial content."
|
||||
# else
|
||||
# echo "⚠️ Root div is empty (Client-side rendering only)."
|
||||
# fi
|
||||
17
tmt/tests/services/main.fmf
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
summary: Services Tests (Rust)
|
||||
tier: 1
|
||||
component: services
|
||||
test: ./rust_test.sh
|
||||
duration: 20m
|
||||
require:
|
||||
- cargo
|
||||
|
||||
/clippy:
|
||||
summary: Rust Clippy (Strict)
|
||||
test: ./rust_clippy.sh
|
||||
tier: 1
|
||||
|
||||
/test:
|
||||
summary: Rust Unit Tests
|
||||
test: ./rust_test.sh
|
||||
tier: 1
|
||||
28
tmt/tests/services/rust_clippy.sh
Executable file
|
|
@ -0,0 +1,28 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
REPO_ROOT=$(git rev-parse --show-toplevel)
|
||||
CHAT_DIR="$REPO_ROOT/veza-chat-server"
|
||||
STREAM_DIR="$REPO_ROOT/veza-stream-server"
|
||||
|
||||
echo "📍 Services Clippy Check (Strict)"
|
||||
|
||||
# Chat Server
|
||||
echo "🦀 Checking Chat Server..."
|
||||
if [ -d "$CHAT_DIR" ]; then
|
||||
cd "$CHAT_DIR"
|
||||
cargo clippy -- -D warnings
|
||||
else
|
||||
echo "⚠️ Chat Server directory not found!"
|
||||
fi
|
||||
|
||||
# Stream Server
|
||||
echo "🦀 Checking Stream Server..."
|
||||
if [ -d "$STREAM_DIR" ]; then
|
||||
cd "$STREAM_DIR"
|
||||
cargo clippy -- -D warnings
|
||||
else
|
||||
echo "⚠️ Stream Server directory not found!"
|
||||
fi
|
||||
|
||||
echo "✅ Clippy checks passed."
|
||||
28
tmt/tests/services/rust_test.sh
Executable file
|
|
@ -0,0 +1,28 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
REPO_ROOT=$(git rev-parse --show-toplevel)
|
||||
CHAT_DIR="$REPO_ROOT/veza-chat-server"
|
||||
STREAM_DIR="$REPO_ROOT/veza-stream-server"
|
||||
|
||||
echo "📍 Services Unit Tests"
|
||||
|
||||
# Chat Server
|
||||
echo "🦀 Testing Chat Server..."
|
||||
if [ -d "$CHAT_DIR" ]; then
|
||||
cd "$CHAT_DIR"
|
||||
cargo test
|
||||
else
|
||||
echo "⚠️ Chat Server directory not found!"
|
||||
fi
|
||||
|
||||
# Stream Server
|
||||
echo "🦀 Testing Stream Server..."
|
||||
if [ -d "$STREAM_DIR" ]; then
|
||||
cd "$STREAM_DIR"
|
||||
cargo test
|
||||
else
|
||||
echo "⚠️ Stream Server directory not found!"
|
||||
fi
|
||||
|
||||
echo "✅ Service tests passed."
|
||||
|
|
@ -268,13 +268,7 @@ func (r *APIRouter) Setup(router *gin.Engine) error {
|
|||
|
||||
// P1.6: Health endpoint for Docker/K8s healthchecks
|
||||
// Must be before other routes to avoid middleware overhead
|
||||
router.GET("/api/v1/health", func(c *gin.Context) {
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"status": "ok",
|
||||
"timestamp": time.Now().Unix(),
|
||||
"service": "veza-backend-api",
|
||||
})
|
||||
})
|
||||
// DUPLICATE REMOVED to fix panic.
|
||||
|
||||
// Routes core publiques (health, metrics, upload info)
|
||||
r.setupCorePublicRoutes(router)
|
||||
|
|
|
|||
|
|
@ -250,6 +250,14 @@ func (d *Database) RunMigrations() error {
|
|||
|
||||
// Exécuter chaque migration
|
||||
for _, file := range files {
|
||||
// Ignorer les fichiers _down.sql
|
||||
if strings.HasSuffix(file, "_down.sql") {
|
||||
if d.Logger != nil {
|
||||
d.Logger.Info("Skipping down migration", zap.String("file", file))
|
||||
}
|
||||
continue
|
||||
}
|
||||
|
||||
migration := filepath.Base(file)
|
||||
|
||||
// Vérifier si la migration a déjà été appliquée
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ func CORS(allowedOrigins []string) gin.HandlerFunc {
|
|||
}
|
||||
|
||||
c.Header("Access-Control-Allow-Methods", "GET, POST, PUT, PATCH, DELETE, OPTIONS")
|
||||
c.Header("Access-Control-Allow-Headers", "Authorization, Content-Type, X-Requested-With, X-CSRF-Token, X-API-Version")
|
||||
c.Header("Access-Control-Allow-Headers", "Authorization, Content-Type, X-Requested-With, X-CSRF-Token, X-API-Version, x-api-version")
|
||||
c.Header("Access-Control-Allow-Credentials", "true")
|
||||
c.Header("Access-Control-Expose-Headers", "X-CSRF-Token, X-Request-ID, Content-Range")
|
||||
c.Header("Access-Control-Max-Age", "86400") // Cache preflight pour 24h
|
||||
|
|
|
|||
|
|
@ -205,6 +205,9 @@ func (w *JobWorker) fetchAndProcessJob(ctx context.Context, workerID int) {
|
|||
if err != nil {
|
||||
if err != gorm.ErrRecordNotFound {
|
||||
w.logger.Error("Failed to fetch job", zap.Error(err))
|
||||
} else {
|
||||
// Just debug log for no jobs found, to avoid spamming production logs
|
||||
w.logger.Debug("No pending jobs found")
|
||||
}
|
||||
// Pas de job à traiter, on attend le prochain tick
|
||||
return
|
||||
|
|
|
|||
|
|
@ -343,10 +343,10 @@ pub fn generate_totp_secret() -> VezaResult<String> {
|
|||
pub fn validate_totp_code(secret: &str, code: &str, _window: i64) -> VezaResult<bool> {
|
||||
use totp_rs::{TOTP, Algorithm, Secret};
|
||||
|
||||
// totp-rs 5.7 API: TOTP::new takes 7 arguments: algorithm, digits, skew, step, secret, issuer, account_name
|
||||
// Use Secret::Encoded to handle base32 string directly
|
||||
let secret_obj = Secret::Encoded(secret.to_string());
|
||||
|
||||
|
||||
// Use TOTP::new with 5 arguments (basic validation)
|
||||
let totp = TOTP::new(
|
||||
Algorithm::SHA1,
|
||||
6,
|
||||
|
|
@ -354,8 +354,6 @@ pub fn validate_totp_code(secret: &str, code: &str, _window: i64) -> VezaResult<
|
|||
30,
|
||||
secret_obj.to_bytes()
|
||||
.map_err(|e| VezaError::Auth(format!("Invalid TOTP secret: {}", e)))?,
|
||||
Some("Veza".to_string()), // issuer
|
||||
"user".to_string(), // account_name (generic, can be customized)
|
||||
).map_err(|e| VezaError::Auth(format!("Invalid TOTP secret: {}", e)))?;
|
||||
|
||||
let is_valid = totp.check_current(code)
|
||||
|
|
|
|||
|
|
@ -1,40 +0,0 @@
|
|||
{
|
||||
"db_name": "PostgreSQL",
|
||||
"query": "\n SELECT status, error_message, created_at, updated_at\n FROM stream_jobs\n WHERE track_id = $1\n ORDER BY created_at DESC\n LIMIT 10\n ",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"ordinal": 0,
|
||||
"name": "status",
|
||||
"type_info": "Text"
|
||||
},
|
||||
{
|
||||
"ordinal": 1,
|
||||
"name": "error_message",
|
||||
"type_info": "Text"
|
||||
},
|
||||
{
|
||||
"ordinal": 2,
|
||||
"name": "created_at",
|
||||
"type_info": "Timestamptz"
|
||||
},
|
||||
{
|
||||
"ordinal": 3,
|
||||
"name": "updated_at",
|
||||
"type_info": "Timestamptz"
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Left": [
|
||||
"Uuid"
|
||||
]
|
||||
},
|
||||
"nullable": [
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
false
|
||||
]
|
||||
},
|
||||
"hash": "0668ef78687730439acb17f32470cbd2e73936364938b14334dca6dded16e610"
|
||||
}
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
{
|
||||
"db_name": "PostgreSQL",
|
||||
"query": "\n SELECT EXISTS(SELECT 1 FROM stream_jobs WHERE track_id = $1 ORDER BY created_at DESC LIMIT 1)\n ",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"ordinal": 0,
|
||||
"name": "exists",
|
||||
"type_info": "Bool"
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Left": [
|
||||
"Uuid"
|
||||
]
|
||||
},
|
||||
"nullable": [
|
||||
null
|
||||
]
|
||||
},
|
||||
"hash": "1eeb07bcb77a3a4cd28b10dd59fd5102e09cffa6198ca712437dde469518ddae"
|
||||
}
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
{
|
||||
"db_name": "PostgreSQL",
|
||||
"query": "\n SELECT COUNT(DISTINCT quality) as quality_count\n FROM stream_segments\n WHERE track_id = $1\n ",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"ordinal": 0,
|
||||
"name": "quality_count",
|
||||
"type_info": "Int8"
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Left": [
|
||||
"Uuid"
|
||||
]
|
||||
},
|
||||
"nullable": [
|
||||
null
|
||||
]
|
||||
},
|
||||
"hash": "297a6db758baf694077ea56dcf31f550667370b93c3ea4f342c071af2089f46f"
|
||||
}
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
{
|
||||
"db_name": "PostgreSQL",
|
||||
"query": "\n UPDATE stream_jobs\n SET updated_at = NOW()\n WHERE id = (\n SELECT id FROM stream_jobs \n WHERE track_id = $1 \n ORDER BY created_at DESC \n LIMIT 1\n )\n ",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
"Left": [
|
||||
"Uuid"
|
||||
]
|
||||
},
|
||||
"nullable": []
|
||||
},
|
||||
"hash": "41a0fd92dc0d80ea803b90111666c973caf2fbe1c843dab80cd15db4f3f79069"
|
||||
}
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
{
|
||||
"db_name": "PostgreSQL",
|
||||
"query": "\n UPDATE stream_jobs\n SET status = 'error', error_message = $1, updated_at = NOW()\n WHERE id = (\n SELECT id FROM stream_jobs \n WHERE track_id = $2\n ORDER BY created_at DESC \n LIMIT 1\n )\n ",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
"Left": [
|
||||
"Text",
|
||||
"Uuid"
|
||||
]
|
||||
},
|
||||
"nullable": []
|
||||
},
|
||||
"hash": "68628b0452ec2e84845a34970930b3cddea5d14b18714da3660b8ec12466ecce"
|
||||
}
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
{
|
||||
"db_name": "PostgreSQL",
|
||||
"query": "\n UPDATE stream_jobs\n SET status = $1, updated_at = NOW()\n WHERE id = (\n SELECT id FROM stream_jobs \n WHERE track_id = $2\n ORDER BY created_at DESC \n LIMIT 1\n )\n ",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
"Left": [
|
||||
"Text",
|
||||
"Uuid"
|
||||
]
|
||||
},
|
||||
"nullable": []
|
||||
},
|
||||
"hash": "6cc847e2127024ae6315ba4ca394506f498a767ea59d5c62f79d356f2498a57e"
|
||||
}
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
{
|
||||
"db_name": "PostgreSQL",
|
||||
"query": "\n INSERT INTO stream_segments (track_id, quality, segment_index, path, duration)\n VALUES ($1, $2, $3, $4, $5)\n ON CONFLICT (track_id, quality, segment_index) DO NOTHING\n ",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
"Left": [
|
||||
"Uuid",
|
||||
"Text",
|
||||
"Int4",
|
||||
"Text",
|
||||
"Float8"
|
||||
]
|
||||
},
|
||||
"nullable": []
|
||||
},
|
||||
"hash": "778a13ac24988d9a61bcff4da9e98db44d615fd29a3c9ead4d2d1ae9ed1878e8"
|
||||
}
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
{
|
||||
"db_name": "PostgreSQL",
|
||||
"query": "\n SELECT quality, COUNT(*) as segment_count, MAX(segment_index) as max_index\n FROM stream_segments\n WHERE track_id = $1\n GROUP BY quality\n ",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"ordinal": 0,
|
||||
"name": "quality",
|
||||
"type_info": "Text"
|
||||
},
|
||||
{
|
||||
"ordinal": 1,
|
||||
"name": "segment_count",
|
||||
"type_info": "Int8"
|
||||
},
|
||||
{
|
||||
"ordinal": 2,
|
||||
"name": "max_index",
|
||||
"type_info": "Int4"
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Left": [
|
||||
"Uuid"
|
||||
]
|
||||
},
|
||||
"nullable": [
|
||||
false,
|
||||
null,
|
||||
null
|
||||
]
|
||||
},
|
||||
"hash": "a5ae1b8d2e93d4e2d701f9d3785d08e9fb448a8630863b01af9e820031a14f43"
|
||||
}
|
||||
|
|
@ -1,40 +0,0 @@
|
|||
{
|
||||
"db_name": "PostgreSQL",
|
||||
"query": "\n SELECT segment_index, path, duration, created_at\n FROM stream_segments\n WHERE track_id = $1\n ORDER BY segment_index ASC\n ",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"ordinal": 0,
|
||||
"name": "segment_index",
|
||||
"type_info": "Int4"
|
||||
},
|
||||
{
|
||||
"ordinal": 1,
|
||||
"name": "path",
|
||||
"type_info": "Text"
|
||||
},
|
||||
{
|
||||
"ordinal": 2,
|
||||
"name": "duration",
|
||||
"type_info": "Float8"
|
||||
},
|
||||
{
|
||||
"ordinal": 3,
|
||||
"name": "created_at",
|
||||
"type_info": "Timestamptz"
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Left": [
|
||||
"Uuid"
|
||||
]
|
||||
},
|
||||
"nullable": [
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false
|
||||
]
|
||||
},
|
||||
"hash": "a92ed55ed93a3fe12f785b9f025c47ed908ee3e1d4f241979146c74814bf6988"
|
||||
}
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
{
|
||||
"db_name": "PostgreSQL",
|
||||
"query": "\n INSERT INTO stream_jobs (id, track_id, status)\n VALUES ($1, $2, 'pending')\n ",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
"Left": [
|
||||
"Uuid",
|
||||
"Uuid"
|
||||
]
|
||||
},
|
||||
"nullable": []
|
||||
},
|
||||
"hash": "c1d73eec63d1af9ecf0e2928fcc1d29ec30c79b84426d470ef51b7c0e9e073f9"
|
||||
}
|
||||
|
|
@ -1,52 +0,0 @@
|
|||
{
|
||||
"db_name": "PostgreSQL",
|
||||
"query": "\n SELECT id, track_id, status, created_at, updated_at, error_message\n FROM stream_jobs\n WHERE id = $1\n ",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"ordinal": 0,
|
||||
"name": "id",
|
||||
"type_info": "Uuid"
|
||||
},
|
||||
{
|
||||
"ordinal": 1,
|
||||
"name": "track_id",
|
||||
"type_info": "Uuid"
|
||||
},
|
||||
{
|
||||
"ordinal": 2,
|
||||
"name": "status",
|
||||
"type_info": "Text"
|
||||
},
|
||||
{
|
||||
"ordinal": 3,
|
||||
"name": "created_at",
|
||||
"type_info": "Timestamptz"
|
||||
},
|
||||
{
|
||||
"ordinal": 4,
|
||||
"name": "updated_at",
|
||||
"type_info": "Timestamptz"
|
||||
},
|
||||
{
|
||||
"ordinal": 5,
|
||||
"name": "error_message",
|
||||
"type_info": "Text"
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Left": [
|
||||
"Uuid"
|
||||
]
|
||||
},
|
||||
"nullable": [
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
true
|
||||
]
|
||||
},
|
||||
"hash": "c32caf77b5ce66063cd03e0cdfe592a33418796d0d315a6e3b978f7bfd6ed7d4"
|
||||
}
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
{
|
||||
"db_name": "PostgreSQL",
|
||||
"query": "\n SELECT t.id, f.storage_path as \"source_path!\"\n FROM tracks t\n JOIN files f ON t.file_id = f.id\n WHERE t.id = $1\n ",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"ordinal": 0,
|
||||
"name": "id",
|
||||
"type_info": "Uuid"
|
||||
},
|
||||
{
|
||||
"ordinal": 1,
|
||||
"name": "source_path!",
|
||||
"type_info": "Text"
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Left": [
|
||||
"Uuid"
|
||||
]
|
||||
},
|
||||
"nullable": [
|
||||
false,
|
||||
false
|
||||
]
|
||||
},
|
||||
"hash": "e4747001c3e226a66b6eaefcce39326dba26f772bd8e41019b67d1eb953c0604"
|
||||
}
|
||||
|
|
@ -310,7 +310,7 @@ impl AuthManager {
|
|||
));
|
||||
}
|
||||
|
||||
let claims = validation_result.claims.ok_or(AuthError::InvalidToken("No claims in token".to_string())))?;
|
||||
let claims = validation_result.claims.ok_or(AuthError::InvalidToken("No claims in token".to_string()))?;
|
||||
|
||||
// Créer un nouveau UserInfo à partir des claims
|
||||
let user_info = UserInfo {
|
||||
|
|
|
|||