A Monorepo B2B SaaS starter template for AI-powered microservices.
Implementation Note: This is a starter template with some components fully implemented and others in various stages of implementation. See the "Current Implementation Status" section for details.
- π Authentication: Clerk with organization/team support (NextAuth fallback)
- π¨ CMS: Directus in Docker container (integration in progress)
- π§ Database: Neon Postgres with Drizzle ORM
- βοΈ Backend API: Express + tRPC + Zod with OpenAPI generation
- π§Ύ API Docs: Scalar-hosted documentation
- π Async Workflows: Upstash Workflows framework (implementation in progress)
- π Email: Resend for transactional emails (with development mode)
- π Analytics: PostHog for product analytics
- π§ͺ Type Safety: End-to-end type safety between frontend and backend
/apps
/frontend β Next.js (marketing, dashboard, auth UI)
/api β Express + Zod + tRPC backend
/workflows β Upstash Workflow handlers
/cms β Directus headless CMS configuration (Docker)
/docs β Scalar, built from OpenAPI spec
/scripts β Helper scripts
/packages
/types β Shared Zod schemas + OpenAPI types
/utils β Shared fetchers, helpers, validators
| Concern | Tool | Status |
|---|---|---|
| Frontend | Next.js 14, Tailwind, ShadCN | Fully implemented |
| CMS | Directus (Docker) | Container setup complete, content integration in progress |
| Auth | Clerk (fallback: NextAuth) | Fully implemented, API validation in progress |
| API | Express + tRPC + Zod | Fully implemented |
| DB | Neon + Drizzle ORM | Basic setup complete, schema and migrations needed |
| Async/Queue | Upstash Workflow + QStash | Framework setup, implementation in progress |
| Emails | Resend | Implemented with dev mode |
| API Docs | Scalar + zod-to-openapi | Fully implemented |
| Analytics | PostHog | Configuration ready |
- Node.js 18+
- PNPM
- Docker (for local development of Directus CMS)
# Clone the repository
git clone https://github.com/digiphd/full-stack-saas-nextjs-1.git
# Install dependencies
pnpm install
# Set up environment variables
cp .env.example .env
# Start development servers (including Directus CMS in Docker)
pnpm devCreate a .env file in the root directory with the following variables:
AUTH_PROVIDER=clerk
QUEUE_PROVIDER=upstash
CMS_ENDPOINT=https://cms.yourdomain.com
FRONTEND_URL=https://app.yourdomain.com
RESEND_API_KEY=your_resend_api_key
NEON_DATABASE_URL=your_neon_db_url
CLERK_SECRET_KEY=your_clerk_secret_key
pnpm generate:openapiThe Directus CMS runs in a Docker container locally for development. When you run pnpm dev, the container will be started automatically.
Note: While the Directus container is fully functional, the integration with blog and marketing pages is still in progress. The frontend currently uses mock data for these sections.
For a detailed list of planned improvements and remaining work items, please see our TODO.md file.
This template includes a working example of OpenAI integration with the SaaS Idea Generator on the Home Page.
The example demonstrates:
- Integration with OpenAI's API
- API Handling
- Error Handling
- Input Validation
- Frontend-to-backend communication
- The blog currently uses hardcoded mock data
- Directus integration is planned but not fully implemented
- Revalidation API routes are set up for future CMS integration
- Framework and handlers are set up
- Uses placeholder/mock configurations for local development
- Requires additional configuration for production use
- Fully implemented with proper configuration
- Development mode logs emails instead of sending them
- Ready for production with proper API keys
For production deployment of Directus CMS, you have several options:
- fly.io: A cost-effective on-demand service that's easy to set up and scale. Recommended for most use cases.
- Self-hosted Docker: Deploy the Docker container to your own infrastructure.
- Directus Cloud: Official managed service from Directus (https://directus.cloud).
After CMS updates, trigger revalidation (once CMS integration is complete):
curl -X POST https://app.yourdomain.com/api/revalidate?secret=your_secret&path=/blog/your-post-slugThis project includes a PRD template (PRD.md.example) to help you customize the starter kit for your specific needs. When integrating with AI tools like Claude or Tempo Labs:
- Copy
PRD.md.exampletoPRD.md - Customize the PRD with your specific project details
- Use the PRD to provide context when working with AI tools
The template includes sections on technical requirements, customization points, and example prompts for AI integration.
Contributions to this project are managed through a controlled process. Please read our CONTRIBUTING.md file for details on how to request access to contribute.
This project is licensed under the MIT License - see the LICENSE file for details.
This software is provided "as is", without warranty of any kind, express or implied. The authors or copyright holders shall not be liable for any claim, damages or other liability arising from the use of the software. No support or maintenance will be provided for this template.

