Registry / devops / fong
library0.1.9jsnpmunverified

fong is a TypeScript-first Node.js gRPC framework (v0.1.9, alpha) that follows 'convention over configuration' principles inspired by Egg.js. It provides automatic loading of proto files, middleware, controllers, services, and utilities based on directory structure. Key differentiators vs alternatives like Mali include built-in configuration management, structured logging, code generation, and full TypeScript source code visibility for definition navigation. The framework is in early development with limited community adoption. Release cadence is irregular, mainly maintenance updates.

npm install fong
INSTALL
IMPORT
SIG · FONG
F
fong
devopsjavascriptv0.1.9
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

App
import App from 'fong'
const App = require('fong')
ESM-only package, no CommonJS support.
Context
import { Context } from 'fong'
import Context from 'fong'
Context is a named export, not a default export.
Controller
import { Controller } from 'fong'
import Controller from 'fong'
Controller is a named export used as a base class.

Create a minimal gRPC service with fong: directory setup, config, proto, controller, and entry point.

// Install: npm install fong // Create directory structure: proto/, config/, controller/, midware/, service/, util/ // config/config.default.ts: export default (appInfo: any) => { return { PORT: 50051 }; }; // proto/greeter.proto: syntax = "proto3"; service Greeter { rpc sayHello (HelloRequest) returns (HelloReply); } message HelloRequest { string name = 1; } message HelloReply { string message = 1; } // controller/greeter.ts: import { Controller, Context } from 'fong'; export default class GreeterController extends Controller { async sayHello(ctx: Context, req: any) { return { message: `Hello ${req.name}` }; } } // app.ts (entry): import App from 'fong'; const app = new App(); app.start(); console.log('Server started on port 50051');
Debug
Known issues
deprecatedThe grpc package is deprecated in favor of @grpc/grpc-js, but fong still uses grpc.
fix
Consider using a more modern gRPC framework like @grpc/grpc-js or Mali.
affects: >=0.1.0
gotchafong requires a strict directory structure and will not work if files are misplaced.
fix
Follow the required directory layout exactly (proto/, config/, controller/, midware/, etc.).
affects: >=0.1.0
gotchaConfiguration files must export a function, not an object.
fix
Use export default (appInfo: AppInfo) => ({ ... }) instead of export default { ... }.
affects: >=0.1.0
Errors
Common errors & fixes
Error: Cannot find module 'grpc'
fong depends on grpc package which is not installed.
fix
Run npm install grpc or use a different framework that uses @grpc/grpc-js.
Error: Config file must export a function
Configuration file exports an object instead of a function.
fix
Change config export to: export default (appInfo) => ({ ... })
Error: Controller 'GreeterController' must extend Controller
Controller class does not extend the base Controller class from fong.
fix
Add extends Controller to your controller class.
Upgrade
Version history
0.1.9latest on npm
Audit
Dependencies
grpcoptionalgRPC runtime dependency for Node.js
Agent activity
2 hits · last 30 days
node
2
Resources
packagefong
fong — npm install fong · libregistry