Update the Codebase
Keep your NEXTDEVKIT project up-to-date with the latest features and improvements
⚠️ Important Considerations
While updating your codebase to the latest version is possible, it's important to note that:
- 🎨 Customizations Impact Complexity: The more customizations you make, the more complex the update process becomes
- 🔄 Git-Based Updates: Updates involve rebasing your custom code on top of the latest NEXTDEVKIT code
- ⚙️ Merge Conflicts: You may need to resolve merge conflicts carefully
- 🛡️ Testing Required: Always test thoroughly after updates
🚀 Before You Start
Prerequisites Checklist
- 🧹 Clean Git Repository: No uncommitted changes
- 📋 Backup Current State: Create a backup branch
- 📝 Document Customizations: List all custom changes
- 🧪 Test Environment: Ensure tests pass
- 📊 Dependencies: Check for breaking changes
Backup Your Work
# Create a backup branch
git checkout -b backup-before-update
# Push backup to remote
git push origin backup-before-update
# Return to main branch
git checkout main
🔄 Update Methods
Method 1: Git Merge (Recommended for Safety)
This approach is safer and provides clear merge points in your git history.
# 1. Add the upstream remote if you haven't already
git remote add upstream https://github.com/nextdevkit/nextdevkit.git
# 2. Fetch the latest changes
git fetch upstream
# 3. Create a new branch for the update
git checkout -b update-nextdevkit
# 4. Merge the changes (resolve conflicts if necessary)
git merge upstream/main
# 5. Resolve any merge conflicts
# Edit files to resolve conflicts, then:
git add .
git commit -m "Resolve merge conflicts during update"
# 6. Test the updated code
npm install
npm run build
npm run lint
npm run test
# 7. Merge back to main if everything works
git checkout main
git merge update-nextdevkit
Method 2: Git Rebase (For Clean History)
This approach creates a cleaner linear history but requires more Git experience.
# 1. Add the upstream remote
git remote add upstream https://github.com/nextdevkit/nextdevkit.git
# 2. Fetch and rebase
git fetch upstream
git rebase upstream/main
# 3. Resolve conflicts if they occur
# For each conflict:
# - Edit the conflicting files
# - Stage the resolved files: git add <file>
# - Continue rebase: git rebase --continue
# 4. Force push (if needed)
git push --force-with-lease origin main
Method 3: Manual Update
If you prefer to update manually or didn't use Git initially:
- 📥 Download the latest NEXTDEVKIT version
- 📋 Compare your customized files with the new version
- 🔄 Apply changes selectively, focusing on:
package.json
for dependency updates- Configuration files like
next.config.ts
- Core functionality in
src/lib
andsrc/components
- Database migrations in
drizzle/
📦 Dependency Updates
Update All Dependencies
pnpm update
Update Specific Dependencies
# Update Next.js
pnpm install next@latest
# Update Drizzle ORM
pnpm install drizzle-orm@latest drizzle-kit@latest
# Update Better Auth
pnpm install better-auth@latest
# Update UI components
pnpm install @radix-ui/react-*@latest
🗄️ Database Schema Updates
When updates include database schema changes:
Check Migration Files
# Check for new migration files
ls -la drizzle/
# Review migration changes
cat drizzle/0003_new_migration.sql
Apply Migrations
# Production environment
pnpm run db:migrate
# Open Drizzle Studio to verify
pnpm run db:studio