npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

fastapi-next

v1.6.10

Published

Next Generation of Fast Api

Readme

Fast Api Next

Fast Api Next

Fast Api provides to create advanced level api infrastructures without any effort. It's manage sessions, plugins, middleware-functions automatically and creates secure connections between client and api gateway. Also, you can create real-time routers via enabling web socket support.

Start here

Fast Api Start

Guidance

Guidance

Release History

Release History

Entity System (Beta)

Code-first entity & view layer that lets you define:

  • Entities (logical -> table mapping)
  • Fields (type, defaults, readonly)
  • Views (projections, base filters, ordering, search fields, default page size)

Supports OData-like query params at runtime: $select,$filter,$orderby,$top,$skip,$search (mounted onto knex, no DB views created).

Example

import { EntityManager, EntityFieldType, EntityRetrieveManyAction } from 'fastapi-next';

const em = new EntityManager(name => app.context[name]);
em.register({
	name: 'account',
	table: 'accounts',
	fields: [
		{ name: 'id', type: EntityFieldType.Guid, primary: true },
		{ name: 'name', type: EntityFieldType.String },
		{ name: 'isActive', type: EntityFieldType.Boolean, default: true },
		{ name: 'createdOn', type: EntityFieldType.DateTime, readonly: true }
	],
	defaultFields: ['id','name','isActive'],
	views: [
		{ name: 'active', where: { isActive: true }, orderBy: [{ field: 'name'}], search: ['name'] }
	],
	defaultView: 'active'
});
app.registry.registerObject('entities', em);

// In workflow definition
new EntityRetrieveManyAction('entities', 'account', 'active');

Request example

/api/accounts?$select=id,name&$filter={"isActive":true}&$orderby=name desc&$top=20&$skip=0&$search=foo

DB Middleware Auto-Load

Otomatik veritabanı middleware yükleme:

Uygulama ayarına ekleyin:

const app = new NextApplication({
	middleware: {
		db: { enabled: true, pluginName: 'db', dirs: ['src/db-middlewares'] }
	}
});

Relation Upsert (Entity + Relations)

Workflow action: EntityUpsertWithRelationsAction

Örnek:

new EntityUpsertWithRelationsAction(
	'entities',            // entity manager
	'order',               // primary entity
	'$.body.order',        // main order data
	[
		{ relation: 'items', mode: 'replace', dataPath: '$.body.items' }
	]
)

Entity tanımı (özet):

em.register({
	name:'order', table:'orders', fields:[{name:'id',primary:true,type:EntityFieldType.Guid},{name:'orderNo',type:'string'}],
	relations:[{ name:'items', type:'oneToMany', target:'orderItem', foreignKey:'orderId', cascade:{ insert:true, update:true, delete:true } }]
});
em.register({ name:'orderItem', table:'order_items', fields:[{name:'id',primary:true,type:EntityFieldType.Guid},{name:'orderId',type:'guid'},{name:'productId',type:'guid'},{name:'qty',type:'number'}] });

İstek body:

{
	"order": { "id":"...", "orderNo":"O-1001" },
	"items": [ {"productId":"P1","qty":2}, {"productId":"P2","qty":1} ]
}

mode:'replace' eski çocuk kayıtları siler ve yenilerini ekler; 'upsert' mevcutları günceller, yoksa ekler; 'insert' sadece ekler. Klasörde bir middleware dosyası (tenantFilter.ts):

module.exports = {
	name: 'tenantFilter',
	priority: 10,
	before(ctx){
		if(ctx.operation==='select' && ctx.table!=='public_tables') {
			const tenantId = ctx.nextContext.session?.tenantId;
			if(tenantId && !ctx.nextContext.headers['x-bypass-tenant']) {
				ctx.query.where({ tenantId });
			}
			// Soft delete default
			if(!ctx.nextContext.headers['x-bypass-soft-delete']) {
				ctx.query.andWhere({ isDeleted: false });
			}
		}
	}
};

Birden fazla export desteği:

exports.middlewares = [ { name:'a', before(){} }, { name:'b', before(){} } ];