This is a Next.js SaaS boilerplate project using Tailwind CSS, NextUI Pro, DaisyUI, Zustand for state management, React Query, and other essential tools and libraries. This setup provides a robust foundation for building modern, responsive, and high-performance SaaS applications.
- Features
- Installation
- Project Structure
- Usage
- Configuration
- State Management
- API Integration
- Contributing
- License
- Next.js: A React framework for building server-side rendering and static web applications.
- Tailwind CSS: A utility-first CSS framework for styling.
- NextUI Pro: A React UI library that provides modern and beautiful UI components.
- DaisyUI: Tailwind CSS components plugin that adds extra UI components.
- Zustand: A small, fast, and scalable state management solution.
- React Query: Data fetching and synchronization library for React.
- TypeScript: Optional support for TypeScript.
- ESLint & Prettier: Code quality tools to ensure code consistency and readability.
- Jest & React Testing Library: Testing setup for unit and integration tests.
- SEO Optimization: Built-in SEO support for better search engine visibility.
To get started with this boilerplate, follow the steps below:
- Node.js (>= 14.x)
- npm (>= 7.x) or yarn (>= 1.x)
git clone https://github.com/your-username/nextjs-saas-boilerplate.git
cd nextjs-saas-boilerplateUsing npm:
npm installOr using yarn:
yarn installTo start the development server, run:
npm run devOr using yarn:
yarn devTo create an optimized production build, run:
npm run buildOr using yarn:
yarn buildTo start the production server after building, run:
npm run startOr using yarn:
yarn startTailwind CSS is configured in tailwind.config.js. You can extend the theme, add plugins, and configure other Tailwind settings there.
NextUI components are available out-of-the-box. Wrap your application with NextUIProvider in pages/_app.js or pages/_app.tsx.
DaisyUI components are automatically available, with themes configured in tailwind.config.js.
Zustand is used for state management. The global store is set up in the src/store directory. You can create new slices or extend the existing ones as needed.
import useStore from '@/store';
const ExampleComponent = () => {
const { stateValue, setStateValue } = useStore((state) => ({
stateValue: state.stateValue,
setStateValue: state.setStateValue,
}));
return (
<div>
<p>{stateValue}</p>
<button onClick={() => setStateValue('new value')}>Update Value</button>
</div>
);
};React Query is used for data fetching and caching. API requests are organized in the src/api directory.
import { useQuery } from 'react-query';
import { fetchData } from '@/api/example';
const ExampleComponent = () => {
const { data, error, isLoading } = useQuery('fetchData', fetchData);
if (isLoading) return <div>Loading...</div>;
if (error) return <div>Error: {error.message}</div>;
return <div>Data: {data}</div>;
};Contributions are welcome! Please read the contributing guidelines first.
This project is licensed under the MIT License. See the LICENSE file for more details.