FastKit is a developer-first, modular, and type-safe toolkit for building modern applications with authentication, database management, and configuration handling out of the box.
β
Authentication Module β Complete auth system with controllers and services
β
Database Config β Multi-database support with type-safe configurations
β
Environment Management β Automated environment setup and configuration
β
TypeScript First β Full type safety across all modules
β
Framework Agnostic β Use with Express, Fastify, or any Node.js framework
β
Tree-shakable β Import only what you need for optimal bundle size
npm install @nexgenstudiodev/fastkit
- Node.js 16+
- TypeScript 4.5+ (for TypeScript projects)
- π Complete Auth System β Login, register, JWT handling, password reset
- οΏ½οΈ Multi-Database Support β MongoDB, PostgreSQL, MySQL, SQLite, Redis
- βοΈ Smart Configuration β Environment-based config with auto-generation
- π§© Modular Architecture β Use individual modules or the complete package
- π Universal Compatibility β Works with CommonJS, ES Modules, and TypeScript
- π Type Safety β Full TypeScript support with comprehensive type definitions
FastKit/
βββ package.json (root)
βββ pnpm-workspace.yaml
βββ src/
βββ packages/
βββ fastkit
βββ fastkit-config
βββ fastkit-db-config
βββ fastkit-auth
# Using npm
npm install @nexgenstudiodev/fastkit
# Using pnpm
pnpm add @nexgenstudiodev/fastkit
# Using yarn
yarn add @nexgenstudiodev/fastkit
const express = require('express');
const {
auth,
config,
db,
AuthController,
setup_FastKit_EnvFiles,
} = require('@nexgenstudiodev/fastkit');
const app = express();
// Setup environment files
setup_FastKit_EnvFiles();
// Use auth controller
app.post('/api/auth/login', auth.AuthController.login);
app.post('/api/auth/register', auth.AuthController.register);
// Database configuration
const dbConfig = {
type: 'mongodb',
url: process.env.DATABASE_URL || 'mongodb://localhost:27017/myapp',
};
app.listen(3000, () => {
console.log('FastKit app running on port 3000');
});
import express from 'express';
import {
auth,
config,
db,
AuthController,
setup_FastKit_EnvFiles,
FastKit,
} from '@nexgenstudiodev/fastkit';
const app = express();
// Setup environment and configuration
setup_FastKit_EnvFiles();
const appConfig = new FastKit();
// Authentication routes
app.post('/api/auth/login', AuthController.login);
app.post('/api/auth/register', AuthController.register);
app.post('/api/auth/logout', AuthController.logout);
// Database setup
const dbConfig = {
type: 'postgresql',
host: 'localhost',
port: 5432,
databaseName: 'myapp',
};
app.listen(3000, () => {
console.log('FastKit app running on port 3000');
});
import express, { Request, Response } from 'express';
import {
auth,
config,
db,
AuthController,
AuthService,
setup_FastKit_EnvFiles,
FastKit,
DatabaseConfig,
DatabaseType,
Config_Type,
} from '@nexgenstudiodev/fastkit';
const app = express();
// Type-safe configuration
setup_FastKit_EnvFiles();
const appConfig: Config_Type = new FastKit({
database: {
type: 'mongodb',
url: process.env.DATABASE_URL,
},
auth: {
jwtSecret: process.env.JWT_SECRET || 'fallback-secret',
expiresIn: '7d',
},
});
// Type-safe database configuration
const dbConfig: DatabaseConfig = {
type: 'postgresql' as DatabaseType,
host: 'localhost',
port: 5432,
username: 'admin',
password: 'password',
databaseName: 'myapp',
ssl: true,
};
// Authentication with full type support
app.post('/api/auth/login', AuthController.login);
app.post('/api/auth/register', AuthController.register);
app.listen(3000, () => {
console.log('TypeScript FastKit app running on port 3000');
});
Complete authentication system with controllers, services, and utilities.
Key Features:
- Login/Register endpoints
- JWT token management
- Password reset functionality
- Authentication middleware
Quick Usage:
import { AuthController, AuthService } from '@nexgenstudiodev/fastkit';
// Use pre-built controllers
app.post('/login', AuthController.login);
Smart configuration management with environment handling.
Key Features:
- Automatic environment file generation
- Type-safe configuration objects
- Environment-specific settings
- Configuration validation
Quick Usage:
import { setup_FastKit_EnvFiles, FastKit } from '@nexgenstudiodev/fastkit';
// Auto-generate .env files
setup_FastKit_EnvFiles();
// Type-safe configuration
const config = new FastKit();
π Full Config Documentation
Multi-database support with type-safe configurations.
Key Features:
- Support for MongoDB, PostgreSQL, MySQL, SQLite, Redis
- Type-safe database configurations
- Connection string generation
- Environment-based setup
Quick Usage:
import { DatabaseConfig, DatabaseType } from '@nexgenstudiodev/fastkit';
const dbConfig: DatabaseConfig = {
type: 'mongodb',
url: process.env.DATABASE_URL,
options: { useNewUrlParser: true }
};
π Full Database Config Documentation
FastKit supports multiple import patterns for maximum flexibility:
// Everything from main package
import { auth, config, db, AuthController, FastKit } from '@nexgenstudiodev/fastkit';
// Import only what you need
import { AuthController } from '@nexgenstudiodev/fastkit/auth';
import { FastKit } from '@nexgenstudiodev/fastkit/config';
import { DatabaseConfig } from '@nexgenstudiodev/fastkit/db';
// Organized by module
import { auth, config, db } from '@nexgenstudiodev/fastkit';
const controller = auth.AuthController;
const dbConfig = db.DatabaseConfig;
// server.js
import express from 'express';
const app = express();
import { FastKit, setup_FastKit_EnvFiles, Config_Type } from '@nexgenstudiodev/fastkit/config';
setup_FastKit_EnvFiles();
const fastKit = new FastKit(app);
fastKit.get('/', (req, res) => {
res.send('Hello World!');
});
fastKit.listen(3000, () => {
console.log('Server is running on http://localhost:3000');
});
// apiRoutes.ts
import { fastKit } from './fastkit';
import { authController } from './features/Auth/v1/Auth.controller';
import { verifyToken } from './middlewares/verifyToken';
import { SendResponse } from './utils/SendResponse';
fastKit.get('/ping', (req, res) => {
SendResponse.success(res, 'Pong!');
});
fastKit.post('/auth/signup', authController.signup);
fastKit.get('/auth/me', verifyToken, authController.getProfile);
fastKit.post('/auth/login', authController.login);
import { EmailService } from './services/email/v1/Email.service';
await EmailService.sendOtp(email);
fastKit.get('/user', verifyToken, userController.getUserById);
SendResponse.success(res, 'Your API works!');
SendResponse.error(res, 'Something went wrong', 400);
- Auth systems (JWT, OTP, social logins)
- Todo, Notes, Blog, Folder/File systems
- File Uploads & Content Management
- Payment integration (Stripe, Razorpay)
- Reminder & Notification system (NodeMailer, Cron)
- AI assistants via OpenAI API
- WebSocket / Realtime apps with Socket.io
- Admin panels with RBAC (roles/permissions)
You can export every module individually and use them in any project:
import { AuthController } from 'fastkit-auth';
import { TodoController } from 'fastkit-todo';
verifyToken
β Protect routes using JWTvalidateBody(schema)
β Validate input with Zod or JoiallowRoles('admin', 'user')
β Role-based access control
EmailService.sendOtp(email, template);
EmailService.sendCustom(subject, message, to);
EmailService.sendReminder(userId, date, content);
- Create Folder
- Create File Inside Folder (supports custom extensions)
- Delete Folder (with restriction middleware)
- Nested Folders support
- Folder Flags:
isLocked
,isShared
, etc.
- Works with both HTTP and Socket.io
- Real-time APIs using FastKit + Socket.io events supported
- β Ensure all packages extend the root tsconfig.base.json:
{
"extends": "../../tsconfig.base.json"
}
npm version patch # Bump version first using:
pnpm publish --tag beta # publish with a tag:
rm -rf node_modules pnpm-lock.yaml package-lock.json
pnpm install
- Abhishek Kumar - Initial work - @abhishek-nexgen-dev
- Built with Express.js
- Powered by TypeScript
- Inspired by modern API development practices
- π§ Email: [email protected]
- π Issues: GitHub Issues
- π¬ Discussions: GitHub Discussions
Want to add more features or modules like:
- Blog/Post
- Cart
- Analytics
- AI Tools
- Chat
Create a PR or open an issue!
MIT Β© Abhishek Gupta