wow_backend_dev
Comprehensive guide for developing backend APIs, database interactions, and security protocols in the Way of Work (WoW) project
Install / Use
npx skills add Way-Of/wayofmonoInstalls into whichever agent you are using.
Gemini Rules
Gemini CLI config
Quality Score
Category
SecuritySupported Platforms
Skill content
View source on GitHubname: wow_backend_dev description: Comprehensive guide for developing backend APIs, database interactions, and security protocols in the Way of Work (WoW) project. Use when working on server routes, database schemas, or API logic.
wow_backend_dev
Architecture & Core Tech Stack
- Runtime: Bun (v1.x). Native APIs (
Bun.serve,Bun.spawn,Bun.file) are preferred over Node.js polyfills where applicable. - Database: SQLite via
bun:sqlite(synchronous execution). Strictly no ORMs. write raw, parameterized SQL. - Routing: Custom minimalist router (
server/router.ts). Routes are registered in separate modules underserver/routes/and composed inserver/index.ts. - Authentication: JWT-based. The router extracts
{ userId, tenantId, role }and passes it as theauthobject to handlers.
1. Database & Schema Conventions
The primary database is data/wayofwork.sqlite.
Key Tables:
tenants: Multi-tenant boundary.users: Includesrole(SUPER_ADMIN,ADMIN,LEADER,WORKER,CLIENT,DEMO).projects&project_members: For project-level isolation.tasks: Kanban cards.time_entries&time_blocks: Time tracking.tickets: Swedish "ÄTA" (change orders) and standard tickets.ta_plans: Traffic arrangement plans (TDOK 2024:0043).pending_changes: Human-in-the-Loop queue (WOW-010).audit_logs: Information access tracking (WOW-016).
Query Patterns:
- Execute:
db.run("INSERT INTO table (id) VALUES (?)", [id]) - Fetch One:
db.query("SELECT * FROM table WHERE id = ?").get(id) as Type - Fetch Many:
db.query("SELECT * FROM table WHERE tenant_id = ?").all(tenantId) as Type[] - IDs: Always use unique string identifiers (e.g., UUIDs or
prefix_${Date.now()}_${random}).
2. Multi-Tenant & Access Control (WOW-016)
CRITICAL: Security and data isolation are paramount.
- Tenant Isolation: EVERY query mapping to a tenant-specific resource MUST include
tenant_id = ?. - Worker Project Isolation:
WORKERroles must only see data related to projects they are explicitly members of via theproject_membersjoin table. - Economics Shield:
WORKER,CLIENT, andLEADERroles MUST NOT see financial data. You must manually strip fields likebudget,budget_allocated,cost_estimate,hourly_rate, andovertime_ratefrom objects before returning JSON. - Audit Logging: Use the
auditLog()helper (server/audit-logger.ts) to log sensitive events:action: "VIEW_ECONOMICS"(Admin views prices/budgets)action: "ACCESS_DENIED"(Worker tries to view restricted project)action: "SEARCH"oraction: "READ"(Tracking user queries)
3. API Route Construction
- Create new route groups in
server/routes/<feature>.ts. - Export a register function:
export function registerFeatureRoutes(router: Router) { ... }. - Handlers receive
(req: Request, params: Record<string, string>, auth: AuthInfo | null). - Validate
authearly:if (!auth) return json({ error: "Unauthorized" }, 401); - Return JSON using the utility:
import { json } from "../utils"; return json(data); - Always wrap database calls in
try/catchand return500on failure.
4. Sub-Systems
- Git/GitHub (WOW-013): High-level wrappers exist in
server/git.ts(gitCommit,gitPush,gitLog). - Channels (WOW-015): Inbound messages route through
server/channel-router.ts. Outbound messaging uses tools inserver/orchestrator-channel-tools.ts.
Related Skills
Agent-Reach
84.4kGive your AI agent eyes to see the entire internet. Read & search Twitter, Reddit, YouTube, GitHub, Bilibili, XiaoHongShu — one CLI, zero API fees.
headroom
73.4kCompress tool outputs, logs, files, and RAG chunks before they reach the LLM. 20% fewer tokens for coding agents, 60-95% fewer tokens for JSON, same answers. Library, proxy, MCP server.
Scrapling
82.8k🕷️ An adaptive Web Scraping framework that handles everything from a single request to a full-scale crawl! Don't be shy, join here: https://discord.gg/EMgGbDceNQ
LocalAI
49.2kLocalAI is the open-source AI engine. Run any model - LLMs, vision, voice, image, video - on any hardware. No GPU required.
Security Score
Audited on Invalid Date
