1- # FastKit
1+ # 🚀 FastKit – Modular, Scalable API Toolkit with TypeScript + Express
22
3- A modular, class-based toolkit for fast API development using TypeScript and Express .
3+ FastKit is a ** developer-first ** , ** class-based** , and ** plug-and-play ** toolkit built on top of Express and TypeScript to help you build APIs faster — with clean structure, reusable logic, and zero boilerplate .
44
5- This library helps you build clean, maintainable APIs by offering ready-to-use, feature-specific classes (like Auth, User, etc.) with built-in versioning support. Define your own routes while leveraging reusable business logic, validators, services, and more — all organized for scalability and long-term maintenance.
5+ ✅ You can use ` fastKit.get() ` , ` post() ` , ` put() ` , ` delete() ` for defining routes
6+ ✅ All services, controllers, middlewares, and utilities are modular and importable
7+ ✅ No framework lock-in — write your own logic, inject nothing
68
7- ## 🚀 Features
9+ ---
10+
11+ ## 🎯 Why Use FastKit?
12+
13+ - 🧱 ** Clean Architecture** – Organize your features like ` Auth ` , ` Todo ` , ` Email ` , etc.
14+ - 🔁 ** Reusable Everything** – Use any controller, validator, service, or utility anywhere
15+ - 🧩 ** Modular Setup** – Easily extend with your own modules
16+ - 🧠 ** Zero Magic** – No decorators, no complex DI, no auto-binding
17+ - ⚡ ** TypeScript First** – Type-safe from top to bottom
18+ - 🌍 ** Plug-and-Play** – Use just the parts you need
19+
20+
21+
22+
23+ ## 🗂️ Folder Structure
24+
25+ ``` text
26+ src/
27+ ├── server.ts # Create express app and FastKit instance
28+ ├── fastkit.ts # The FastKit core class
29+ ├── config/
30+ │ └── fastkit.config.ts # Global config
31+ ├── utils/
32+ │ └── SendResponse.ts # Standard response wrapper
33+ ├── middlewares/
34+ │ └── verifyToken.ts # JWT middleware
35+ │ └── validateBody.ts # Schema validation middleware
36+ ├── services/
37+ │ └── email/v1/Email.service.ts
38+ ├── features/
39+ │ └── Auth/v1/
40+ │ ├── Auth.controller.ts
41+ │ ├── Auth.service.ts
42+ │ ├── Auth.validators.ts
43+
44+ ```
845
9- - ** Modular Architecture** : Build APIs with feature-specific modules
10- - ** Class-based Design** : Clean, object-oriented approach to API development
11- - ** Built-in Versioning** : Support for API versioning out of the box
12- - ** TypeScript First** : Full TypeScript support with type safety
13- - ** Express Integration** : Built on top of the reliable Express.js framework
14- - ** Reusable Components** : Pre-built validators, services, and controllers
15- - ** Scalable Structure** : Organized for long-term maintenance and growth
1646
1747## 📦 Installation
1848
@@ -27,164 +57,134 @@ pnpm add @nexgenstudiodev/fastkit
2757yarn add @nexgenstudiodev/fastkit
2858```
2959
30- ## 🔧 Quick Start
3160
32- ``` typescript
33- import { FastKit } from ' @nexgenstudiodev/fastkit' ;
34- import { loadFastKitConfig } from ' @nexgenstudiodev/fastkit/config' ;
61+ ## 🛠️ Getting Started
62+
63+ ### 1. Create FastKit App
64+
65+ ```` ts
66+ // server.ts
3567import express from ' express' ;
68+ import { FastKit } from ' ./fastkit' ;
69+ import { loadFastKitConfig } from ' ./config/fastkit.config' ;
3670
3771const app = express ();
38-
39- // Load configuration from .env file
4072const config = loadFastKitConfig ();
4173
42- // Initialize FastKit with configuration
4374const fastKit = new FastKit (app , config );
4475
45- // Initialize your features
46- fastKit . use ( ' /api/v1/auth ' , AuthFeature ) ;
76+ // Your routes
77+ import ' ./apiRoutes ' ;
4778
48- app .listen (config . server . port , () => {
49- console .log (` Server running on port ${ config . server . port } ` );
79+ app .listen (3000 , () => {
80+ console .log (' 🚀 Server is running on http://localhost:3000 ' );
5081});
5182
52- ```
5383
84+ ````
5485
5586
56- > 📖 ** Learn More** : Check out the [ Configuration Documentation] ( CONFIGURATION.md ) for detailed usage examples.
87+ ### 2. Define Routes Anywhere Using ` fastKit.get() ` / ` post() ` / ` use() `
88+ ```` ts
5789
58- ## 🏗️ Project Structure
90+ // apiRoutes.ts
91+ import { fastKit } from ' ./fastkit' ;
92+ import { authController } from ' ./features/Auth/v1/Auth.controller' ;
93+ import { verifyToken } from ' ./middlewares/verifyToken' ;
94+ import { SendResponse } from ' ./utils/SendResponse' ;
5995
60- ```
61- src/
62- ├── features/
63- │ ├── Auth/
64- │ │ └── v1/
65- │ │ ├── Auth.controller.ts
66- │ │ ├── Auth.service.ts
67- │ │ ├── Auth.validators.ts
68- │ │ ├── Auth.constant.ts
69- │ │ └── Auth.ts
70- │ └── Ecommerce/
71- │ └── v1/
72- └── config/
73- ```
96+ fastKit .get (' /ping' , (req , res ) => {
97+ SendResponse .success (res , ' Pong!' );
98+ });
7499
75- ## 📚 Core Concepts
100+ fastKit .post (' /auth/signup' , authController .signup );
101+ fastKit .get (' /auth/me' , verifyToken , authController .getProfile );
76102
77- ### Features
78- Features are self-contained modules that encapsulate related functionality. Each feature includes:
79103
80- - ** Controller** : Handle HTTP requests and responses
81- - ** Service** : Business logic and data processing
82- - ** Validators** : Input validation and sanitization
83- - ** Constants** : Feature-specific constants and configurations
84104
85- ### Versioning
86- FastKit supports built-in API versioning, allowing you to maintain multiple versions of your API simultaneously:
105+ ````
87106
88- ``` typescript
89- // v1 implementation
90- features / Auth / v1 / Auth .ts
91107
92- // v2 implementation (when needed)
93- features / Auth / v2 / Auth .ts
94- ```
108+ ### 🧱 Usage Examples
95109
96- ## 🛠️ Usage Examples
97-
98- ### Creating a Custom Feature
99-
100- ``` typescript
101- // features/User/v1/User.controller.ts
102- export class UserController {
103- async getUser(req : Request , res : Response ) {
104- // Controller logic
105- }
106-
107- async createUser(req : Request , res : Response ) {
108- // Controller logic
109- }
110- }
111-
112- // features/User/v1/User.service.ts
113- export class UserService {
114- async findUser(id : string ) {
115- // Service logic
116- }
117-
118- async createUser(userData : any ) {
119- // Service logic
120- }
121- }
122-
123- // features/User/v1/User.ts
124- import { UserController } from ' ./User.controller' ;
125- import { UserService } from ' ./User.service' ;
126-
127- export class UserFeature {
128- private controller: UserController ;
129- private service: UserService ;
130-
131- constructor () {
132- this .service = new UserService ();
133- this .controller = new UserController ();
134- }
135-
136- getRoutes() {
137- // Define your routes
138- }
139- }
140- ```
110+ #### ✅ Use Controller Directly
141111
142- ### Authentication Feature
112+ ```` ts
113+ fastKit .post (' /auth/login' , authController .login );
114+ ````
143115
144- ``` typescript
145- import { AuthFeature } from ' @abhishek-nexgen-dev/fastkit' ;
116+ #### ✅ Use Service Independently
146117
147- // Use the built-in Auth feature
148- app .use (' /api/v1/auth' , AuthFeature .getRoutes ());
149- ```
150118
151- ## 🔒 Security Features
119+ ```` ts
120+ import { EmailService } from ' ./services/email/v1/Email.service' ;
152121
153- - Input validation and sanitization
154- - Built-in authentication patterns
155- - Security headers and middleware
156- - Rate limiting support
122+ await EmailService .sendOtp (email );
157123
158- ## 🧪 Testing
124+ ````
159125
160- ``` bash
161- # Run tests
162- pnpm test
126+ #### ✅ Use Middleware Anywhere
163127
164- # Run tests in watch mode
165- pnpm test:watch
128+ ```` ts
129+ fastKit .get (' /user' , verifyToken , userController .getUserById );
130+ ````
166131
167- # Run tests with coverage
168- pnpm test:coverage
169- ```
132+ #### ✅ Use Utils Like SendResponse
133+
134+ ```` ts
135+ SendResponse .success (res , ' Your API works!' );
136+ SendResponse .error (res , ' Something went wrong' , 400 );
137+ ````
138+
139+ ## 🧩 What You Can Build
140+
141+ - Auth systems (JWT, OTP, social logins)
142+ - Todo, Notes, Blog, Folder/File systems
143+ - File Uploads & Content Management
144+ - Payment integration (Stripe, Razorpay)
145+ - Reminder & Notification system (NodeMailer, Cron)
146+ - AI assistants via OpenAI API
147+ - WebSocket / Realtime apps with Socket.io
148+ - Admin panels with RBAC (roles/permissions)
149+
150+ #### 🔌 Plugin-Friendly
170151
171- ## 📖 Documentation
152+ You can export every module individually and use them in any project:
172153
173- For detailed documentation, examples, and API reference, visit our [ documentation site] ( https://github.com/NexGenStudioDev/FastKit#readme ) .
154+ ```` ts
155+ import { AuthController } from ' fastkit-auth' ;
156+ import { TodoController } from ' fastkit-todo' ;
174157
175- ## 🤝 Contributing
158+ ````
176159
177- We welcome contributions! Please see our [ Contributing Guide ] ( CONTRIBUTING.md ) for details.
160+ #### 🔐 Middleware Examples
178161
179- 1 . Fork the repository
180- 2 . Create your feature branch (` git checkout -b feature/amazing-feature ` )
181- 3 . Commit your changes (` git commit -m 'Add some amazing feature' ` )
182- 4 . Push to the branch (` git push origin feature/amazing-feature ` )
183- 5 . Open a Pull Request
162+ - ` verifyToken ` – Protect routes using JWT
163+ - ` validateBody(schema) ` – Validate input with Zod or Joi
164+ - ` allowRoles('admin', 'user') ` – Role-based access control
184165
185- ## 📄 License
166+ #### 📬 Email Service Examples
167+
168+ ```` ts
169+ EmailService .sendOtp (email , template );
170+ EmailService .sendCustom (subject , message , to );
171+ EmailService .sendReminder (userId , date , content );
172+
173+ ````
174+
175+ ## 📁 Folder Module Examples
176+
177+ - Create Folder
178+ - Create File Inside Folder (supports custom extensions)
179+ - Delete Folder (with restriction middleware)
180+ - Nested Folders support
181+ - Folder Flags: ` isLocked ` , ` isShared ` , etc.
182+
183+ ## 📡 WebSocket Support (Optional)
184+
185+ - Works with both HTTP and Socket.io
186+ - Real-time APIs using FastKit + Socket.io events supported
186187
187- This project is licensed under the MIT License - see the [ LICENSE] ( LICENSE.md ) file for details.
188188
189189## 👥 Authors
190190
@@ -202,15 +202,19 @@ This project is licensed under the MIT License - see the [LICENSE](LICENSE.md) f
202202- 🐛 Issues: [ GitHub Issues] ( https://github.com/NexGenStudioDev/FastKit/issues )
203203- 💬 Discussions: [ GitHub Discussions] ( https://github.com/NexGenStudioDev/FastKit/discussions )
204204
205- ## 🗺️ Roadmap
206205
207- - [ ] Plugin system for third-party integrations
208- - [ ] GraphQL support
209- - [ ] Database ORM integrations
210- - [ ] Advanced caching mechanisms
211- - [ ] Real-time features with WebSockets
212- - [ ] CLI tool for project scaffolding
206+ ## ❤️ Contributions Welcome
213207
214- ---
208+ Want to add more features or modules like:
209+
210+ - Blog/Post
211+ - Cart
212+ - Analytics
213+ - AI Tools
214+ - Chat
215+
216+ Create a PR or open an issue!
217+
218+ ## 🔖 License
215219
216- Made with ❤️ by [ NexGen Studio Dev ] ( https://github.com/NexGenStudioDev )
220+ MIT © Abhishek Gupta
0 commit comments