{"id":49686,"library":"waibu-rest-api","title":"waibu-rest-api","description":"REST API plugin for Waibu Web Framework, built on Fastify. Version 2.12.0 provides a modular RESTful API layer requiring waibu, waibu-db, and bajo-extra as peer dependencies. It integrates tightly with the Bajo ecosystem, offering configuration-driven API endpoints with automatic database binding. Release cadence is irregular; maintained by Ardhi. Differentiator: part of the Bajo framework stack, enabling rapid API development with minimal boilerplate.","status":"active","version":"2.12.0","language":"javascript","source_language":"en","source_url":"https://github.com/ardhi/waibu-rest-api","tags":["javascript","api","restful","restapi","waibu","web","webserver","bajo","framework"],"install":[{"cmd":"npm install waibu-rest-api","lang":"bash","label":"npm"},{"cmd":"yarn add waibu-rest-api","lang":"bash","label":"yarn"},{"cmd":"pnpm add waibu-rest-api","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Core web framework required","package":"waibu","optional":false},{"reason":"Database integration for REST endpoints","package":"waibu-db","optional":false},{"reason":"Extra utilities for Bajo-based projects","package":"bajo-extra","optional":false}],"imports":[{"note":"The package is ESM-only; CommonJS require will fail with ERR_REQUIRE_ESM.","wrong":"const waibuRestApi = require('waibu-rest-api')","symbol":"default","correct":"import waibuRestApi from 'waibu-rest-api'"},{"note":"Named export for the class; default export is the plugin instance.","wrong":"import WaibuRestApi from 'waibu-rest-api'","symbol":"WaibuRestApi","correct":"import { WaibuRestApi } from 'waibu-rest-api'"},{"note":"TypeScript types are exported alongside runtime code.","wrong":"","symbol":"type PluginConfig","correct":"import type { PluginConfig } from 'waibu-rest-api'"}],"quickstart":{"code":"import { WaibuRestApi } from 'waibu-rest-api'\n\nconst api = new WaibuRestApi({\n  prefix: '/api',\n  routes: 'auto',\n  db: process.env.DB_CONNECTION ?? 'sqlite://data.db'\n})\n\napi.start().then(() => console.log('REST API started'))","lang":"typescript","description":"Initializes a WaibuRestApi instance with auto-generated routes from database schemas and starts the server."},"warnings":[{"fix":"Convert your project to ESM (use 'import' statements, set 'type': 'module' in package.json, or use dynamic import().","message":"As of v2.0, the package is ESM-only. Attempting to require() it will throw ERR_REQUIRE_ESM.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Set routes: 'auto' to auto-generate from database schemas.","message":"The 'routes' option expects 'auto' or a path to a route definition file. Misconfiguration yields no endpoints.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Provide a connection string (e.g., 'sqlite://:memory:') or set DB_CONNECTION in environment.","message":"Database connection string must be set via 'db' option or environment variable DB_CONNECTION. No default fallback.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Replace addRoute(routeConfig) with registerRoute(routeConfig).","message":"Method 'addRoute' is deprecated in v2.5.0; use 'registerRoute' instead.","severity":"deprecated","affected_versions":">=2.5.0"},{"fix":"Rename 'port' to 'listenPort' in configuration.","message":"Option 'port' renamed to 'listenPort' in v2.3.0.","severity":"breaking","affected_versions":">=2.3.0"}],"env_vars":null,"search_vec":"'2.12.0':16 'api':4,6,21,46,68,74 'ardhi':58 'automat':49 'bajo':30,40,63,80 'bajo-extra':29 'bind':51 'boilerpl':72 'built':12 'cadenc':53 'configur':44 'configuration-driven':43 'databas':50 'db':27 'depend':34 'develop':69 'differenti':59 'driven':45 'ecosystem':41 'enabl':66 'endpoint':47 'extra':31 'fastifi':14 'framework':11,64,81 'integr':36 'irregular':55 'javascript':73 'layer':22 'maintain':56 'minim':71 'modular':19 'offer':42 'part':60 'peer':33 'plugin':7 'provid':17 'rapid':67 'releas':52 'requir':23 'rest':3,5,20,75 'restapi':76 'stack':65 'tight':37 'version':15 'waibu':2,9,24,26,77 'waibu-db':25 'waibu-rest-api':1 'web':10,78 'webserv':79","created_at":"2026-06-07T17:03:05.222819+00:00","updated_at":"2026-06-07T17:03:05.222819+00:00","problems":[{"fix":"Use import statement or dynamic import().","cause":"Using require() on an ESM-only package.","error":"ERR_REQUIRE_ESM"},{"fix":"Ensure all required options (prefix, routes, db) are provided.","cause":"Instance not properly constructed due to missing required options.","error":"TypeError: Cannot read properties of undefined (reading 'start')"},{"fix":"Run 'npm install waibu-db'.","cause":"Peer dependency waibu-db not installed.","error":"Error: Cannot find module 'waibu-db'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/ardhi/waibu-rest-api#readme","github":"https://github.com/ardhi/waibu-rest-api","docs":null,"changelog":null,"pypi":null,"npm":"waibu-rest-api","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}