-
Notifications
You must be signed in to change notification settings - Fork 56
V2 #17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
V2 #17
Conversation
…, and development workflows
…nfiguration files
… token generation
…d user session management
…improved readability
… configuration and add openapi.yml to .gitignore
…customization steps
… usage instructions
…n-access middleware and seed script
…port for fileFields
… JavaScript and HTML files
…routes and controller
…mport paths across the codebase
…te main application initialization
…outer and plugins structure
… for better module organization
…nhanced server startup
…r for plugin registration
…ections for improved accuracy (win-fix)
…ces for improved structure
…and reposition logout button
…rating plugins, middleware, modules, and seeders
… introduce introspection utility for model metadata
Summary of ChangesHello @muneebhashone, 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 introduces a significant architectural shift towards a more modular and documented plugin-based system for the TypeScript Backend Toolkit. It focuses on enhancing developer experience by providing a new CLI for scaffolding features, comprehensive documentation across various components, and robust session management. Key updates include modernizing environment configurations, replacing several core dependencies, and integrating new administrative and development tools such as an admin dashboard, BullBoard for queue monitoring, and a realtime testing UI. Highlights
Using Gemini Code AssistThe 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 by creating a comment using either
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 Limitations & Feedback Gemini Code Assist 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. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. 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
|
There was a problem hiding this 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 architectural overhaul (V2), refactoring the application into a more modular, plugin-based system. Key improvements include a new CLI for scaffolding modules, enhanced session management, a provider-based abstraction for services like storage and email, and a robust, type-safe response validation system. While the changes are extensive and well-executed, I've identified a few areas for improvement, primarily concerning security with default credentials and some minor inconsistencies in the new documentation and example code.
| ADMIN_AUTH_ENABLED: booleanString.default('true'), | ||
| ADMIN_USERNAME: z.string().min(1).default('admin'), | ||
| ADMIN_PANEL_PASSWORD: z.string().min(1).default("admin"), | ||
| ADMIN_SESSION_SECRET: z.string().min(32).default("z2fvHbkFRXlK3n7G10nmMm2wwjPTQhZ7jp2uNwoRhJc="), | ||
| ADMIN_SESSION_TTL: z.string().transform(Number).default('86400'), | ||
| ADMIN_COOKIE_NAME: z.string().default('admin_session'), | ||
|
|
||
| // Queue (BullBoard) authentication (separate from admin) | ||
| QUEUE_AUTH_ENABLED: booleanString.default('true'), | ||
| QUEUE_USERNAME: z.string().min(1).default('admin'), | ||
| QUEUE_PANEL_PASSWORD: z.string().min(1).default('admin'), | ||
| QUEUE_SESSION_SECRET: z | ||
| .string() | ||
| .min(32) | ||
| .default('H0vd1IYc8b1U1cX7QKk1q9cN8zZp3aB4tYw2rS9mV6xP0eL3jD'), | ||
| QUEUE_SESSION_TTL: z.string().transform(Number).default('86400'), | ||
| QUEUE_COOKIE_NAME: z.string().default('queue_session'), | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hardcoding default credentials and secrets for the admin panel and queue dashboard is a significant security risk. These values should be unique for each deployment and must not be checked into version control. It's strongly recommended to remove the .default() values for these sensitive fields (ADMIN_PANEL_PASSWORD, ADMIN_SESSION_SECRET, QUEUE_PANEL_PASSWORD, QUEUE_SESSION_SECRET). The application should fail to start if these secrets are missing in a production environment.
| script: './dist/main.js', | ||
| instances: 'max', | ||
| exec_mode: 'cluster', | ||
| env_file: '.env', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using .env as the env_file for a production setup is risky, as it might contain development-specific variables or less secure defaults. It's safer to use a dedicated production environment file (e.g., .env.production) to prevent accidental leakage of development settings into a production environment.
|
|
||
| - [ ] Module files generated successfully | ||
| - [ ] Router registered in `src/routes/routes.ts` | ||
| - [ ] Module registered in admin dashboard (`src/plugins/admin/registry.ts`) (if needed) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.vscode/settings.json
Outdated
| "[html]": { | ||
| "editor.defaultFormatter": "j69.ejs-beautify" | ||
| } | ||
| "typescript.tsdk": "node_modules\\typescript\\lib" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using a backslash \ as a path separator is specific to Windows and will cause issues for developers on macOS or Linux. It's best practice to use a forward slash / in VS Code settings, as it is cross-platform compatible.
| "typescript.tsdk": "node_modules\\typescript\\lib" | |
| "typescript.tsdk": "node_modules/typescript/lib" |
| export const handleCreateBlog = async ( | ||
| req: Request<unknown, unknown, CreateBlogSchemaType>, | ||
| res: ResponseExtended<CreateBlogResponseSchema>, | ||
| ) => { | ||
| const blog = await createBlog(req.body); | ||
| return res.json({ | ||
| success: true, | ||
| message: 'Blog created successfully', | ||
| data: blog, | ||
| }) as unknown as void; | ||
| }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This handler uses res.json() directly, which bypasses the new response validation system introduced in this PR. To maintain consistency with the new architecture and leverage typed responses, it should be updated to use the res.created() helper.
| export const handleCreateBlog = async ( | |
| req: Request<unknown, unknown, CreateBlogSchemaType>, | |
| res: ResponseExtended<CreateBlogResponseSchema>, | |
| ) => { | |
| const blog = await createBlog(req.body); | |
| return res.json({ | |
| success: true, | |
| message: 'Blog created successfully', | |
| data: blog, | |
| }) as unknown as void; | |
| }; | |
| export const handleCreateBlog = async ( | |
| req: Request<unknown, unknown, CreateBlogSchemaType>, | |
| res: ResponseExtended<CreateBlogResponseSchema>, | |
| ) => { | |
| const blog = await createBlog(req.body); | |
| return res.created?.({ | |
| success: true, | |
| message: 'Blog created successfully', | |
| data: blog, | |
| }); | |
| }; |
| const { results, paginatorInfo } = await getBlogs(req.query); | ||
| res.ok?.({ | ||
| success: true, | ||
| data: { | ||
| items: results, | ||
| paginator: paginatorInfo, | ||
| }, | ||
| }) | ||
|
|
||
| return; | ||
|
|
||
| }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The return; statement on line 49 is redundant. The new response helpers like res.ok() handle ending the response, so the explicit return is not necessary and can be removed for cleaner code.
export const handleGetBlogs = async (
req: Request<unknown, unknown, unknown, GetBlogsSchemaType>,
res: ResponseExtended<GetBlogsResponseSchema>,
) => {
const { results, paginatorInfo } = await getBlogs(req.query);
res.ok?.({
success: true,
data: {
items: results,
paginator: paginatorInfo,
},
});
};…eScript SDK path in VSCode settings
…ckend-toolkit into v2-bullboard
This stack of pull requests is managed by Graphite. Learn more about stacking. |

No description provided.