Refactor/enhance app security and maintainability #43
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.
I should've split these changes into separate commits, but since the code has changed significantly, I figured that wouldn't help much. 😬 Sorry about that!
But don't worry, the app flow is still the same:
Here’s a breakdown of the changes I made. It's totally fine to apply any of these changes directly to the source repo if you'd rather skip my fork. 🙏 I also haven’t looked closely at other PRs, so some overlap is possible.
Changes
Security
NEXT_PUBLIC_ELEVENLABS_API_KEY
environment variable, which is unsafe. The call has been moved to the server to keep the key secure, as recommended here:Functional
nWM88eUzTWbyiJW1K8NX
tocgSgspJ2msm6clMCkdW9
as the previous one no longer works and caused a 400 Bad Request error.src/apps/favicon.ico
.public/favicon.ico
.Your answer has to be as concise as possible.
toReply in the same language as the input. Keep it concise and friendly, like you're chatting with a friend.
Maintainbility
/api/chat
to/api/completion
.src/apiTypes
) to align request & response interfaces between the client and server.FormData
for audio uploads for best practice.textToSpeech
endpoint (src/app/api/textToSpeech/route.ts
) for best practice.src/utils/server/response.ts
).react-hot-toast
(<Toaster toastOptions={...} />
) to avoid duplication.CI
Suggestions
Server Side
Client Side
Maintainability