Flexbiz Server
raw JSON → 12.6.8 verified Sat Apr 25 auth: no javascript
Flexbiz Server is the backend service for the Flexbiz business application, providing API endpoints for business operations. The current stable version is 12.6.8. It is released on an irregular cadence with breaking changes between major versions. Key differentiators: built for the Flexbiz ecosystem, tightly coupled with the Flexbiz client, and not designed as a general-purpose server framework. Underlying dependencies include Express.js for HTTP handling and Sequelize for ORM, though these may vary by version.
Common errors
error ERR_MODULE_NOT_FOUND: Cannot find module 'flexbiz-server' ↓
cause Forgetting to install the package or incorrect import path.
fix
Run
npm install flexbiz-server and ensure the package is in node_modules. error TypeError: flexbiz_server_1.FlexbizServer is not a constructor ↓
cause Using a default import when FlexbizServer is a named export.
fix
Replace
import FlexbizServer from 'flexbiz-server' with import { FlexbizServer } from 'flexbiz-server'. error Error: listen is not a function ↓
cause Calling deprecated `server.listen()` on versions >=11.0.0.
fix
Use
await server.start() instead of server.listen(). error SequelizeConnectionError: getaddrinfo ENOTFOUND undefined ↓
cause Database host not provided or undefined in config.
fix
Ensure
config.db.host is set to a valid hostname or IP address. Warnings
breaking ESM-only starting from v10. CommonJS require() will throw ERR_REQUIRE_ESM. ↓
fix Switch to ESM by using import syntax, or downgrade to v9.x if CJS is required.
deprecated The method `server.listen()` is deprecated; use `server.start()` instead. ↓
fix Replace `server.listen()` with `await server.start()`.
breaking Configuration format changed: `db.host` is now required, `db.hostname` removed. ↓
fix Update config to use `host` property instead of `hostname`. Ensure `host` is provided.
gotcha Default export removed in v10; only named exports available. ↓
fix Use named imports like `import { FlexbizServer } from 'flexbiz-server'`.
gotcha Database initialization must be called explicitly before starting the server; no auto-connect. ↓
fix Call `initializeDatabase(config.db)` before `new FlexbizServer(config)`.
Install
npm install flexbiz-server yarn add flexbiz-server pnpm add flexbiz-server Imports
- FlexbizServer wrong
const FlexbizServer = require('flexbiz-server')correctimport { FlexbizServer } from 'flexbiz-server' - createApp wrong
import createApp from 'flexbiz-server'correctimport { createApp } from 'flexbiz-server' - Config wrong
import { Config } from 'flexbiz-server'correctimport type { Config } from 'flexbiz-server' - initializeDatabase wrong
import { initializeDatabase } from 'flexbiz-server'correctimport { initializeDatabase } from 'flexbiz-server/db'
Quickstart
import { FlexbizServer, Config } from 'flexbiz-server';
const config: Config = {
port: parseInt(process.env.PORT ?? '3000'),
db: {
host: process.env.DB_HOST ?? 'localhost',
port: parseInt(process.env.DB_PORT ?? '5432'),
database: process.env.DB_NAME ?? 'flexbiz',
username: process.env.DB_USER ?? 'admin',
password: process.env.DB_PASSWORD ?? '',
},
};
const server = new FlexbizServer(config);
await server.start();
console.log(`Server running on port ${config.port}`);