Install
Install apinni with favourite package manager
Apinni generates clean .d.ts files with API schemas and utilities from your backend decorators. Zero runtime overhead, no bundle exposure, with plugin support and proxy API capabilities.
Get up and running with Apinni in just 4 simple steps.
Install apinni with favourite package manager
Enable decorators in tsconfig.json
Add @Apinni decorators to your classes and methods
Run apinni CLI command
Generate clean .d.ts files without runtime logic or bundle exposure.
Generate only types files with API schemas from @Apinni decorators.
Types stay in .d.ts files, never bundled. Prevents API endpoint leaks in client builds.
Utilities to define ProxyApi schemas for proxy layers like Next.js.
Extensible plugin system to customize type generation and add framework-specific utilities.
Decorate your backend, get clean type definitions. No runtime code, no bundle bloat.
import { ApinniController, ApinniEndpoint } from '@apinni/client-ts';
type CreateUserDto = {
name: string;
email: string;
}
@ApinniController({ path: '/api/users' })
export class UserController {
@ApinniEndpoint({ path: '/:id', method: 'GET' })
async getUserById() {
// your framework specific param resolver
return { id: '1', name: 'John', email: 'john@mail.com' };
}
@ApinniEndpoint<{
request: {
type: CreateUserDto
}
}>({ path: '/', method: 'POST' })
async createUser(userData: CreateUserDto) {
return {
id: '1',
...userData,
createdAt: new Date().toISOString()
};
}
}
// Auto-generated by Apinni - Never bundled
export type GetApiUsersByIdResponse = {
id: string;
name: string;
email: string;
};
export type CreateUserDto = {
name: string;
email: string;
}
export type PostApiUsersRequest = CreateUserDto
export type PostApiUsersResponse = {
id: string;
name: string;
email: string;
createdAt: string;
};
// API Schema - No runtime code
export type Api = BuildApi<{
['/api/users/:id']: {
GET: {
query: never;
request: never;
responses: {
200: GetApiUsersByIdResponse;
};
};
};
['/api/users']: {
POST: {
query: never;
request: PostApiUsersRequest;
responses: {
200: PostApiUsersResponse;
};
};
};
}>;
// Utilities goes here
$ npm install @apinni/client-ts --save-dev
$ npm run apinni
$ yarn add -D @apinni/client-ts
$ yarn apinni
$ pnpm add -D @apinni/client-ts
$ pnpm run apinni
Enable decorators in your tsconfig.json and run Apinni to generate clean .d.ts files from your decorated controllers.