Documentation

Updating the Codebase

How to keep your Dirstarter project up to date with the latest changes

Dirstarter is actively maintained and regularly updated with new features, bug fixes, and security patches. This guide explains how to update your project to the latest version.

While updating your codebase to the latest version is possible, it's important to note that the more customizations you make to your application, the more complex the update process becomes. This is because updates involve rebasing your custom code on top of the latest Dirstarter code using Git, which may require resolving merge conflicts and careful handling to preserve your customizations.

Important

Before updating your codebase, ensure your Git repository is clean with no uncommitted changes.

Update Process

If you started your project using the Git repository, you can pull updates directly. There are two approaches:

Option A: Merge Approach (Safer)

Choose this option if you want a safer update process with clear merge points.

Terminal
# Add the upstream remote if you haven't already
git remote add upstream https://github.com/dirstarter/dirstarter.git
 
# Fetch the latest changes
git fetch upstream
 
# Create a new branch for the update
git checkout -b update-dirstarter
 
# Merge the changes (resolve conflicts if necessary)
git merge upstream/main

Option B: Rebase Approach (Cleaner History)

Choose this option if you prefer a linear history. This approach is more advanced and may require more Git experience to resolve conflicts.

Terminal
# Add the upstream remote if you haven't already
git remote add upstream https://github.com/dirstarter/dirstarter.git
 
# Fetch latest changes and rebase
git pull upstream main --rebase

If you have any merge conflicts, you will have to resolve them manually. If you are not sure how to do this, please refer to the Git documentation.

Method 2: Manual Update

If you prefer to update manually or didn't use Git:

  1. Download the latest version of Dirstarter
  2. Compare your customized files with the new version
  3. Apply changes selectively, focusing on:
    • package.json for dependency updates
    • Configuration files like next.config.js
    • Core functionality in lib and server directories

Dependency Updates

To update only the dependencies:

Terminal
# Update all dependencies to their latest versions
npm update
 
# Update a specific dependency
npm update next
 
# Update to specific versions
npm install [email protected]

For major dependency updates, check compatibility first:

Terminal
# Check for major updates
npx npm-check-updates
 
# Apply major updates (use with caution)
npx npm-check-updates -u
npm install

Database Schema Updates

When updates include database schema changes:

  1. Check the migration files in the prisma/migrations directory
  2. Apply migrations with:
Terminal
npm run db:migrate

Testing After Updates

After updating, thoroughly test your application:

  1. Run the development server: npm run dev
  2. Check for console errors
  3. Test critical user flows
  4. Run linting and formatting: npm run lint and npm run format
  5. Check build: npm run build

Keeping Up with Changes

To stay informed about updates:

  1. Watch the GitHub repository
  2. Check the changelog regularly or subscribe to the RSS feed
  3. Join the community Discord server
Edit on GitHub

Last updated on

On this page