Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrating to Turborepo (incrementally) #234

Closed
2 tasks
aryanprince opened this issue Mar 16, 2024 · 3 comments
Closed
2 tasks

Migrating to Turborepo (incrementally) #234

aryanprince opened this issue Mar 16, 2024 · 3 comments
Assignees

Comments

@aryanprince
Copy link
Contributor

aryanprince commented Mar 16, 2024

Summary

To migrate the current repo to a monorepo setup using Turborepo. This will allow us to have multiple different applications (like marketing, Discord Bot, so on) in the same repo, while having shared common packages between each other.

Pros

  1. Improved DX for repetitive tasks such as building, linting, and formatting.
  2. Will allow us to keep the main 100x dashboard, (future) Discord Bot, marketing sites, and other apps in the future in one place. Ensuring all apps can share packages across each other (such as various configs and Tailwind for example).
  3. Saving both time and money in CI - by leveraging Turborepo's Remote Cache.
  4. Improved local dev experience since build caches can be reused by all contributors.
  5. ...and not to mention, every other benefit of having a monorepo fundamentally such as allowing shared packages to be updated locally and seeing live changes on the apps importing shared packages.

Cons

  1. Deployments will need to be updated to new directory inside the monorepo (updating deployment directory to apps/web for example)
  2. Will need to update the Docker Compose script to ensure it works with the new Turborepo setup.

The Plan

Make a very minimal migration to Turborepo. By this, I mean we use a 2 step approach to the migration in order to keep minimal diffs and manageable PRs/reviews.

  • Step 1. Move the main Nextjs application as is to a folder like apps/web first. This is done to produce as little diffs in the PR as possible, ensuring the first PR is very focused and can be reviewed better.
  • Step 2: Later, refactor common packages like ESLint, TS config, Tailwind, and so on to their respective packages in subsequent PRs later on.

My Experience

I've incrementally migrated from a single Next.js app to a monorepo setup with Turborepo with 3 different Next.js apps here.

@aryanprince
Copy link
Contributor Author

@hkirat If this is something on the roadmap, can I be assigned to this as I’ve already initiated work on it? Thanks.

@hkirat
Copy link
Contributor

hkirat commented Mar 17, 2024

this is great

@aryanprince
Copy link
Contributor Author

aryanprince commented Mar 18, 2024

Progress

For now, I have managed to successfully migrate the entire codebase to Turborepo (with pnpm workspaces). Everything works well in my fork for the time being (link here). However, there are several blockers that need to be addressed before I submit my PR.

Blockers

There are currently 2 blocking issues/PRs:

  1. There are a large number of conflicting ESLint and Prettier config rules.

PR #244 plans to fix this blocker.

  1. There are missing migration files from the last DB schema change (part of merged PR Fix/Feat: comment counters, actions based on role, pinned comment #170).

PR #242 plans to solve this minor issue.


I will make my PR after these changes have been merged to ensure minimal overlapping changes and cleaner diff during the (huge - around 195 files currently) monorepo migration PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants