Skip to content

🎯 Build Final FastKit Setup β€” Pluggable API Framework with Direct Routing, Utility Exports, and Zero Lock-InΒ #20

@abhishek-nexgen-dev

Description

@abhishek-nexgen-dev

πŸ“– Description

This issue will establish the confirmed structure and design rules for FastKit β€” a modular, plug-and-play backend API system using TypeScript and Express.

Rather than registering routes or injecting everything inside a framework, developers will:

  • βœ… Use fastKit.get(), post(), put(), delete(), use() directly
  • βœ… Write API routes inside any file using FastKit's fluent syntax
  • βœ… Import and use middleware, utils, services, and controllers anywhere
  • βœ… Keep full control β€” no magic, no locked structure
  • βœ… Use only what they need: one feature, or everything

This system is inspired by developer-first design, real-world needs, and clean code architecture.


πŸš€ Why It Matters

Benefit Explanation

  • βœ… Custom Route Control You create your own files, use fastKit.get() as you want
  • βœ… Independent Exports Use any controller, service, or utility without touching FastKit
  • βœ… Zero Boilerplate No manual route registration or feature binding
  • βœ… npm-Ready Build your own module, publish it, and reuse it
  • βœ… Universal Usage Works for Express, Fastify, REST APIs, or monorepos
  • βœ… Simple Learning Curve No decorators, no DI β€” just clean TypeScript and logic

πŸ”§ Tasks

[x] Setup fastKit.ts (class with get/post/put/delete/use)

[x] Create server.ts (Express app with FastKit instance)

[x] Create config/fastkit.config.ts (global config: version, prefix, middlewares)

[x] Create features/ folder (Auth, Todo, Email, etc.)

[x] Create utils/ folder (SendResponse.ts, etc.)

[x] Create middlewares/ folder (verifyToken.ts, validateBody.ts, etc.)

[x] Export each feature independently: no need to bind to FastKit

[x] Allow user to use only what they want

[x] Support for file-based routing if needed (optional)

[x] Export everything via index.ts for plugin-friendly structure

πŸ“ Final Folder Structure

src/
β”œβ”€β”€ server.ts
β”œβ”€β”€ fastkit.ts
β”œβ”€β”€ config/
β”‚   └── fastkit.config.ts
β”œβ”€β”€ utils/
β”‚   β”œβ”€β”€ SendResponse.ts
β”‚   └── ErrorHandler.ts
β”œβ”€β”€ middlewares/
β”‚   β”œβ”€β”€ verifyToken.ts
β”‚   β”œβ”€β”€ validateBody.ts
β”œβ”€β”€ services/
β”‚   └── email/
β”‚       └── v1/
β”‚           β”œβ”€β”€ Email.service.ts
β”‚           └── Email.utils.ts
β”œβ”€β”€ features/
β”‚   β”œβ”€β”€ Auth/
β”‚   β”‚   └── v1/
β”‚   β”‚       β”œβ”€β”€ Auth.controller.ts
β”‚   β”‚       β”œβ”€β”€ Auth.service.ts
β”‚   β”‚       β”œβ”€β”€ Auth.validators.ts
β”‚   β”‚       β”œβ”€β”€ Auth.constants.ts
β”‚   β”‚       └── Auth.ts
β”‚   β”œβ”€β”€ Todo/
β”‚   β”‚   └── v1/
β”‚   β”‚       └── ...
β”‚   └── Folder/
β”‚       └── v1/
β”‚           └── ...
└── index.ts

πŸ’‘ Example: How Developers Will Use It

// βœ… In any file (e.g., src/api/auth.routes.ts)

import { fastKit } from '../fastkit';
import { authController } from '../features/Auth/v1/Auth.controller';
import { validateSignup } from '../features/Auth/v1/Auth.validators';

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

// βœ… In server.ts
import express from 'express';
import { FastKit } from './fastkit';
import { loadFastKitConfig } from './config/fastkit.config';

const app = express();
const fastKit = new FastKit(app, loadFastKitConfig());

// Run express
app.listen(3000, () => {
  console.log('πŸš€ FastKit server running on http://localhost:3000');
});

πŸ”Œ What Developers Can Do

  • Use fastKit.get/post() directly in any file

  • Use SendResponse.success() or .error() anywhere

  • Use EmailService.sendOtp(), Logger.log() globally

  • Import middleware like verifyToken or validateBody where needed

  • Add custom routes in any .ts file

  • Don’t touch any Express internals

  • Extend FastKit with your own methods if required

✨ What This Enables

  • βœ… Real API Dev without Express noise
  • βœ… Modular features (Auth, Todo, Notes, Folder, File, Calendar...)
  • βœ… Reusable in any project
  • βœ… Custom middleware stacking
  • βœ… Full TS Support
  • βœ… Cleanest DX

πŸ” Final Outcome

Once this issue is complete:

  • You will have a production-ready FastKit base

  • Developers can create their own APIs using fastKit.*() anywhere

  • All services, middlewares, validators, and utilities are modular and importable

  • You can even turn this into a CLI/boilerplate/npm module

🧠 Optional Next Steps

[ ] Add support for Swagger docs

[ ] Add auto-error wrapping for async handlers

[ ] Add fastKit.group('/path', fn) for grouped routes (optional)

[ ] Create CLI to scaffold features

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions