NOTE: This project is currently in alpha. In fact, it's very alpha. This means it is still under active development and may undergo significant changes. Features may be incomplete or unstable. Got suggestions on what you would like to see or how to make it better? Add an issue and let us know!
These badges represent the results of Lighthouse audits, which are run to ensure the application meets high standards in performance, accessibility, best practices, and SEO. Note that these audits are conducted for the desktop version of the application, as its primary use case is on desktop, although it is fully responsive.
View Detailed Lighthouse Report
An open-source boilerplate designed to simplify the development of single-page React applications (SPAs). By leveraging Nx, Tailwind CSS, and Shadcn UI, this project offers developers a seamless and efficient starting point for building modern front-end applications. It is ideal for those who prefer not to use Next.js or cannot use it but still want the benefits of this powerful toolset.
Inspired by and based upon joshuarobs/nx-shadcn-ui-monorepo.
Thanks to the help from this tutorial here: https://medium.com/readytowork-org/monorepo-setup-with-nx-nextjs-and-shadcn-ui-3b72c3599470
For a detailed breakdown of the project goals, see Project Goals.
While tools like Nx, Tailwind CSS, and Shadcn UI are incredibly powerful and offer numerous benefits for modern front-end development, the process of configuring them can still be time-consuming, error-prone, and frustrating, even for experienced developers. This is because setting up such architectures from scratch is an infrequent task, and each setup can have its own unique challenges and nuances.
This project was built to address these challenges by providing a pre-configured, ready-to-use boilerplate that simplifies the initial setup process. By leveraging this boilerplate, developers can quickly start building their applications without worrying about the complexities of configuration, allowing them to focus on writing code and delivering features.
For more details on why a React SPA boilerplate may still have some value in a Next.js world, see Why a React SPA Boilerplate in a Next.js World?
To install the project, follow these steps:
Clone the repository:
git clone https://github.com/CambridgeMonorail/react-weapons-of-choice.git
Navigate to the project directory:
cd react-weapons-of-choice
Install dependencies:
pnpm install
To run the dev server for your app, use:
npx nx serve client
To create a production bundle:
npx nx build client
To see all available targets to run for a project, run:
npx nx show project client
These targets are either inferred automatically or defined in the project.json
or package.json
files.
More about running tasks in the docs »
The following scripts are available to manage and build the project:
Build
pnpm run build:affected
: Build only the affected projects.pnpm run build:all
: Build all projects.pnpm run build:client
: Build the client application.pnpm run build:shadcnui
: Build the shadcnui library.Clean
pnpm run clean
: Clean all projects.Format
pnpm run format:check
: Check the formatting of the code.pnpm run format
: Format the code.Lint
pnpm run lint:affected
: Lint only the affected projects.pnpm run lint:all
: Lint all projects.pnpm run lint:client
: Lint the client application.pnpm run lint:shadcnui
: Lint the shadcnui library.Precommit
pnpm run precommit
: Run lint, type-check, build, and test for all projects before committing.Prepare
pnpm run prepare
: Prepare Husky for Git hooks.Serve
pnpm run serve:client
: Serve the client application.pnpm run serve:storybook
: Serve the Storybook instance.Test
pnpm run test:affected
: Test only the affected projects.pnpm run test:all
: Test all projects.pnpm run test:client
: Test the client application.pnpm run test:shadcnui
: Test the shadcnui library.Type-check
pnpm run type-check:affected
: Type-check only the affected projects.pnpm run type-check:all
: Type-check all projects.pnpm run type-check:client
: Type-check the client application.pnpm run type-check:shadcnui
: Type-check the shadcnui library.Nx Console is an editor extension that enriches your developer experience. It lets you run tasks, generate code, and improves code autocompletion in your IDE. It is available for VSCode and IntelliJ.
Follow these steps to fork and customize the boilerplate for your own project.
Locate the forked repository on your GitHub account.
Click the Code button and copy the repository’s URL.
Open your terminal and run:
git clone https://github.com/<your-username>/<your-forked-repo>.git
Replace <your-username>
with your GitHub username and <your-forked-repo>
with the repository name.
You can update project identifiers either manually or by using the setup script included in this boilerplate.
Perform a global search and replace across the codebase to update:
apps\client\src\assets\images\app-logo.webp
docs/images/logos/app-logo.svg
Ensure all instances of the original project name are replaced with your new project name.
Install project dependencies:
pnpm install
Run the setup script:
pnpm run setup
The script will prompt you to replace:
You will also have the option to set a new Git remote URL.
package.json
and .env
—to align them with your project’s requirements. Create a new repository on GitHub for your customized project.
In your terminal, navigate to your project’s directory and run:
git remote remove origin
git remote add origin https://github.com/<your-username>/<your-new-repo>.git
Replace <your-username>
with your GitHub username and <your-new-repo>
with the new repository name.
Push your local changes to the new remote repository:
git push -u origin main
Make sure your local branch is named main
. If not, replace main
with the correct branch name.
Install any required dependencies (if you haven’t already):
pnpm install
Set up Git hooks or other initialization scripts:
pnpm run prepare
This typically configures hooks like pre-commit or lint-staged checks.
By following these steps, you can fully customize the boilerplate to fit your project’s needs while maintaining a clean, organized codebase.
While you could add new projects to your workspace manually, you might want to leverage Nx plugins and their code generation feature.
Use the plugin's generator to create new projects.
To generate a new application, use:
npx nx g @nx/react:app client
To generate a new library, use:
npx nx g @nx/react:lib mylib
You can use npx nx list
to get a list of installed plugins. Then, run npx nx list <plugin-name>
to learn about more specific capabilities of a particular plugin. Alternatively, install Nx Console to browse plugins and generators in your IDE.
Learn more about Nx plugins » | Browse the plugin registry »
To learn how to theme your app using Shadcn UI and Tailwind CSS, please refer to the detailed guide in docs/theming-a-new-app.md.
Note: The current theme was generated using the Ready.js Shadcn UI Theme Generator.
To add a new component page to the routing in your React SPA, please refer to the detailed guide in docs/adding-new-component-page.md.
Contributions are welcome! Please open an issue or submit a pull request for any changes. For detailed guidelines on how to contribute, see Contributing.
This project is licensed under the MIT License.
Learn more:
It's not finished yet.
It's not finished yet.
It's not finished yet.
It's not finished yet.
It's not finished yet.
It's not finished yet.
It's not finished yet. (Just kidding, that's actually due to Rayleigh scattering.)