Skip to content

Repository files navigation

🚀 FastKit – Comprehensive Full-Stack Development Toolkit

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


📦 Installation

Quick Start

npm install @nexgenstudiodev/fastkit

Requirements

  • Node.js 16+
  • TypeScript 4.5+ (for TypeScript projects)

🎯 Why Choose FastKit?

  • 🔐 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

🗂️ Folder Structure

FastKit/
├── package.json (root)
├── pnpm-workspace.yaml
└── src/
└── packages/
├── fastkit
├── fastkit-config
├── fastkit-db-config
└── fastkit-auth

📦 Installation

# Using npm
npm install @nexgenstudiodev/fastkit
# Using pnpm
pnpm add @nexgenstudiodev/fastkit
# Using yarn
yarn add @nexgenstudiodev/fastkit

🚀 Quick Start Examples

JavaScript (CommonJS)

constexpress=require('express');const{
auth,
config,
db,
AuthController,
setup_FastKit_EnvFiles,}=require('@nexgenstudiodev/fastkit');constapp=express();// Setup environment filessetup_FastKit_EnvFiles();// Use auth controllerapp.post('/api/auth/login',auth.AuthController.login);app.post('/api/auth/register',auth.AuthController.register);// Database configurationconstdbConfig={type: 'mongodb',url: process.env.DATABASE_URL||'mongodb://localhost:27017/myapp',};app.listen(3000,()=>{console.log('FastKit app running on port 3000');});

JavaScript (ES Modules)

importexpressfrom'express';import{auth,config,db,AuthController,setup_FastKit_EnvFiles,FastKit,}from'@nexgenstudiodev/fastkit';constapp=express();// Setup environment and configurationsetup_FastKit_EnvFiles();constappConfig=newFastKit();// Authentication routesapp.post('/api/auth/login',AuthController.login);app.post('/api/auth/register',AuthController.register);app.post('/api/auth/logout',AuthController.logout);// Database setupconstdbConfig={type: 'postgresql',host: 'localhost',port: 5432,databaseName: 'myapp',};app.listen(3000,()=>{console.log('FastKit app running on port 3000');});

TypeScript

importexpress,{Request,Response}from'express';import{auth,config,db,AuthController,AuthService,setup_FastKit_EnvFiles,FastKit,DatabaseConfig,DatabaseType,Config_Type,}from'@nexgenstudiodev/fastkit';constapp=express();// Type-safe configurationsetup_FastKit_EnvFiles();constappConfig: Config_Type=newFastKit({database: {type: 'mongodb',url: process.env.DATABASE_URL,},auth: {jwtSecret: process.env.JWT_SECRET||'fallback-secret',expiresIn: '7d',},});// Type-safe database configurationconstdbConfig: DatabaseConfig={type: 'postgresql'asDatabaseType,host: 'localhost',port: 5432,username: 'admin',password: 'password',databaseName: 'myapp',ssl: true,};// Authentication with full type supportapp.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');});

📚 Module Documentation

🔐 Authentication Module

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 controllersapp.post('/login',AuthController.login);

📖 Full Auth Documentation

⚙️ Configuration Module

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 filessetup_FastKit_EnvFiles();// Type-safe configurationconstconfig=newFastKit();

📖 Full Config Documentation

🗄️ Database Configuration Module

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';constdbConfig: DatabaseConfig={type: 'mongodb',url: process.env.DATABASE_URL,options: {useNewUrlParser: true}};

📖 Full Database Config Documentation


🎯 Import Flexibility

FastKit supports multiple import patterns for maximum flexibility:

Main Package Imports

// Everything from main packageimport{auth,config,db,AuthController,FastKit}from'@nexgenstudiodev/fastkit';

Sub-module Imports (Tree-shaking)

// Import only what you needimport{AuthController}from'@nexgenstudiodev/fastkit/auth';import{FastKit}from'@nexgenstudiodev/fastkit/config';import{DatabaseConfig}from'@nexgenstudiodev/fastkit/db';

Namespace Imports

// Organized by moduleimport{auth,config,db}from'@nexgenstudiodev/fastkit';constcontroller=auth.AuthController;constdbConfig=db.DatabaseConfig;

🛠️ Getting Started

1. Create FastKit App

// server.jsimportexpressfrom'express';constapp=express();import{FastKit,setup_FastKit_EnvFiles,Config_Type}from'@nexgenstudiodev/fastkit/config';setup_FastKit_EnvFiles();constfastKit=newFastKit(app);fastKit.get('/',(req,res)=>{res.send('Hello World!');});fastKit.listen(3000,()=>{console.log('Server is running on http://localhost:3000');});

2. Define Routes Anywhere Using fastKit.get() / post() / use()

// apiRoutes.tsimport{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);

🧱 Usage Examples

✅ Use Controller Directly

fastKit.post('/auth/login',authController.login);

✅ Use Service Independently

import{EmailService}from'./services/email/v1/Email.service';awaitEmailService.sendOtp(email);

✅ Use Middleware Anywhere

fastKit.get('/user',verifyToken,userController.getUserById);

✅ Use Utils Like SendResponse

SendResponse.success(res,'Your API works!');SendResponse.error(res,'Something went wrong',400);

🧩 What You Can Build

  • 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)

🔌 Plugin-Friendly

You can export every module individually and use them in any project:

import{AuthController}from'fastkit-auth';import{TodoController}from'fastkit-todo';

🔐 Middleware Examples

  • verifyToken – Protect routes using JWT
  • validateBody(schema) – Validate input with Zod or Joi
  • allowRoles('admin', 'user') – Role-based access control

📬 Email Service Examples

EmailService.sendOtp(email,template);EmailService.sendCustom(subject,message,to);EmailService.sendReminder(userId,date,content);

📁 Folder Module Examples

  • Create Folder
  • Create File Inside Folder (supports custom extensions)
  • Delete Folder (with restriction middleware)
  • Nested Folders support
  • Folder Flags: isLocked, isShared, etc.

📡 WebSocket Support (Optional)

  • Works with both HTTP and Socket.io
  • Real-time APIs using FastKit + Socket.io events supported

🧪 Troubleshooting

1. Missing TypeScript Config

  • ✅ Ensure all packages extend the root tsconfig.base.json:
{
"extends": "../../tsconfig.base.json"
}

2. Publish Errors

npm version patch # Bump version first using:
pnpm publish --tag beta # publish with a tag:

3. Mixed Lockfiles

rm -rf node_modules pnpm-lock.yaml package-lock.json
pnpm install

👥 Authors

🙏 Acknowledgments

📞 Support

❤️ Contributions Welcome

Want to add more features or modules like:

  • Blog/Post
  • Cart
  • Analytics
  • AI Tools
  • Chat

Create a PR or open an issue!

🔖 License

MIT © Abhishek Gupta

About

No description or website provided.

Topics

Resources

Code of conduct

Contributing

Stars

1 star

Watchers

1 watching

Forks

Releases

Sponsor this project

Packages

Contributors

Languages