-
-
Notifications
You must be signed in to change notification settings - Fork 0
Description
π 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