đŻ Build Final FastKit Setup â Pluggable API Framework with Direct Routing, Utility Exports, and Zero Lock-In
#20 geöffnet am 28.06.2025
Repository-Metriken
- Stars
- Â (1 Stern)
- PR-Merge-Metriken
- Â (PR-Metriken ausstehend)
Beschreibung
đ 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