### Update Installation Script Prompt Source: https://github.com/axissxs/vellum/blob/master/TODO/multi-db.md Example of the updated database provider selection prompt for the installation script. ```bash # Install script prompt: ? Choose your database provider: > Neon (serverless) Local PostgreSQL (Docker) Local PostgreSQL (native) AWS RDS Supabase Other (manual config) ``` -------------------------------- ### Get Setup Status Source: https://github.com/axissxs/vellum/blob/master/TODO/setup-and-update.md Returns the current initialization state, migration requirements, and version information. ```json { "initialized": true, "needsMigration": false, "dbVersion": "0013", "appVersion": "1.8.0", "usersCount": 5 } ``` -------------------------------- ### Quick Start Docker Compose Installation Source: https://github.com/axissxs/vellum/blob/master/TODO/install-docs.md Executes the Vellum installation script directly from the remote source. ```bash curl -fsSL https://vellum.dev/install.sh | bash ``` -------------------------------- ### Complete Setup Source: https://github.com/axissxs/vellum/blob/master/TODO/setup-and-update.md Extends the setup process by accepting user details and optional environment variable generation. ```json { "name": "Alex Morgan", "email": "alex@vellum.app", "password": "...", "teamName": "Engineering", "generateEnv": true, "envVars": { "DATABASE_URL": "postgresql://...", "NEXTAUTH_SECRET": "..." } } ``` -------------------------------- ### Install and Run Vellum Source: https://github.com/axissxs/vellum/blob/master/README.md Commands to clone the repository, install dependencies, configure the environment, run database migrations, and start the development server. ```bash # Clone and install git clone cd Vellum bun install # Configure environment cp .env.example .env # Edit .env with your DATABASE_URL and DIRECT_DATABASE_URL # Database setup bun run db:generate # Generate migrations from schema bun run db:migrate # Apply migrations bun run db:seed # Seed demo data (optional) # Development bun run dev # Start dev server at http://localhost:3000 ``` -------------------------------- ### Vellum Installation Guide Structure Source: https://github.com/axissxs/vellum/blob/master/TODO/install-docs.md The proposed outline for the docs/INSTALL.md file. ```markdown # Installing Vellum ## Quick Start (Docker Compose) One-liner that spins up everything: ```bash curl -fsSL https://vellum.dev/install.sh | bash ``` ## Manual Installation ### Prerequisites - Node.js 20+ or Bun 1.2+ - PostgreSQL 15+ - (Optional) Redis 7+ for caching - (Optional) Nginx for reverse proxy ### Step 1: Database Setup ### Step 2: Environment Configuration ### Step 3: Application Setup ### Step 4: Reverse Proxy (optional) ### Step 5: SSL with Let's Encrypt (optional) ## Docker Compose Full docker-compose.yml reference ## Environment Variables Reference Complete table of all env vars, defaults, and which are required ## Updating How to update to a new Vellum version ## Troubleshooting Common issues and solutions ``` -------------------------------- ### Initialize Vellum Development Environment Source: https://github.com/axissxs/vellum/blob/master/CONTRIBUTIONS.md Commands to clone the repository, install dependencies, configure environment variables, and start the development server. ```bash git clone https://github.com/AxissXs/Vellum.git cd Vellum && bun install cp .env.example .env # Add your DATABASE_URL and DIRECT_DATABASE_URL bun run db:migrate && bun run db:seed && bun run dev ``` -------------------------------- ### GET /api/setup Source: https://github.com/axissxs/vellum/blob/master/STRUCTURE.md Checks if the workspace has been initialized. ```APIDOC ## GET /api/setup ### Description Checks if the workspace is initialized. ### Method GET ### Endpoint /api/setup ### Response #### Success Response (200) - **initialized** (boolean) - Status of workspace initialization ``` -------------------------------- ### POST /api/setup/complete Source: https://github.com/axissxs/vellum/blob/master/TODO/setup-and-update.md Completes the application setup process by configuring user details and environment variables. ```APIDOC ## POST /api/setup/complete ### Description Finalizes the setup process. If generateEnv is true, it attempts to write a .env file to the project root. ### Method POST ### Endpoint /api/setup/complete ### Request Body - **name** (string) - Optional - User name - **email** (string) - Optional - User email - **password** (string) - Optional - User password - **teamName** (string) - Optional - Team name - **generateEnv** (boolean) - Optional - Whether to generate a .env file - **envVars** (object) - Optional - Environment variables to write ### Request Example { "name": "Alex Morgan", "email": "alex@vellum.app", "password": "...", "teamName": "Engineering", "generateEnv": true, "envVars": { "DATABASE_URL": "postgresql://...", "NEXTAUTH_SECRET": "..." } } ``` -------------------------------- ### GET /api/setup/status Source: https://github.com/axissxs/vellum/blob/master/TODO/setup-and-update.md Retrieves the current initialization and migration status of the application. ```APIDOC ## GET /api/setup/status ### Description Returns the current setup state of the app, including initialization status, migration requirements, and version information. ### Method GET ### Endpoint /api/setup/status ### Response #### Success Response (200) - **initialized** (boolean) - true if users table has at least one row - **needsMigration** (boolean) - true if there are pending migrations - **dbVersion** (string) - latest migration tag - **appVersion** (string) - current application version - **usersCount** (number) - total number of existing users #### Response Example { "initialized": true, "needsMigration": false, "dbVersion": "0013", "appVersion": "1.8.0", "usersCount": 5 } ``` -------------------------------- ### POST /api/setup Source: https://github.com/axissxs/vellum/blob/master/STRUCTURE.md Performs first-time workspace setup by creating a superadmin user, team, and initial project. ```APIDOC ## POST /api/setup ### Description Creates superadmin user, team, and initial project. ### Method POST ### Endpoint /api/setup ### Request Body - **name** (string) - Required - **email** (string) - Required - **password** (string) - Required - **teamName** (string) - Required ### Response #### Success Response (200) - **success** (boolean) - Indicates success - **userId** (string) - ID of the created user ``` -------------------------------- ### POST /api/super-admin/impersonate Source: https://github.com/axissxs/vellum/blob/master/STRUCTURE.md Start a user impersonation session. ```APIDOC ## POST /api/super-admin/impersonate ### Description Creates a new session as the target user for administrative purposes. ### Method POST ### Endpoint /api/super-admin/impersonate ### Request Body - **userId** (string) - Required ``` -------------------------------- ### GET /api/super-admin/permission-presets Source: https://github.com/axissxs/vellum/blob/master/TODO/role-permission-manager.md Lists all available permission presets. ```APIDOC ## GET /api/super-admin/permission-presets ### Description List all permission presets. ### Method GET ### Endpoint /api/super-admin/permission-presets ``` -------------------------------- ### GET /api/super-admin/trash Source: https://github.com/axissxs/vellum/blob/master/STRUCTURE.md List all soft-deleted entities. ```APIDOC ## GET /api/super-admin/trash ### Description Returns a paginated list of all soft-deleted entities across the system. ### Method GET ### Endpoint /api/super-admin/trash ### Parameters #### Query Parameters - **type** (string) - Optional entity type filter - **search** (string) - Optional search term - **page** (number) - Optional - **pageSize** (number) - Optional ``` -------------------------------- ### Configure Connection Pool Source: https://github.com/axissxs/vellum/blob/master/TODO/multi-db.md Update the connection pool initialization and provide an example .env configuration. ```typescript const pool = globalThis.__arenaNextJsPostgresqlPool ?? new Pool({ connectionString: process.env.DATABASE_URL }); ``` ```bash # Add to .env.example DATABASE_URL=postgresql://user:pass@localhost:5432/vellum # For providers that require SSL: # DATABASE_URL=postgresql://user:pass@host:5432/vellum?sslmode=require DATABASE_POOL_MAX=20 ``` -------------------------------- ### GET /api/super-admin/permissions Source: https://github.com/axissxs/vellum/blob/master/DONE.md Retrieves the role/permission matrix. ```APIDOC ## GET /api/super-admin/permissions ### Description Returns the matrix table showing roles and their associated permissions. ### Method GET ### Endpoint /api/super-admin/permissions ``` -------------------------------- ### GET /api/super-admin/health Source: https://github.com/axissxs/vellum/blob/master/DONE.md Retrieves system health metrics. ```APIDOC ## GET /api/super-admin/health ### Description Returns system health metrics including active sessions, total users, tasks, projects, and activity summaries. ### Method GET ### Endpoint /api/super-admin/health ``` -------------------------------- ### Superadmin Feature Flags API Response Source: https://github.com/axissxs/vellum/blob/master/TODO/feature-flags.md Example JSON response for the GET /api/super-admin/feature-flags endpoint, including full metadata for each flag. ```json { "flags": [ { "id": "uuid", "key": "tracking.lastSeen", "enabled": false, "label": "User Last Seen", "description": "Record last activity time/IP on every request", "category": "Tracking", "updatedAt": "..." } ] } ``` -------------------------------- ### GET /api/tasks Source: https://github.com/axissxs/vellum/blob/master/STRUCTURE.md Lists tasks with optional filtering. ```APIDOC ## GET /api/tasks ### Description Lists tasks based on provided filters. ### Method GET ### Endpoint /api/tasks ### Parameters #### Query Parameters - **projectId** (string) - Optional - Filter by project ID - **status** (string) - Optional - Filter by task status - **assigneeId** (string) - Optional - Filter by assignee ID ``` -------------------------------- ### GET /api/super-admin/roles Source: https://github.com/axissxs/vellum/blob/master/TODO/role-permission-manager.md Retrieves a list of all roles defined in the system. ```APIDOC ## GET /api/super-admin/roles ### Description List all roles currently defined in the system. ### Method GET ### Endpoint /api/super-admin/roles ``` -------------------------------- ### GET /api/board-columns/defaults Source: https://github.com/axissxs/vellum/blob/master/TODO/kanban-custom-columns.md Retrieves the global default columns used for new projects. ```APIDOC ## GET /api/board-columns/defaults ### Description Fetches the global default columns configuration. ### Method GET ### Endpoint /api/board-columns/defaults ``` -------------------------------- ### Public Feature Flags API Response Source: https://github.com/axissxs/vellum/blob/master/TODO/feature-flags.md Example JSON response for the GET /api/feature-flags endpoint, returning only enabled status for flags. ```json { "flags": { "notifications.push": true, "notifications.telegram": true, "tracking.lastSeen": false } } ``` -------------------------------- ### Usage of Feature Flags in Server Components Source: https://github.com/axissxs/vellum/blob/master/TODO/feature-flags.md Example of checking a feature flag within a server component. ```ts const pushEnabled = await isFeatureEnabled("notifications.push"); ``` -------------------------------- ### GET /api/auth/me Source: https://github.com/axissxs/vellum/blob/master/STRUCTURE.md Retrieves the currently authenticated user. ```APIDOC ## GET /api/auth/me ### Description Returns the current session user. ### Method GET ### Endpoint /api/auth/me ### Response #### Success Response (200) - **user** (object|null) - The current user or null if not authenticated ``` -------------------------------- ### Define POST /api/super-admin/roles request body Source: https://github.com/axissxs/vellum/blob/master/TODO/role-permission-manager.md Example JSON payload for creating a new role with a specific set of permissions. ```json { "name": "Project Manager", "description": "...", "permissions": ["view_projects", "create_projects"] } ``` -------------------------------- ### GET /api/projects/[id]/columns Source: https://github.com/axissxs/vellum/blob/master/TODO/kanban-custom-columns.md Retrieves all columns associated with a specific project. ```APIDOC ## GET /api/projects/[id]/columns ### Description Retrieves the list of columns for a given project. ### Method GET ### Endpoint /api/projects/[id]/columns ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the project. ``` -------------------------------- ### GET /api/super-admin/users/[id] Source: https://github.com/axissxs/vellum/blob/master/DONE.md Retrieves detailed information for a specific user. ```APIDOC ## GET /api/super-admin/users/[id] ### Description Returns a user profile including session history and activity timeline. ### Method GET ### Endpoint /api/super-admin/users/[id] ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the user. ``` -------------------------------- ### GET /api/telegram/config Source: https://github.com/axissxs/vellum/blob/master/TODO/telegram-bot-integration.md Public endpoint to check if the Telegram bot is configured. ```APIDOC ## GET /api/telegram/config ### Description Public endpoint — check if bot is configured (no auth). ### Method GET ### Endpoint /api/telegram/config ``` -------------------------------- ### GET /api/super-admin/trash Source: https://github.com/axissxs/vellum/blob/master/TODO/soft-delete-system.md Retrieves a paginated list of soft-deleted entities with optional filtering. ```APIDOC ## GET /api/super-admin/trash ### Description Retrieves a list of all soft-deleted entities. Supports filtering by type, search terms, date ranges, and user, as well as pagination. ### Method GET ### Endpoint /api/super-admin/trash ### Parameters #### Query Parameters - **type** (string) - Optional - Filter by entity type (task, project, comment, team, milestone, note, teamMember) - **search** (string) - Optional - Text search on title/name - **from** (string) - Optional - Start date range on deletedAt - **to** (string) - Optional - End date range on deletedAt - **deletedBy** (string) - Optional - User ID filter - **page** (number) - Optional - Page number - **pageSize** (number) - Optional - Items per page ### Response #### Success Response (200) - **items** (array) - List of deleted entities - **page** (number) - Current page - **pageSize** (number) - Items per page - **total** (number) - Total count of deleted items ``` -------------------------------- ### GET /api/super-admin/telegram/settings Source: https://github.com/axissxs/vellum/blob/master/TODO/telegram-bot-integration.md Retrieves bot settings, topic mappings, channel events, templates, and webhook URL. ```APIDOC ## GET /api/super-admin/telegram/settings ### Description Get bot settings, topic mappings, channel events, templates, webhook URL. ### Method GET ### Endpoint /api/super-admin/telegram/settings ``` -------------------------------- ### GET /api/super-admin/sessions Source: https://github.com/axissxs/vellum/blob/master/DONE.md Retrieves a list of all active user sessions. ```APIDOC ## GET /api/super-admin/sessions ### Description Retrieves a list of all active user sessions for monitoring purposes. ### Method GET ### Endpoint /api/super-admin/sessions ``` -------------------------------- ### Usage of Feature Flags in API Routes Source: https://github.com/axissxs/vellum/blob/master/TODO/feature-flags.md Example of checking a feature flag within a mutation route to conditionally execute logic. ```ts import { isFeatureEnabled } from "@/lib/feature-flags"; // In a mutation route: if (await isFeatureEnabled("tracking.lastSeen")) { await db.update(users).set({ lastSeenAt: new Date(), lastSeenIp: ip }).where(eq(users.id, userId)); } ``` -------------------------------- ### GET /api/super-admin/feature-flags Source: https://github.com/axissxs/vellum/blob/master/TODO/feature-flags.md Retrieves all feature flags with full metadata for superadmin users. ```APIDOC ## GET /api/super-admin/feature-flags ### Description Returns a list of all feature flags including metadata such as labels, descriptions, and categories. ### Method GET ### Endpoint /api/super-admin/feature-flags ### Response #### Success Response (200) - **flags** (array) - A list of flag objects containing id, key, enabled status, label, description, category, and updatedAt timestamp. #### Response Example { "flags": [ { "id": "uuid", "key": "tracking.lastSeen", "enabled": false, "label": "User Last Seen", "description": "Record last activity time/IP on every request", "category": "Tracking", "updatedAt": "..." } ] } ``` -------------------------------- ### GET /api/tokens Source: https://github.com/axissxs/vellum/blob/master/TODO/api-tokens.md Retrieves a list of all API tokens associated with the current user. ```APIDOC ## GET /api/tokens ### Description List current user's tokens. ### Method GET ### Endpoint /api/tokens ### Response #### Success Response (200) - **tokens** (array) - List of token objects containing id, name, prefix, lastUsedAt, expiresAt, and createdAt. ``` -------------------------------- ### Trash API Response Structure Source: https://github.com/axissxs/vellum/blob/master/TODO/soft-delete-system.md JSON structure for the GET /api/super-admin/trash endpoint response. ```json { "items": [ { "type": "task", "id": "uuid", "title": "Fix login bug", "deletedAt": "...", "deletedBy": { "id": "uuid", "name": "Alice", "email": "..." }, "projectName": "Project Alpha" // entity-specific fields } ], "page": 1, "pageSize": 25, "total": 150 } ``` -------------------------------- ### GET /api/feature-flags Source: https://github.com/axissxs/vellum/blob/master/TODO/feature-flags.md Retrieves a list of enabled feature flags for client-side UI gating. No authentication is required. ```APIDOC ## GET /api/feature-flags ### Description Returns a map of enabled feature flags. This endpoint is public and does not require authentication. ### Method GET ### Endpoint /api/feature-flags ### Response #### Success Response (200) - **flags** (object) - A map of flag keys to boolean enabled states. #### Response Example { "flags": { "notifications.push": true, "notifications.telegram": true, "tracking.lastSeen": false } } ``` -------------------------------- ### GET /api/super-admin/audit Source: https://github.com/axissxs/vellum/blob/master/TODO/audit-log-improvements.md Retrieves a paginated list of audit logs with optional filtering by tag, severity, and other metadata. ```APIDOC ## GET /api/super-admin/audit ### Description Retrieves a paginated list of audit logs. Supports filtering by various parameters including new tag and severity filters. ### Method GET ### Endpoint /api/super-admin/audit ### Parameters #### Query Parameters - **tag** (string) - Optional - Filter by tag - **severity** (string) - Optional - Filter by severity - **userId** (string) - Optional - Filter by user ID - **action** (string) - Optional - Filter by action - **ip** (string) - Optional - Filter by IP address - **from** (string) - Optional - Start date filter - **to** (string) - Optional - End date filter - **page** (integer) - Optional - Page number - **pageSize** (integer) - Optional - Number of items per page ### Response #### Success Response (200) - **logs** (array) - List of audit log entries - **page** (integer) - Current page number - **pageSize** (integer) - Items per page - **total** (integer) - Total number of logs - **totalPages** (integer) - Total number of pages ``` -------------------------------- ### Execute Vercel Build and Deployment Commands Source: https://github.com/axissxs/vellum/blob/master/AGENTS.md Use these commands to trigger the build process and production deployment. Note that migrations are handled separately via GitHub Actions. ```bash bun run vercel:build # db:generate + next build (does NOT run migrations) bun run vercel:deploy # db:migrate + vercel --prod (safety-net re-run; migrations should already be applied — see Changing Schema) ``` -------------------------------- ### Execute Project Scripts Source: https://github.com/axissxs/vellum/blob/master/README.md List of available Bun scripts for development, database management, quality assurance, and deployment. ```bash # Development bun run dev # Start dev server (Turbopack) # Database bun run db:generate # Generate migrations bun run db:migrate # Apply migrations bun run db:push # Push schema directly (no migration files) bun run db:studio # Open Drizzle Studio bun run db:seed # Seed full demo data # Quality bun run lint # ESLint bun run typecheck # TypeScript check bun run build # Production build # Deploy bun run vercel:build # Build with migration generation bun run vercel:deploy # Migrate + deploy to Vercel ``` -------------------------------- ### GET /api/telegram/status Source: https://github.com/axissxs/vellum/blob/master/STRUCTURE.md Check Telegram link status. ```APIDOC ## GET /api/telegram/status ### Description Returns the current user's Telegram link status and username. ### Method GET ### Endpoint /api/telegram/status ``` -------------------------------- ### GET /api/health Source: https://github.com/axissxs/vellum/blob/master/STRUCTURE.md Checks the health status of the API. ```APIDOC ## GET /api/health ### Description Returns the current health status of the service. ### Method GET ### Endpoint /api/health ### Response #### Success Response (200) - **status** (string) - Returns "ok" ``` -------------------------------- ### Run pre-commit verification commands Source: https://github.com/axissxs/vellum/blob/master/AGENTS.md Execute these commands in the specified order to ensure code quality and build stability before committing. ```bash bun run lint # flat ESLint config at eslint.config.mjs (no .eslintrc) bun run typecheck # tsc --noEmit, strict enabled bun run build # production build / Turbopack smoke test ``` -------------------------------- ### Execute Quality Assurance Checks Source: https://github.com/axissxs/vellum/blob/master/CONTRIBUTIONS.md Commands to run linting, type checking, and production builds. All must pass before committing. ```bash bun run lint # ESLint bun run typecheck # tsc --noEmit bun run build # production build ``` -------------------------------- ### Run Migrations Source: https://github.com/axissxs/vellum/blob/master/TODO/setup-and-update.md Executes pending database migrations programmatically for super-admin users. ```json { "dryRun": false } ``` ```json { "success": true, "migrationsApplied": ["0013_slim_dark_phoenix"], "message": "Applied 1 migration" } ``` -------------------------------- ### POST /api/auth/login Source: https://github.com/axissxs/vellum/blob/master/STRUCTURE.md Authenticates a user and establishes a session. ```APIDOC ## POST /api/auth/login ### Description Handles login, creates session, and sets cookie. ### Method POST ### Endpoint /api/auth/login ### Request Body - **email** (string) - Required - **password** (string) - Required ### Response #### Success Response (200) - **user** (object) - Authenticated user details ``` -------------------------------- ### GET /api/super-admin/telegram/stats Source: https://github.com/axissxs/vellum/blob/master/TODO/telegram-bot-integration.md Retrieves the count of paired users. ```APIDOC ## GET /api/super-admin/telegram/stats ### Description Paired user count. ### Method GET ### Endpoint /api/super-admin/telegram/stats ``` -------------------------------- ### Database CLI Commands Source: https://github.com/axissxs/vellum/blob/master/AGENTS.md Commonly used database management commands for generating, migrating, and seeding data. ```bash bun run db:generate # Generate migrations from src/db/schema.ts bun run db:migrate # Apply migrations — CI-only, see below. Never run on a feature branch. bun run db:push # Push schema directly (no migration files) — for local/Docker DBs bun run db:studio # Drizzle Studio bun run db:seed # Full demo data (manual, one-off) ``` -------------------------------- ### GET /api/milestones/[id] Source: https://github.com/axissxs/vellum/blob/master/STRUCTURE.md Retrieves a specific milestone by its ID. ```APIDOC ## GET /api/milestones/[id] ### Description Retrieves the details of a specific milestone. ### Method GET ### Endpoint /api/milestones/[id] ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the milestone. ``` -------------------------------- ### Add platformSettings table Source: https://github.com/axissxs/vellum/blob/master/TODO/telegram-bot-integration.md Creates the table for storing superadmin-configurable platform settings. ```ts export const platformSettings = pgTable("platform_settings", { id: uuid("id").primaryKey().defaultRandom(), key: text("key").notNull().unique(), value: text("value"), updatedAt: timestamp("updated_at").defaultNow().notNull(), }); ``` -------------------------------- ### Copy Global Default Columns Source: https://github.com/axissxs/vellum/blob/master/TODO/kanban-custom-columns.md Logic for initializing a new project with global default columns using the database client. ```ts const defaults = await db.select().from(boardColumns).where(isNull(boardColumns.projectId)); await db.insert(boardColumns).values( defaults.map(d => ({ ...d, id: crypto.randomUUID(), projectId: project.id })) ); ``` -------------------------------- ### POST /api/super-admin/permission-presets Source: https://github.com/axissxs/vellum/blob/master/TODO/role-permission-manager.md Creates a new permission preset. ```APIDOC ## POST /api/super-admin/permission-presets ### Description Create a new permission preset. ### Method POST ### Endpoint /api/super-admin/permission-presets ``` -------------------------------- ### GET /api/super-admin/audit/export Source: https://github.com/axissxs/vellum/blob/master/DONE.md Exports filtered audit logs to CSV format. ```APIDOC ## GET /api/super-admin/audit/export ### Description Downloads filtered audit logs as a CSV file. ### Method GET ### Endpoint /api/super-admin/audit/export ### Parameters #### Query Parameters - **format** (string) - Required - Must be 'csv' ``` -------------------------------- ### Configure Caching Environment Variables Source: https://github.com/axissxs/vellum/blob/master/TODO/caching.md Set these variables to enable Redis or Upstash caching. If unset, the system defaults to pass-through mode. ```bash # Required if caching is enabled (default: disabled if not set) REDIS_URL=redis://localhost:6379 # Standard Redis URL # OR REDIS_URL=rediss://... # TLS Redis # OR for Upstash UPSTASH_REDIS_REST_URL=https://... # Upstash REST API URL UPSTASH_REDIS_REST_TOKEN=... # Upstash REST API token ``` -------------------------------- ### Apply Semantic Theming Source: https://github.com/axissxs/vellum/blob/master/AGENTS.md Use semantic tokens for UI components to ensure consistent rendering across light and dark themes. ```tsx

Hover me

``` ```tsx // Never hardcode literal dark-theme colors

Hover me

{/* BAD */}
``` -------------------------------- ### Application Data Flow Diagram Source: https://github.com/axissxs/vellum/blob/master/STRUCTURE.md A visual representation of the request lifecycle, from browser initiation through server-side authentication and database interaction. ```text Browser Request │ ▼ Next.js App Router (Server Component) │ ├── getSession() ──────► cookies() ──────► session cookie │ │ │ ▼ │ sessions table (DB) │ │ │ ▼ │ users table (DB) │ │ │ ▼ │ Returns AuthUser │ ├── API Route (if data mutation) │ │ │ ├── getSession() ──► Auth check │ │ │ ├── db.query() ──────► PostgreSQL (Neon) │ │ │ └── Returns JSON │ └── Renders UI (with client components for interactivity) ``` -------------------------------- ### Authentication Utilities Source: https://github.com/axissxs/vellum/blob/master/STRUCTURE.md Methods for managing user sessions and verifying credentials. ```APIDOC ## Authentication Methods ### getSession() - Returns: `Promise` - Description: Retrieves the current authenticated user session. ### createSession(userId) - Parameters: `userId` (string) - Returns: `Promise` - Description: Creates a new session for the specified user. ### destroySession(sessionId) - Parameters: `sessionId` (string) - Description: Deletes an existing session. ### authenticateUser(email, password) - Parameters: `email` (string), `password` (string) - Returns: `Promise` - Description: Verifies user credentials and returns an authentication result object. ``` -------------------------------- ### Feature Flag Server Helper Module Source: https://github.com/axissxs/vellum/blob/master/TODO/feature-flags.md TypeScript implementation for fetching and caching feature flags from the database with a 60-second TTL. ```ts import { db } from "@/db"; import { featureFlags } from "@/db/schema"; import { eq } from "drizzle-orm"; const FLAG_CACHE_TTL = 60_000; // 60 seconds let flagCache: Map | null = null; let cacheTimestamp = 0; export async function isFeatureEnabled(key: string): Promise { const flags = await getAllFlags(); return flags.get(key) ?? false; } export async function getAllFlags(): Promise> { const now = Date.now(); if (flagCache && now - cacheTimestamp < FLAG_CACHE_TTL) { return flagCache; } const rows = await db.select().from(featureFlags); const map = new Map(rows.map((r) => [r.key, r.enabled])); flagCache = map; cacheTimestamp = now; return map; } export function invalidateFlagCache(): void { flagCache = null; cacheTimestamp = 0; } ``` -------------------------------- ### GET /api/telegram/status Source: https://github.com/axissxs/vellum/blob/master/TODO/telegram-bot-integration.md Checks if the current authenticated user has linked their Telegram account. ```APIDOC ## GET /api/telegram/status ### Description Check if current user has linked Telegram. ### Method GET ### Endpoint /api/telegram/status ``` -------------------------------- ### GET /api/telegram/pairing-code Source: https://github.com/axissxs/vellum/blob/master/TODO/telegram-bot-integration.md Generates a new pairing code for the current authenticated user. ```APIDOC ## GET /api/telegram/pairing-code ### Description Generate a new pairing code for current user. ### Method GET ### Endpoint /api/telegram/pairing-code ``` -------------------------------- ### Commit and Push Changes Source: https://github.com/axissxs/vellum/blob/master/CONTRIBUTIONS.md Standard commit message format and push command for contributing to the repository. ```bash git add . && git commit -m "type(scope): description" # feat(kanban): add drag-and-drop task reordering # fix(auth): handle expired session cleanup on login # db: add project_milestones table git push origin your-branch-name ``` -------------------------------- ### Project Directory Structure Source: https://github.com/axissxs/vellum/blob/master/README.md Overview of the Vellum project file organization, including the Next.js app router, database layer, and configuration files. ```text Vellum/ ├── src/ │ ├── app/ # Next.js App Router │ │ ├── api/ # API routes │ │ ├── dashboard/ # Protected dashboard pages │ │ ├── login/ # Login page │ │ └── page.tsx # Home (redirects) │ ├── components/ # React components │ ├── db/ # Database layer │ │ ├── schema.ts # Drizzle schema │ │ ├── seed.ts # Full demo data │ │ └── bootstrap.ts # Auto-seed on first request │ └── lib/ # Utilities (auth, api) ├── drizzle/ # Migrations (committed) ├── drizzle.config.ts # Drizzle Kit config └── package.json ``` -------------------------------- ### GET/PUT /api/super-admin/feature-flags Source: https://github.com/axissxs/vellum/blob/master/STRUCTURE.md Manage system feature flags. ```APIDOC ## GET /api/super-admin/feature-flags ### Description Retrieves all feature flags and their metadata. ### Method GET ### Endpoint /api/super-admin/feature-flags ## PUT /api/super-admin/feature-flags ### Description Updates feature flags and invalidates the in-memory cache. ### Method PUT ### Request Body - **updates** (array) - List of objects containing key and enabled status ``` -------------------------------- ### POST /api/super-admin/migrate Source: https://github.com/axissxs/vellum/blob/master/TODO/setup-and-update.md Triggers pending database migrations programmatically. ```APIDOC ## POST /api/super-admin/migrate ### Description Runs pending migrations programmatically. This endpoint is restricted to super-admin access. ### Method POST ### Endpoint /api/super-admin/migrate ### Request Body - **dryRun** (boolean) - Required - If true, simulates the migration without applying changes ### Request Example { "dryRun": false } ### Response #### Success Response (200) - **success** (boolean) - Indicates if the operation was successful - **migrationsApplied** (array) - List of applied migration names - **message** (string) - Status message #### Response Example { "success": true, "migrationsApplied": ["0013_slim_dark_phoenix"], "message": "Applied 1 migration" } ``` -------------------------------- ### GET /api/super-admin/audit/[id] Source: https://github.com/axissxs/vellum/blob/master/STRUCTURE.md Retrieve detailed information for a specific audit log entry. ```APIDOC ## GET /api/super-admin/audit/[id] ### Description Returns a single audit log entry including snapshots, actor information, entity state, and related timeline logs. ### Method GET ### Endpoint /api/super-admin/audit/[id] ### Response #### Success Response (200) - **log** (object) - Audit log row details - **snapshots** (array) - Before/after state snapshots - **actor** (object) - Enriched user information - **entity** (object) - Current entity state - **timeline** (array) - Recent audit logs for the same entity ``` -------------------------------- ### POST /api/projects/[id]/columns Source: https://github.com/axissxs/vellum/blob/master/TODO/kanban-custom-columns.md Creates a new column within a project. ```APIDOC ## POST /api/projects/[id]/columns ### Description Creates a new column for the specified project. ### Method POST ### Endpoint /api/projects/[id]/columns ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the project. #### Request Body - **name** (string) - Required - The display name of the column. - **key** (string) - Required - The unique key for the column. - **color** (string) - Required - The CSS class for the column color (e.g., "bg-red-500"). ### Request Example { "name": "Blocked", "key": "blocked", "color": "bg-red-500" } ``` -------------------------------- ### Implement Robust getClientIP Utility Source: https://github.com/axissxs/vellum/blob/master/TODO/audit-log-improvements.md Retrieves the client IP address by checking multiple headers and filtering out private IP ranges. ```ts import { NextRequest } from "next/server"; function isValidIP(ip: string): boolean { if (/^(\d{1,3}\.){3}\d{1,3}$/.test(ip)) { return ip.split(".").every((octet) => { const num = parseInt(octet, 10); return num >= 0 && num <= 255; }); } if (/^([0-9a-fA-F]{0,4}:){2,7}[0-9a-fA-F]{0,4}$/.test(ip)) return true; return false; } function isPrivateIP(ip: string): boolean { if (!ip.includes(".")) return false; const [a, b] = ip.split(".").map(Number); return ( a === 10 || (a === 172 && b >= 16 && b <= 31) || (a === 192 && b === 168) || a === 127 ); } export function getClientIP(req: NextRequest): string { const headersToCheck = [ "x-forwarded-for", "x-real-ip", "x-client-ip", "cf-connecting-ip", "true-client-ip", ]; for (const header of headersToCheck) { const value = req.headers.get(header); if (!value) continue; const ips = value.split(",").map((s) => s.trim()); for (const ip of ips) { if (isValidIP(ip) && !isPrivateIP(ip)) { return ip; } } } return "unknown"; } ``` -------------------------------- ### Write Task Creation Audit Log Source: https://github.com/axissxs/vellum/blob/master/TODO/audit-log-improvements.md Inserts a new activity log entry and a corresponding snapshot for task creation. ```ts const [log] = await db.insert(activityLogs).values({ userId: user.id, action: "created_task", entityType: "task", entityId: task.id, details: `Created task: ${task.title}`, ipAddress: getClientIP(req), tag: "data_change", severity: "info", }).returning(); await db.insert(activityLogSnapshots).values({ logId: log.id, tableName: "tasks", recordId: task.id, snapshot: JSON.stringify(task), snapshotType: "after", }); ``` -------------------------------- ### Task Format Template Source: https://github.com/axissxs/vellum/blob/master/TODO.md Use this markdown structure when adding new tasks to the TODO list to ensure consistency. ```markdown - [ ] **Title** - Description > Full plan: [`TODO/task-filename.md`](TODO/task-filename.md) Brief summary of what needs to be done. - Sub-task 1 - Sub-task 2 - Acceptance criteria: ... ``` -------------------------------- ### GET /api/super-admin/audit/export Source: https://github.com/axissxs/vellum/blob/master/TODO/audit-log-improvements.md Exports audit logs to CSV or JSON format with support for tag and severity filtering. ```APIDOC ## GET /api/super-admin/audit/export ### Description Exports audit logs. Supports CSV format with tag and severity columns, or JSON format including snapshot data. ### Method GET ### Endpoint /api/super-admin/audit/export ``` -------------------------------- ### POST /api/tokens Source: https://github.com/axissxs/vellum/blob/master/TODO/api-tokens.md Creates a new API token for the current user. ```APIDOC ## POST /api/tokens ### Description Create a new token. ### Method POST ### Endpoint /api/tokens ### Request Body - **name** (string) - Required - Name of the token - **expiresInDays** (integer) - Optional - Expiration in days ### Response #### Success Response (200) - **token** (string) - The full token string (shown only once) - **tokenInfo** (object) - Metadata about the created token ``` -------------------------------- ### API Client Helpers Source: https://github.com/axissxs/vellum/blob/master/STRUCTURE.md Utility functions for making authenticated API requests. ```APIDOC ## API Client Methods ### getJSON(url) - Parameters: `url` (string) - Description: Performs a GET request and parses the JSON response. ### postJSON(url, data) - Parameters: `url` (string), `data` (object) - Description: Performs a POST request with JSON data. ``` -------------------------------- ### Bootstrap Seeding Logic Source: https://github.com/axissxs/vellum/blob/master/TODO/setup-and-update.md Refactored bootstrap functions to distinguish between idempotent system data seeding and conditional demo data seeding. ```ts export async function ensureSystemData() { // Always idempotent — seeds feature flags, etc. } export async function ensureDemoData() { // Only if users table is empty AND explicitly requested } ``` -------------------------------- ### Retrieve audit logs with filtering Source: https://github.com/axissxs/vellum/blob/master/TODO/audit-log-improvements.md Response structure for the updated GET /api/super-admin/audit endpoint, now including tag and severity fields. ```json { "logs": [ { "id": "uuid", "userId": "uuid", "userName": "Alice", "userEmail": "alice@example.com", "action": "deleted_task", "entityType": "task", "entityId": "uuid", "details": "Soft-deleted task: Fix login bug", "ipAddress": "203.0.113.1", "tag": "data_change", "severity": "warning", "createdAt": "..." } ], "page": 1, "pageSize": 25, "total": 100, "totalPages": 4 } ``` -------------------------------- ### POST /api/super-admin/telegram/topics Source: https://github.com/axissxs/vellum/blob/master/TODO/telegram-bot-integration.md Creates a forum topic in the configured supergroup. ```APIDOC ## POST /api/super-admin/telegram/topics ### Description Create a forum topic in the configured supergroup. ### Method POST ### Endpoint /api/super-admin/telegram/topics ``` -------------------------------- ### Update Feature Flags API Request Source: https://github.com/axissxs/vellum/blob/master/TODO/feature-flags.md Example JSON request body for the PUT /api/super-admin/feature-flags endpoint to update flag states. ```json { "updates": [ { "key": "tracking.lastSeen", "enabled": false }, { "key": "notifications.telegram", "enabled": true } ] } ``` -------------------------------- ### POST /api/super-admin/impersonate/stop Source: https://github.com/axissxs/vellum/blob/master/STRUCTURE.md End the current impersonation session. ```APIDOC ## POST /api/super-admin/impersonate/stop ### Description Deletes the impersonation session and reverts to the original superadmin session. ### Method POST ### Endpoint /api/super-admin/impersonate/stop ``` -------------------------------- ### Create API Token Source: https://github.com/axissxs/vellum/blob/master/TODO/api-tokens.md Creates a new token with a specified name and optional expiration period. ```json // Request { "name": "CI Pipeline", "expiresInDays": 90 } // Response (full token shown ONCE) { "token": "vellum_a1b2c3d4e5f67890abcd", "tokenInfo": { "id": "uuid", "name": "CI Pipeline", "prefix": "a1b2c3d4", "expiresAt": "2026-10-15T..." } } ``` -------------------------------- ### GET /api/super-admin/audit/[id] Source: https://github.com/axissxs/vellum/blob/master/TODO/audit-log-improvements.md Retrieves a single audit log entry including full snapshot data, actor information, and current entity state. ```APIDOC ## GET /api/super-admin/audit/[id] ### Description Returns a single audit log entry with full snapshot data and related entity information. ### Method GET ### Endpoint /api/super-admin/audit/[id] ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the audit log entry ### Response #### Success Response (200) - **log** (object) - The audit log entry details - **snapshots** (array) - List of record snapshots - **actor** (object) - Enriched actor information - **entity** (object) - Current state of the entity ``` -------------------------------- ### Retrieve single audit log entry Source: https://github.com/axissxs/vellum/blob/master/TODO/audit-log-improvements.md Response structure for the new GET /api/super-admin/audit/[id] endpoint, providing full snapshot data and actor information. ```json { "log": { "id": "uuid", "userId": "uuid", "userName": "Alice", "userEmail": "alice@example.com", "userAvatar": "...", "action": "deleted_task", "entityType": "task", "entityId": "uuid", "details": "Soft-deleted task: Fix login bug", "ipAddress": "203.0.113.1", "tag": "data_change", "severity": "warning", "createdAt": "..." }, "snapshots": [ { "tableName": "tasks", "recordId": "uuid", "snapshotType": "before", "snapshot": { "id": "uuid", "title": "Fix login bug", "status": "in_progress" } } ], "actor": { "id": "uuid", "name": "Alice", "email": "alice@example.com", "role": "admin", "avatarUrl": "...", "lastLoginAt": "...", "lastIp": "..." }, "entity": { "exists": true, "current": { "id": "uuid", "title": "Fix login bug (restored)" } } } ``` -------------------------------- ### Define Kanban types and constants in TypeScript Source: https://github.com/axissxs/vellum/blob/master/TODO/kanban-custom-columns.md Contains shared type definitions for Tasks and Columns, default column configurations, priority styling maps, and task grouping logic. ```ts export type Task = { id: string; title: string; description: string | null; status: string; priority: string; projectId: string; assigneeId: string | null; creatorId: string; dueDate: string | null; position: string; createdAt: string; updatedAt: string; assigneeName: string | null; assigneeAvatar: string | null; projectName?: string | null; projectColor?: string | null; }; export type BoardColumn = { id: string; projectId: string | null; name: string; key: string; color: string; position: string; isDeletable: boolean; }; export type Column = { key: string; label: string; color: string; tasks: Task[]; }; export const DEFAULT_COLUMNS: BoardColumn[] = [ { id: "default-backlog", projectId: null, name: "Backlog", key: "backlog", color: "bg-slate-500", position: "0", isDeletable: false }, { id: "default-todo", projectId: null, name: "To Do", key: "todo", color: "bg-blue-500", position: "1", isDeletable: false }, { id: "default-in_progress", projectId: null, name: "In Progress", key: "in_progress", color: "bg-amber-500", position: "2", isDeletable: false }, { id: "default-review", projectId: null, name: "Review", key: "review", color: "bg-purple-500", position: "3", isDeletable: false }, { id: "default-done", projectId: null, name: "Done", key: "done", color: "bg-emerald-500", position: "4", isDeletable: false }, ]; export const priorityColors: Record = { urgent: "border-l-red-500", high: "border-l-orange-500", medium: "border-l-amber-500", low: "border-l-emerald-500", }; export const priorityBadges: Record = { urgent: "bg-red-500/10 text-red-400", high: "bg-orange-500/10 text-orange-400", medium: "bg-amber-500/10 text-amber-400", low: "bg-emerald-500/10 text-emerald-400", }; export const COLUMN_COLORS = [ "bg-slate-500", "bg-blue-500", "bg-amber-500", "bg-purple-500", "bg-emerald-500", "bg-red-500", "bg-pink-500", "bg-cyan-500", "bg-orange-500", "bg-teal-500", "bg-indigo-500", "bg-yellow-500", ]; export function groupTasksByColumns(tasks: Task[], columns: BoardColumn[]): Column[] { return columns.map(col => ({ key: col.key, label: col.name, color: col.color, tasks: tasks.filter(t => t.status === col.key), })); } ```