refactor: add modular structure & cli enhancements - #2
Merged
Conversation
…eware integration
There was a problem hiding this comment.
Pull Request Overview
This PR adds authentication flows and R2-based file management to the API, modularizes routes, and centralizes environment configuration.
- Introduce typed environment validation using
@t3-oss/env-coreand Zod - Refactor email service to use Resend via a central config
- Add R2 client helpers and modular Hono routers for auth and file operations
Reviewed Changes
Copilot reviewed 19 out of 22 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/types/email.ts | Define SendConfirmationMailParams interface |
| src/types/app.ts | Add AppBindings and AppEnv types |
| src/services/resend/send-mail.ts | Update imports and remove inline interface |
| src/services/resend/resend-service.ts | Use central config for API key and from-address |
| src/services/R2/R2-service.ts | Implement R2 client, presigned URL, list/delete APIs |
| src/routes/files.route.ts | Modularize file routes with JWT middleware |
| src/routes/auth.route.ts | Modularize auth routes |
| src/middleware/index.ts | Create JWT middleware via factory |
| src/lib/factory.ts | Initialize Hono factory for typed environment |
| src/lib/env.ts | Validate and expose server-side env variables |
| src/lib/config.ts | Map validated env into runtime config |
| src/index.ts | Wire up auth and file routers to the app |
| src/controllers/files.controller.ts | Handlers for presigned URL, listing, deleting files |
| src/controllers/auth.controller.ts | Handlers for email confirmation and verification |
| src/config.ts | Remove hardcoded config |
| package.json | Add env-core, Zod; remove unused email-render deps |
| .dev.vars.example | Document new env vars for JWT, Resend, and R2 |
| cli/src/index.ts | Add login command and require auth for list |
| cli/src/config.ts | Update CLI endpoints to new /auth and /files paths |
Owner
|
nice work |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Improvements