This is a monorepo for our Stapler CLI tool that scaffolds an entire fullstack app using a monorepo structure. It integrates Next.js, Supabase, Payload CMS, Vercel, and more, leveraging Turbo and pnpm to optimize your development workflow.
- node.js
- npx
- pnpm
- Fullstack scaffolding: Quickly set up a monorepo with Next.js, Supabase, Payload CMS, and Vercel.
- Monorepo: Built-in support for managing multiple packages with Turbo and pnpm.
- Customizable: Easily extend the project with your own services or tools.
This CLI tool automates the setup of fullstack apps with Next.js, Supabase, Payload CMS, and Vercel, and efficiently manages monorepos with Turbo and pnpm.
- Scaffolds a fullstack monorepo with the latest packages.
- Integrates Next.js, Supabase, Payload CMS, and Vercel.
- Uses pnpm for fast dependency management.
- Automates GitHub repository creation and GitHub authentication using the GitHub CLI.
If you'd like to develop or test Stapler locally, follow these steps:
# Clone the repository:
git clone https://github.com/tonik/stapler.git
cd stapler-cli
# Install dependencies and build the project:
pnpm install
pnpm build
# Link the CLI locally:
cd packages/cli
npm link
Once the CLI is linked, you can use it to create a new fullstack project by running:
stplr
This will scaffold a new project in the directory you're currently in.
Stapler uses Vitest for unit testing, providing a fast and efficient testing environment. The monorepo structure enables targeted testing for specific packages or the entire project.
- To run all tests in the monorepo:
pnpm test
This runs all test files across the monorepo.
- To test the core package specifically:
pnpm test:core
This focuses testing on the core functionality of Stapler.
- To use the interactive Vitest UI:
pnpm test:ui
This opens a browser-based interface to monitor and debug your tests in real-time.
-
Create a
__tests__
directory within the relevant package (e.g.,packages/core/__tests__/
). -
Write your test files using a
.test.ts
or.spec.ts
extension. -
Use Vitest's utilities like
describe
,it
, andexpect
for test cases. -
Example:
import { describe, it, expect } from 'vitest';
import { exampleFunction } from '../src/example';
describe('exampleFunction', () => {
it('should return the correct value', () => {
const result = exampleFunction('input');
expect(result).toBe('expected output');
});
});
We use Changesets for versioning. Currently, we're developing the alpha version of the CLI, so the versioning is not yet stable.
When you're ready to create a new version, run the following command:
pnpm changeset
This will run a guided process to create a new version. In the process you would be asked to select the type of the change (patch, minor, major) and write a summary of the changes. The next step is to run the following command:
pnpm changeset version
This will create the neccessary changeset files and update the version in the package.json
files.
When those changes will be pushed to the repository and merged to the main
branch, the CI will automatically publish the new version to the npm registry.
── ARCHITECTURE.md # Detailed overview of the scaffolded project structure
├── README.md
├── package.json # Main package.json for the monorepo
├── packages # Monorepo packages
│ ├── cli # Main CLI package
│ └── core # Core package with installation logic
│ ├── CHANGELOG.md
│ ├── installMachine # State machine, based on xState v5 for the installation process
│ │ └── installSteps # Individual installation steps
│ ├── templates # Templates for the scaffolded project
│ └── utils # Utility functions
├── pnpm-lock.yaml
├── pnpm-workspace.yaml
├── tsconfig.json
└── turbo.json
Refer to the ARCHITECTURE document for an in-depth overview of the scaffolded project structure.
If the CLI hangs during the gh auth login
step, verify that the GitHub CLI is installed and authenticated properly. You can check the GitHub CLI documentation for assistance.