Igo Server
Introduction
@igojs/server is the framework that holds Igo.js together. It wraps Express 5 with everything a typical web app needs — routing conventions, forms, internationalization, email, caching, error handling, a project scaffold and a CLI — without forcing you into a heavy plugin ecosystem.
The goal is a small surface that lets you ship a real application by writing controllers and templates, not by configuring middleware.
Key Features
- Express 5 core — async-friendly request handling out of the box
- File-based project layout —
app/controllers/,app/routes.js,views/,sql/,locales/,seeds/ - Forms with sanitize → validate → convert pipeline — schema-driven, type-coerced
- i18n via i18next — language detection, translation files, CLI for syncing
- Redis cache —
get/put/fetch/flushwith namespaced keys - Flash scope with automatic Redis fallback for large payloads
- Mailer — Nodemailer with MJML and Dust templates
- Robust error handling — request errors, unhandled rejections, uncaught exceptions, all with throttled crash emails
- CLI —
igo create,igo db,igo i18n,igo console
Quick Start
Scaffold a new project:
npx @igojs/server create myproject
cd myproject
npm install
npm startnpm start runs nodemon + webpack in parallel — the server reloads on app/ changes, the bundle rebuilds on js/ and scss/ changes.
Minimal app
If you'd rather wire things up by hand:
const igo = require('@igojs/server');
igo.app.run();
// → calls configure() (middleware chain, db, cache, i18n, view engine, routes)
// → listens on config.httpportDefine routes in app/routes.js, controllers in app/controllers/, templates in views/, and you have an app.
Configuration
Configuration is loaded from several files, in order — see Development › Configuration for the full list. The minimum is an app/config.js that exports a function taking the config object:
// app/config.js
module.exports = (config) => {
config.httpport = process.env.PORT || 3000;
config.mysql = { database: process.env.MYSQL_DATABASE };
config.redis = { socket: { host: process.env.REDIS_HOST || '127.0.0.1' } };
};Next steps
- Routes & controllers — Routing and the controller layer
- Views — View engine, helpers, custom helpers
- Forms — Sanitize/validate/convert pipeline
- Cache — Redis cache API
- Mailer — Sending emails with MJML/Dust
- Flash scope — Cross-redirect messages
- i18n — Multi-language support
- Error handling — Catching, throttling and notifying
- Development & CLI — npm scripts, webpack, CLI commands
- Production — Deploy, logging, monitoring
- Testing — Mocha helpers, controller tests