Common questions about Kenx and answers to help you get started.
Kenx is a config-first development framework for Node.js, Deno, and Bun. It emphasizes configuration over code, allowing you to build applications by declaring resources in YAML files rather than writing boilerplate.
Kenx advantages:
- Config-first approach - Less boilerplate, more productivity
- Multi-runtime support - Works with Node.js, Deno, and Bun
- Plugin system - Modular and extensible
- Framework agnostic - Switch between Express, Fastify, etc.
- Auto-wiring - Automatic dependency injection
- TypeScript-first - Built with TypeScript in mind
Compared to NestJS:
- Lighter weight and simpler
- Configuration-driven vs decorator-driven
- Faster setup for simple applications
Compared to AdonisJS:
- More flexible architecture
- Better multi-runtime support
- Simpler learning curve
Kenx is actively developed and used in production applications. However:
- Current version is
0.0.x(pre-1.0) - API may change between releases
- Test thoroughly before deploying critical applications
- Monitor the roadmap for stability updates
Beginner-friendly if you know:
- Basic Node.js and npm
- YAML syntax
- Basic TypeScript (optional but recommended)
Time to first app: 15-30 minutes
Time to proficiency: 1-2 weeks with regular use
- Documentation: This documentation site
- GitHub Issues: Report bugs or request features
- GitHub Discussions: Ask questions
- Examples: Check the
examples/directory
- Node.js: 16.x or higher (18.x recommended)
- npm: 7.x or higher
- OS: Windows, macOS, or Linux
Yes! Kenx works with both:
TypeScript:
typescript: trueJavaScript:
typescript: falseHowever, TypeScript is recommended for better developer experience and type safety.
No. Install locally per project:
npm install @ckenx/node
npm install -g @ckenx/cli # Optional, for CLI commandsYes, but it's easier to start fresh. To add to existing project:
- Install Kenx packages
- Create
.config/directory - Add configuration files
- Refactor entry point to use Kenx
See Migration Guide for details.
All configuration files go in the .config/ directory at the project root:
myapp/
├── .config/
│ ├── index.yml
│ ├── servers.yml
│ └── databases.yml
Currently, only YAML is supported for configuration files. JSON support may be added in future versions.
Use environment variables with references:
# .config/servers.yml
servers:
- HOST: [env]:HTTP_HOST
PORT: [env]:HTTP_PORTThen set different values in .env.local (dev) and .env.production.
Yes! Use the __extends__ property:
# .config/index.yml
__extends__:
- servers
- databases
- securityThis loads and merges servers.yml, databases.yml, and security.yml.
-
YAML syntax:
npm install -g yaml-lint yamllint .config/index.yml
-
Kenx validation: Run your app - Kenx will report configuration errors
Official plugins:
@ckenx/kenx-express- Express.js@ckenx/kenx-fastify- Fastify@ckenx/kenx-mysql- MySQL/MariaDB@ckenx/kenx-mongodb- MongoDB@ckenx/kenx-socketio- Socket.io@ckenx/kenx-vite- Vite build tool
See Plugins for complete list.
Via CLI:
ckenx install @ckenx/kenx-expressVia npm:
npm install @ckenx/kenx-expressAuto-install (development): Plugins referenced in config are auto-installed in development mode.
Yes! See Creating Plugins guide.
Basic structure:
export default class MyPlugin {
constructor(Setup, config) {
// Initialize plugin
}
// Plugin methods
}No. You can use local plugins:
servers:
- plugin: './src/plugins/my-plugin'# Default
node -r @ckenx/node
# With nodemon (auto-reload)
nodemon --exec 'node -r @ckenx/node'
# With package.json script
npm run devEnable debug logs:
DEBUG=kenx:* node -r @ckenx/nodeUse Node.js inspector:
node --inspect -r @ckenx/node
# Then open chrome://inspectAdd breakpoints:
export default async (server) => {
debugger // Breakpoint here
await server.listen()
}Yes, use nodemon:
npm install --save-dev nodemonnodemon.json:
{
"watch": ["src", ".config"],
"ext": "ts,js,yml",
"exec": "node -r @ckenx/node"
}Use standard testing tools like Jest:
import Core from '@ckenx/node'
describe('App', () => {
beforeAll(async () => {
await Core.Setup.dev()
await Core.autoload()
})
it('should load resources', () => {
expect(Core.RESOURCES.http).toBeDefined()
})
})See Testing Guide.
Singleton (pattern: '-'):
- Single entry point (
src/index.ts) - Full control over application flow
- Good for small to medium apps
MVC (pattern: 'mvc'):
- Separate models, views, controllers
- Structured approach
- Good for large, team-based apps
See Core Concepts.
Yes! The Singleton pattern gives you full control. Organize code however you prefer within src/.
Takeover is Kenx's dependency injection system. You declare which resources you need, and Kenx provides them:
export const takeover = ['http:api', 'database:default']
export default async (server, database) => {
// Use resources
}See Services & Resources.
Yes, but not recommended:
import Core from '@ckenx/node'
const server = Core.RESOURCES.http.api
const db = Core.RESOURCES.database.defaultTakeover is preferred for testability and clarity.
Via official plugins:
- MySQL / MariaDB
- MongoDB
- PostgreSQL (planned)
- Redis (as custom resource)
Via custom plugins:
- Any database with a Node.js driver
Kenx doesn't include a migration system. Use external tools:
MySQL:
npm install -g mysql-migrations
mysql-migrations upMongoDB:
npm install migrate-mongo
migrate-mongo upOr use ORM migrations (Prisma, TypeORM, etc.)
Yes! Configure multiple databases:
databases:
- key: primary
type: mysql
- key: analytics
type: mongodbAccess via takeover:
export const takeover = ['database:*']
export default (databases) => {
const { primary, analytics } = databases
}MySQL:
const connection = db.getConnection()
await connection.beginTransaction()
try {
await connection.query('INSERT ...')
await connection.query('UPDATE ...')
await connection.commit()
} catch (error) {
await connection.rollback()
throw error
}MongoDB:
const session = db.getConnection().startSession()
await session.withTransaction(async () => {
await collection.insertOne(doc, { session })
await collection.updateOne(filter, update, { session })
})-
Build:
npm run build
-
Set environment variables
-
Deploy to platform:
- Docker
- Heroku
- Railway
- VPS with PM2
See Deployment Guide.
Limited support. Kenx is designed for long-running processes. For serverless, consider:
- Using Kenx for API layer only
- Deploying to platforms with long-running container support
- Adapting the architecture for serverless constraints
Yes, for production:
npm run buildThis creates the dist/ directory with compiled JavaScript.
ecosystem.config.js:
module.exports = {
apps: [{
name: 'myapp',
script: 'npm',
args: 'start',
instances: 'max',
exec_mode: 'cluster',
env: {
NODE_ENV: 'production'
}
}]
}pm2 start ecosystem.config.jsPerformance depends on chosen plugins:
- Express: Good performance
- Fastify: 2-3x faster than Express
- Native HTTP: Maximum performance
Kenx adds minimal overhead (~5-10ms) for configuration loading and resource management.
-
Use connection pooling:
databases: - options: connectionLimit: 10
-
Enable clustering (PM2):
{ instances: 'max', exec_mode: 'cluster' }
-
Add caching (Redis)
-
Use Fastify instead of Express
-
Enable compression
See Best Practices.
Yes, with proper configuration:
- Use Fastify for better throughput
- Enable PM2 clustering
- Use load balancer (Nginx)
- Add caching layer
- Optimize database queries
Common causes:
- Configuration error - Check YAML syntax
- Missing plugin - Install required plugins
- Port in use - Change port or kill process
- TypeScript error - Run
tsc --noEmit
See Troubleshooting.
Auto-install only works in development:
NODE_ENV=development node -r @ckenx/nodeIn production, install manually:
npm install @ckenx/kenx-express- Check tsconfig.json is valid
- Fix TypeScript errors:
tsc --noEmit
- Clear and rebuild:
rm -rf dist/ npm run build
- Verify credentials in
.env - Check database is running
- Test connection manually:
mysql -h localhost -u user -p database
- Check firewall/network
- Report bugs: GitHub Issues
- Suggest features: GitHub Discussions
- Submit PRs: Fork and submit pull requests
- Improve docs: Documentation PRs welcome
- Create plugins: Share your plugins with the community
GitHub repository: codewithdark/kenx-js
Kenx is open source under the MIT License.
Express:
- Manual setup and configuration
- Middleware-based
- Flexible but verbose
Kenx:
- Config-driven setup
- Automatic resource management
- Can use Express as underlying framework
When to use Kenx: When you want faster setup with less boilerplate
NestJS:
- Angular-inspired architecture
- Decorator-based
- Full-featured framework
- Steeper learning curve
Kenx:
- Simpler, config-driven
- Less opinionated
- Faster for simple apps
- Easier to learn
When to use Kenx: Smaller projects, teams preferring configuration over decorators
AdonisJS:
- Full-stack MVC framework
- Includes ORM, templating, auth
- Opinionated structure
Kenx:
- More flexible
- Bring your own tools
- Multi-runtime support
- Lighter weight
When to use Kenx: When you want flexibility and control
Check the ROADMAP.md for planned features.
Highlights:
- More database plugins
- Built-in testing utilities
- GraphQL support
- Improved CLI tools
- Better documentation
No specific timeline yet. Version 1.0 will be released when:
- API is stable
- Core features complete
- Production-tested
- Documentation comprehensive
- Watch GitHub repo for releases
- Follow discussions on GitHub
- Check changelog for updates
- Documentation: Explore the full documentation
- GitHub Issues: Search existing issues
- GitHub Discussions: Ask the community
- Examples: Check
examples/directory in the repo
Previous: ← Troubleshooting | Next: Core Concepts →