menthire
v0.0.1
Published
A modern, type-safe, and high-performance SaaS starter template built with a monorepo architecture.
Readme
ZeroStarter - The SaaS Starter
A modern, type-safe, and high-performance SaaS starter template built with a monorepo architecture.
- 📚 Documentation: For comprehensive documentation, visit https://zerostarter.dev/docs.
- 🤖 AI/LLM Users: For optimized documentation, use https://zerostarter.dev/llms.txt.
- 🐦 X: Follow @nrjdalal for updates and don't forget to star the repository!
[!IMPORTANT] Release Candidate (RC) Status: ZeroStarter is currently in Release Candidate (RC) status. All implemented features are stable and production-ready. We're actively adding new features and integrations day-by-day.
Architecture and Tech Stack
- Runtime & Build System: Bun + Turborepo
- Frontend: Next.js 16
- Backend: Hono
- RPC: Hono Client for end-to-end type safety with frontend client
- Database: PostgreSQL with Drizzle ORM
- Authentication: Better Auth
- Styling: Tailwind CSS
- UI Components: Shadcn UI
- Data Fetching: TanStack Query
- Validation: Zod
- Bundling, Linting & Formatting: tsdown, Oxlint and Prettier
- Documentation: Fumadocs with auto-generated llms.txt
- Automated Releases: Automatically updated Changelog on release
Future Stack and Features
- AI
- [ ] Vercel AI SDK
- Analytics:
- [ ] Posthog
- Background Tasks:
- [ ] Inngest
- [ ] Trigger.dev
- Email:
- OpenAPI:
- [ ] Scalar
- Organization/teams:
- [ ] Better Auth
- Internationalization:
- Payment Processing:
📂 Project Structure
This project is a monorepo organized as follows:
.
├── api/
│ └── hono/ # Backend API server (Hono)
├── web/
│ └── next/ # Frontend application (Next.js)
└── packages/
├── auth/ # Shared authentication logic (Better Auth)
├── db/ # Database schema and Drizzle configuration
├── env/ # Type-safe environment variables
└── tsconfig/ # Shared TypeScript configuration🔌 Type-Safe API Client
This starter utilizes Hono RPC to provide end-to-end type safety between the backend and frontend.
- Backend: Routes defined in
api/hono/src/routersare exported asAppTypeatapi/hono/src/index.ts. - Frontend: The client at
web/next/src/lib/api/client.tsinfersAppTyperequest/response types usinghono/client.
Usage Example
import { apiClient } from "@/lib/api/client"
// Fully typed request and response
const res = await apiClient.health.$get()
const data = await res.json()⚙️ Getting Started
Prerequisites
- Bun (v1.3.0 or later)
Installation
Clone this template:
bunx gitpick https://github.com/nrjdalal/zerostarter/tree/main cd zerostarterNote: The
mainbranch is the latest stable release.Install dependencies:
bun installNote: If the installation fails, try using
bun install --ignore-scriptsSet up environment variables:
Create a
.envfile in the root directory with the following variables:# -------------------- Server variables -------------------- HONO_APP_URL=http://localhost:4000 HONO_TRUSTED_ORIGINS=http://localhost:3000 # Generate using `openssl rand -base64 32` BETTER_AUTH_SECRET= # Generate at `https://github.com/settings/developers` GITHUB_CLIENT_ID= GITHUB_CLIENT_SECRET= # Generate at `https://console.cloud.google.com/apis/credentials` GOOGLE_CLIENT_ID= GOOGLE_CLIENT_SECRET= # Generate using `bunx pglaunch -k` POSTGRES_URL= # -------------------- Client variables -------------------- NEXT_PUBLIC_APP_URL=http://localhost:3000 NEXT_PUBLIC_API_URL=http://localhost:4000
Database Setup
Ensure your PostgreSQL server is running.
Run the generation:
bun run db:generateRun the migration:
bun run db:migrate
Authentication Setup
ZeroStarter comes with some default authentication plugins using Better Auth, you can extend as needed.
Github
- Create a GitHub OAuth App at GitHub Developer Settings.
- Set the Homepage URL to
http://localhost:3000. - Set the Authorization callback URL to
http://localhost:3000/api/auth/callback/github. - Copy the Client ID and Client Secret into your
.envfile.
- Create a Google OAuth App in the [Google Cloud Console](https://console.cloud.google.com/apis/credentials.
- Configure the OAuth consent screen (External).
- Create an OAuth Client ID (Application type: Web).
- Set the Authorized JavaScript origins to
http://localhost:3000. - Set the Authorized redirect URI to
http://localhost:4000/api/auth/callback/google. - Copy the Client ID and Client Secret into your
.envfile.
Running the Application
bun devRunning the Application with Docker Compose
docker compose upAccessing the Application
- Frontend: http://localhost:3000
- Backend: http://localhost:4000
📜 Scripts
Development
bun run dev: Start the development servers.
Maintenance
bun run clean: Clean the cache and build artifacts.bun run lint: Lint the codebase using Oxlint.bun run format: Format the codebase using Prettier.bun run check-types: Check the types of the codebase.
Production
bun run build: Build the applications.bun run start: Start the production servers.
Database
bun run db:generate: Generate Drizzle migrations.bun run db:migrate: Run Drizzle migrations.bun run db:studio: Open Drizzle Studio to view/edit data.
📖 Deployment
🤝 Contributing
Contributions welcome — any help is appreciated!
- Fork the repo and create a branch (use descriptive names, e.g.
feat/{name}orfix/{name}). - Make your changes, add tests if applicable, and run the checks:
bun run buildbun run check-typesbun run formatbun run lint
- Follow the existing code style and commit message conventions (use conventional commits: feat, fix, docs, chore).
- Open a PR describing the change, motivation, and any migration notes; link related issues.
- For breaking changes or large features, open an issue first to discuss the approach.
- By contributing you agree to the MIT license and the project's Code of Conduct.
Thank you for helping improve ZeroStarter!
📄 License
This project is licensed under the MIT License.
