universe

Universe
git clone https://git.dasho.dev/universe.git
Log | Files | Refs | Submodules | README

MONOREPO.md (7456B)


MONOREPO USAGE GUIDE

Welcome to the d-a-s-h-o/universe monorepo! This repo contains multiple projects under a single repository, allowing for shared tooling, streamlined CI/CD, and easier cross-project updates.

πŸ€” Why a Monorepo?

By consolidating all projects into a single monorepo, we ensure:

πŸ“ Commit Message Format

To ensure clarity and consistency across all commits, use the following format:

[project] <emoji> type(scope): subject

body (optional)

footer (optional)

**Example Commits:**

[chat] πŸš€ feat(auth): add JWT authentication

Implemented JWT authentication for user login, replacing session-based auth.

BREAKING CHANGE: Existing session-based logins will no longer work.
[droplets] πŸ› fix(api): resolve memory leak in data fetching

Updated request handling to properly close connections and prevent excessive memory usage.

Closes #42
[docs] πŸ“– docs(readme): update installation guide

Clarified setup instructions for new contributors.

**Commit Components Explained:**

🏷️ Epoch-Based Semantic Versioning

All projects follow an epoch-based semantic versioning system:

(EPOCH * 100 + Major).Minor.Patch

**Example Versions:**

**Tagging a Release for `chat/`**

git tag chat-v101.2.3
git push origin chat-v101.2.3

GitHub Actions will build and push:

πŸš€ Cloning the Monorepo

This repo is large, but you don’t need to pull everything. Use sparse checkout to clone only the projects you need.

# Clone without downloading all files
git clone --filter=blob:none --no-checkout git@github.com:d-a-s-h-o/universe.git
cd universe

# Initialize sparse checkout
git sparse-checkout init --cone

# Checkout only specific projects
git sparse-checkout set chat droplets docs

# Checkout the branch
git checkout main

πŸ›  Working on Multiple Projects Simultaneously

Use git worktrees to keep separate working directories for different projects without switching branches.

# Create a separate worktree for chat
mkdir ../chat-worktree
cd ../chat-worktree

git worktree add . ../universe main:chat

# Create a worktree for droplets
mkdir ../droplets-worktree
cd ../droplets-worktree

git worktree add . ../universe main:droplets

Now, you can work on chat/ and droplets/ in their own directories.

πŸ“œ Viewing Commit History Per Project

To see only the commit history for a specific project (e.g., chat/):

git log -- chat/

To see a short log with one-line commits:

git log --oneline -- chat/

To see a graph view:

git log --graph --decorate -- chat/

πŸ”„ Committing Changes Per Project

When making commits, scope them to specific projects using the defined commit format.

# Stage only files inside chat/
git add chat/

git commit -m "[chat] πŸš€ feat(auth): add JWT authentication"
git push origin main

πŸ”€ Branching Strategy

To keep things simple, branches should be used sparingly. The preferred approach is:

**Creating a Project-Specific Branch**

git checkout -b feature/chat-new-ui

**Committing and Pushing to a Feature Branch**

git add chat/
git commit -m "[chat] πŸš€ feat(ui): redesign chat interface"
git push origin feature/chat-new-ui

**Merging Feature Branch Back into `main`**

git checkout main
git merge --squash feature/chat-new-ui
git commit -m "[chat] πŸš€ Merge chat UI update"
git push origin main

πŸ”„ CI/CD Per Project

Each project has its own GitHub Actions workflow to ensure that CI/CD only runs when necessary.

Example .github/workflows/chat.yml:

on:
  push:
    paths:
      - "chat/**"

This ensures only changes inside chat/ trigger the workflow.

πŸ”Ž Listing Project-Specific Tags

To see all tags related to chat/:

git tag --list "chat-*"

❌ Deleting a Tag (If Needed)

If you need to delete a project-specific tag:

git tag -d chat-v101.2.3
git push origin --delete chat-v101.2.3

πŸ” Additional Considerations

Handling Dependencies Between Projects

If projects depend on each other, use:

Rollback Strategy

If a breaking change is introduced, roll back using:

git revert <commit-hash>

Or reset to a previous tag:

git checkout <previous-tag>

Security & Access Control

Monorepo Tooling

If scaling up, consider tools like:

Performance Considerations

git branch --merged | grep -v "main" | xargs git branch -d

🏁 Conclusion

This monorepo is designed to make managing multiple projects efficient while keeping dependencies and tooling centralized. Use sparse checkout, worktrees, and scoped CI/CD to keep your workflow smooth!


For any questions, open an issue or ping @Dasho. πŸš€