Skip to content

Dev#21

Merged
abhishek-nexgen-dev merged 3 commits intomasterfrom
dev
Jun 28, 2025
Merged

Dev#21
abhishek-nexgen-dev merged 3 commits intomasterfrom
dev

Conversation

@abhishek-nexgen-dev
Copy link
Copy Markdown
Member

No description provided.

- Removed the config.validation.ts file, consolidating configuration schemas and validation logic.
- Enhanced env.manager.ts to build a demo .env file with comprehensive comments and example values.
- Deleted index.ts as part of the restructuring of the configuration module.
- Introduced FastKit.constant.ts and env.constant.ts for better organization of environment constants and types.
- Updated env.constant.ts to utilize Zod for environment variable validation and parsing.
- Created a new test.ts file to demonstrate the usage of FastKit with Express.
- Modified tsconfig.json to include path aliases for easier imports.
@abhishek-nexgen-dev abhishek-nexgen-dev merged commit d4fcb03 into master Jun 28, 2025
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary of Changes

Hello @abhishek-nexgen-dev, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request represents a significant re-architecture and foundational setup for the FastKit library. The primary goal is to transform FastKit into a more intuitive and developer-friendly API toolkit built on Express and TypeScript, moving away from its previous focus solely on configuration. This involves a complete revamp of the core FastKit class, a new zod-based environment variable management system, and extensive updates to all user-facing documentation to guide developers through the new structure and usage patterns. The changes aim to provide a cleaner, more modular, and scalable base for building APIs.

Highlights

  • Core Architecture Shift: The FastKit class has been re-architected from primarily a configuration management system to a lightweight wrapper around Express, providing simplified methods for defining routes (get, post, put, delete, use).
  • Enhanced Environment Management: A new, more robust environment variable loading and validation system has been implemented using zod, with a dedicated .env.fastkit file for project-specific environment configurations.
  • Comprehensive Documentation Overhaul: The README.md, PACKAGE_MANAGERS.md, and CONFIGURATION.md files have been extensively updated to reflect the new architecture, provide clearer getting started guides, usage examples, and publishing workflows.
  • Improved Build and Module Resolution: The build process now incorporates tsc-alias and tsconfig-paths to support module path aliases, enhancing developer experience and code organization.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a major refactoring, significantly improving documentation and implementing robust environment variable validation with zod. While these are excellent changes, the refactoring has also introduced some naming inconsistencies, confusing code patterns, and potential design issues that could affect usability and maintainability. My feedback focuses on addressing these points to improve code clarity, security, and overall developer experience.

Comment thread .env.fastkit
# ----------------------------
# JWT Authentication
# ----------------------------
JWT_SECRET=your-super-secret-jwt-key-change-this-in-production
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

The default JWT_SECRET is a weak, predictable placeholder. Using such a secret, even in development, is a security risk. Consider either not providing a default and having the application fail on startup if it's missing, or use a more secure, randomly generated string as the default placeholder.

Comment thread src/FastKit.ts
@@ -1 +1,2 @@
export * from './config/FastKit-Config';
export { default as fastKitConfig } from './config/FastKit-Config/FastKit.config';
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The class defined in src/config/FastKit-Config/FastKit.config.ts is named FastKit, but it is exported here with the alias fastKitConfig. This is highly confusing. It's a strong convention in TypeScript/JavaScript for class names and their primary exports to match. This inconsistency makes the code difficult to read and maintain.

It is recommended to export it with its original name for clarity.

Suggested change
export { default as fastKitConfig } from './config/FastKit-Config/FastKit.config';
export { default as FastKit } from './config/FastKit-Config/FastKit.config';

// Step 2: read .env
fs.readFileSync(baseEnv, 'utf8');

console.log(`✅ Generated .env.production and .env.test`);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The log message ✅ Generated .env.production and .env.test is misleading. The CreateFastKit_EnvFiles function does not create these files; it only ensures .env.fastkit exists. This can cause confusion during debugging. The log message should accurately reflect the function's behavior.

Suggested change
console.log(`✅ Generated .env.production and .env.test`);
console.log(`✅ FastKit environment file checked: .env.fastkit`);

Comment on lines +106 to +109
if (!parsedEnv.success) {
console.error('❌ Invalid environment variables:', parsedEnv.error.format());
process.exit(1);
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Using process.exit(1) upon validation failure is too aggressive for a library. It forcefully terminates the consumer's application, preventing any custom error handling, logging, or graceful shutdown. A library should instead throw a descriptive error, allowing the consuming application to catch it and decide on the appropriate action.

Suggested change
if (!parsedEnv.success) {
console.error('❌ Invalid environment variables:', parsedEnv.error.format());
process.exit(1);
}
if (!parsedEnv.success) {
const errorMessage = `❌ Invalid environment variables: ${JSON.stringify(parsedEnv.error.format(), null, 2)}`;
console.error(errorMessage);
throw new Error(errorMessage);
}

Comment thread src/test.ts
@@ -0,0 +1,17 @@
import express from 'express';
const app = express();
import { fastKitConfig, setup_FastKit_EnvFiles } from './FastKit';
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The import name fastKitConfig is confusing as it's being used as a class constructor. To improve clarity and align with the recommended change in src/FastKit.ts, this should be renamed to FastKit to match the actual class name.

Suggested change
import { fastKitConfig, setup_FastKit_EnvFiles } from './FastKit';
import { FastKit, setup_FastKit_EnvFiles } from './FastKit';

Comment thread PACKAGE_MANAGERS.md

## 🤝 Contribution and Support

We welcome contributions! Feel free to submit pull requests or open issues on the [GitHub repository]().
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The link to the GitHub repository is broken because it's missing the URL. This should be updated to point to the correct repository to help contributors find it easily.

Suggested change
We welcome contributions! Feel free to submit pull requests or open issues on the [GitHub repository]().
We welcome contributions! Feel free to submit pull requests or open issues on the [GitHub repository](https://github.com/NexGenStudioDev/FastKit).

Comment thread README.md
Comment on lines +68 to +69
import { FastKit } from './fastkit';
import { loadFastKitConfig } from './config/fastkit.config';
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The code examples in the "Getting Started" section use relative internal paths for imports (e.g., ./fastkit). This will be confusing and incorrect for developers who install and use this package via npm/pnpm. The examples should demonstrate how to import from the published package name, @nexgenstudiodev/fastkit.

Suggested change
import { FastKit } from './fastkit';
import { loadFastKitConfig } from './config/fastkit.config';
import { FastKit } from '@nexgenstudiodev/fastkit';
import { loadFastKitConfig } from '@nexgenstudiodev/fastkit/config';

Comment thread README.md
# Run tests in watch mode
pnpm test:watch
````ts
fastKit.get('/user', verifyToken, userController.getUserById);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The code example uses userController, but it is not imported or defined anywhere in the snippet. This will cause confusion for users trying to follow the documentation. Ensure all variables used in examples are properly introduced.

import * as fs from 'fs';
import express, { Express, RequestHandler } from 'express';
import * as path from 'path';
config({ path: path.join(process.cwd(), '.env') });
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This line loads environment variables from a .env file. However, the FastKit class in this file does not seem to directly use these variables. The environment variable loading and validation logic has been moved to src/constant/env.constant.ts. This line appears to be a leftover from a previous implementation and should be removed to avoid confusion.

* Main FastKit configuration interface
*/
export interface FastKitConfigData {
export interface envConfig_Type {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The interface name envConfig_Type does not follow standard TypeScript naming conventions. Type and interface names should be in PascalCase. The _Type suffix is also redundant. A more idiomatic and descriptive name would be FastKitConfig.

Suggested change
export interface envConfig_Type {
export interface FastKitConfig {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant