refactor: full TypeScript migration, update dependencies, and code cleanup#2
Open
Marbot-claw wants to merge 1 commit into
Open
refactor: full TypeScript migration, update dependencies, and code cleanup#2Marbot-claw wants to merge 1 commit into
Marbot-claw wants to merge 1 commit into
Conversation
…rchitecture Major changes: - Convert entire codebase to TypeScript (strict mode) - Update all dependencies to latest stable versions - Fix authentication dead code (duplicate access_token check) - Fix authorize middleware (remove redundant token verification, use !==) - Fix user controller (createToken -> signToken typo) - Fix show controller (splice mutation, redirect in REST API) - Replace sync bcrypt with async version - Add JWT expiry (24h access token) - Refactor cloudinary upload from callback to Promise - Move config from JSON to environment variables - Remove redundant body-parser (use express built-in) - Fix CORS duplicate origin config - Add proper TypeScript types throughout - Restructure into src/ directory with clean architecture
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.
Summary
Full TypeScript migration + major refactor of the Express + Sequelize server. This PR addresses multiple bugs, improves code quality, updates all dependencies, and converts the entire codebase to TypeScript with strict mode enabled.
Changes
🔷 TypeScript Migration
strict: truetsconfig.jsonwith modern compiler optionssrc/directory🐛 Bug Fixes
!access_tokencheck (dead code)authUser), fixed!=→!==createToken()→signToken()typo that would cause runtime errorsplice()mutating original array, replacedres.redirect("/")with proper 400 JSON responseoriginproperty in configbody-parser+express.json()duplication🔒 Security Improvements
expiresIn: "24h"to access tokensconfig.jsonto environment variables🏗 Architecture & Code Quality
📦 Dependencies Updated
🆕 New Dev Dependencies
typescript,@types/*packagests-node,tsxfor development@types/bcryptjs,@types/jsonwebtoken,@types/multer, etc.How to Test
Setup
npm install cp .env.template .env # Fill in your .env valuesDevelopment
npm run dev # Starts with tsx (TypeScript execution)Build
Database
npm run db:dev # Drop, create, and migrateKey Endpoints to Test
POST /users/register— User registration with email verificationPOST /users/login— Login with JWT responsePOST /users/google-login— Google OAuth loginGET /— Fetch shows (paginated)GET /search?q=...— Search showsGET /:showId— Get show by IDGET /rents/myrent— Get user's rented shows (requires auth)POST /rents/:ShowId— Rent a show (requires auth + multipart upload)DELETE /rents/:id— Unrent (requires auth + ownership)Breaking Changes
app.jstodist/app.js(after build)config.jsonfor productionCORS_ORIGINenv var