Skip to content

NexGenStudioDev/FastKit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

39 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

πŸš€ 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)

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');
});

JavaScript (ES Modules)

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');
});

TypeScript

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');
});

πŸ“š 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 controllers
app.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 files
setup_FastKit_EnvFiles();

// Type-safe configuration
const config = new FastKit();

πŸ“– 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';

const dbConfig: 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 package
import { auth, config, db, AuthController, FastKit } from '@nexgenstudiodev/fastkit';

Sub-module Imports (Tree-shaking)

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

Namespace Imports

// Organized by module
import { auth, config, db } from '@nexgenstudiodev/fastkit';

const controller = auth.AuthController;
const dbConfig = db.DatabaseConfig;

πŸ› οΈ Getting Started

1. Create FastKit App

// 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');
});

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

// 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);

🧱 Usage Examples

βœ… Use Controller Directly

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

βœ… Use Service Independently

import { EmailService } from './services/email/v1/Email.service';

await EmailService.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

License

Code of conduct

Contributing

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

Packages

No packages published