Files
create-better-t-stack/apps/cli/templates/addons/ruler/.ruler/bts.md.hbs
2025-08-29 00:21:08 +05:30

133 lines
5.3 KiB
Handlebars

# Better-T-Stack Project Rules
This is a {{projectName}} project created with Better-T-Stack CLI.
## Project Structure
This is a monorepo with the following structure:
{{#if (or (includes frontend "tanstack-router") (includes frontend "react-router") (includes frontend "tanstack-start")
(includes frontend "next") (includes frontend "nuxt") (includes frontend "svelte") (includes frontend "solid"))}}
- **`apps/web/`** - Frontend application{{#if (includes frontend "tanstack-router")}} (React with TanStack Router){{else
if (includes frontend "react-router")}} (React with React Router){{else if (includes frontend "next")}} (Next.js){{else
if (includes frontend "nuxt")}} (Nuxt.js){{else if (includes frontend "svelte")}} (SvelteKit){{else if (includes
frontend "solid")}} (SolidStart){{/if}}
{{/if}}
{{#if (ne backend "convex")}}
{{#if (ne backend "none")}}
- **`apps/server/`** - Backend server{{#if (eq backend "hono")}} (Hono){{else if (eq backend "express")}}
(Express){{else if (eq backend "fastify")}} (Fastify){{else if (eq backend "elysia")}} (Elysia){{else if (eq backend
"next")}} (Next.js API){{/if}}
{{/if}}
{{else}}
- **`packages/backend/`** - Convex backend functions
{{/if}}
{{#if (or (includes frontend "native-nativewind") (includes frontend "native-unistyles"))}}
- **`apps/native/`** - React Native mobile app{{#if (includes frontend "native-nativewind")}} (with NativeWind){{else if
(includes frontend "native-unistyles")}} (with Unistyles){{/if}}
{{/if}}
## Available Scripts
- `{{packageManager}} run dev` - Start all apps in development mode
{{#if (or (includes frontend "tanstack-router") (includes frontend "react-router") (includes frontend "tanstack-start")
(includes frontend "next") (includes frontend "nuxt") (includes frontend "svelte") (includes frontend "solid"))}}
- `{{packageManager}} run dev:web` - Start only the web app
{{/if}}
{{#if (ne backend "none")}}
{{#if (ne backend "convex")}}
- `{{packageManager}} run dev:server` - Start only the server
{{/if}}
{{/if}}
{{#if (or (includes frontend "native-nativewind") (includes frontend "native-unistyles"))}}
- `{{packageManager}} run dev:native` - Start only the native app
{{/if}}
{{#if (and (ne database "none") (ne orm "none") (ne backend "convex"))}}
## Database Commands
All database operations should be run from the server workspace:
- `{{packageManager}} run db:push` - Push schema changes to database
- `{{packageManager}} run db:studio` - Open database studio
- `{{packageManager}} run db:generate` - Generate {{#if (eq orm "drizzle")}}Drizzle{{else if (eq orm
"prisma")}}Prisma{{else}}{{orm}}{{/if}} files
- `{{packageManager}} run db:migrate` - Run database migrations
{{#if (eq orm "drizzle")}}
Database schema files are located in `apps/server/src/db/schema/`
{{else if (eq orm "prisma")}}
Database schema is located in `apps/server/prisma/schema.prisma`
{{else if (eq orm "mongoose")}}
Database models are located in `apps/server/src/db/models/`
{{/if}}
{{/if}}
{{#if (ne api "none")}}
## API Structure
{{#if (eq api "trpc")}}
- tRPC routers are in `apps/server/src/routers/`
- Client-side tRPC utils are in `apps/web/src/utils/trpc.ts`
{{else if (eq api "orpc")}}
- oRPC endpoints are in `apps/server/src/api/`
- Client-side API utils are in `apps/web/src/utils/api.ts`
{{/if}}
{{/if}}
{{#if (eq auth "better-auth")}}
## Authentication
Authentication is enabled in this project:
{{#if (ne backend "convex")}}
- Server auth logic is in `apps/server/src/lib/auth.ts`
{{#if (or (includes frontend "tanstack-router") (includes frontend "react-router") (includes frontend "tanstack-start")
(includes frontend "next") (includes frontend "nuxt") (includes frontend "svelte") (includes frontend "solid"))}}
- Web app auth client is in `apps/web/src/lib/auth-client.ts`
{{/if}}
{{#if (or (includes frontend "native-nativewind") (includes frontend "native-unistyles"))}}
- Native app auth client is in `apps/native/src/lib/auth-client.ts`
{{/if}}
{{else}}
{{/if}}
{{/if}}
## Adding More Features
You can add additional addons or deployment options to your project using:
```bash
{{#if (eq packageManager "bun")}}bunx{{else if (eq packageManager "pnpm")}}pnpx{{else}}npx{{/if}} create-better-t-stack
add
```
Available addons you can add:
- **Documentation**: Starlight, Fumadocs
- **Linting**: Biome, Oxlint, Ultracite
- **Other**: Ruler, Turborepo, PWA, Tauri, Husky
You can also add web deployment configurations like Cloudflare Workers support.
## Project Configuration
This project includes a `bts.jsonc` configuration file that stores your Better-T-Stack settings:
- Contains your selected stack configuration (database, ORM, backend, frontend, etc.)
- Used by the CLI to understand your project structure
- Safe to delete if not needed
- Updated automatically when using the `add` command
## Key Points
- This is a {{#if (includes addons "turborepo")}}Turborepo {{/if}}monorepo using {{packageManager}} workspaces
- Each app has its own `package.json` and dependencies
- Run commands from the root to execute across all workspaces
- Run workspace-specific commands with `{{packageManager}} run command-name`
{{#if (includes addons "turborepo")}}
- Turborepo handles build caching and parallel execution
{{/if}}
- Use `{{#if (eq packageManager "bun")}}bunx{{else if (eq packageManager "pnpm")}}pnpx{{else}}npx{{/if}}
create-better-t-stack add` to add more features later