create-croissant 0.1.10 → 0.1.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/template/.env.example +5 -0
- package/template/README.md +33 -5
package/package.json
CHANGED
package/template/README.md
CHANGED
|
@@ -16,17 +16,18 @@ npx create-croissant@latest
|
|
|
16
16
|
|
|
17
17
|
- **Frontend**: [TanStack Start](https://tanstack.com/start) for a seamless, type-safe React experience.
|
|
18
18
|
- **Authentication**: [Better Auth](https://www.better-auth.com/) with Drizzle adapter and PostgreSQL.
|
|
19
|
-
- **API**: [oRPC](https://orpc.sh/) for end-to-end type-safety
|
|
19
|
+
- **API**: [oRPC](https://orpc.sh/) with a modular, namespaced router for end-to-end type-safety.
|
|
20
20
|
- **Database**: [Drizzle ORM](https://orm.drizzle.team/) with PostgreSQL and Docker Compose setup.
|
|
21
21
|
- **Styling**: [shadcn/ui](https://ui.shadcn.com/) components with Tailwind CSS.
|
|
22
22
|
- **Monorepo**: Managed by [Turborepo](https://turbo.build/).
|
|
23
|
+
- **Developer Experience**: Path aliases (`@/`), strict TypeScript, and automated linting/formatting.
|
|
23
24
|
|
|
24
25
|
## 📁 Project Structure
|
|
25
26
|
|
|
26
|
-
- `apps/web`: The main TanStack Start application.
|
|
27
|
+
- `apps/web`: The main TanStack Start application. Uses `@/` path alias for clean imports.
|
|
27
28
|
- `packages/auth`: Authentication logic and Better Auth configuration.
|
|
28
29
|
- `packages/db`: Database schema, migrations, and Drizzle client.
|
|
29
|
-
- `packages/orpc`: Type-safe API router
|
|
30
|
+
- `packages/orpc`: Type-safe API router. Organized into modular files (e.g., `lib/planets.ts`).
|
|
30
31
|
- `packages/ui`: Shared UI components and styles.
|
|
31
32
|
|
|
32
33
|
## 🛠️ Getting Started
|
|
@@ -49,11 +50,18 @@ This command runs a PostgreSQL container named `samstack` on port `5432`.
|
|
|
49
50
|
|
|
50
51
|
### 3. Environment Variables
|
|
51
52
|
|
|
52
|
-
Create a `.env` file in the root directory
|
|
53
|
+
Create a `.env` file in the root directory by copying the example:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
cp .env.example .env
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Ensure you provide the necessary variables:
|
|
53
60
|
|
|
54
61
|
```env
|
|
55
62
|
DATABASE_URL=postgresql://postgres:postgres@localhost:5432/auth
|
|
56
63
|
BETTER_AUTH_URL=http://localhost:3000
|
|
64
|
+
BETTER_AUTH_SECRET=your-secret-here
|
|
57
65
|
```
|
|
58
66
|
|
|
59
67
|
### 4. Push Database Schema
|
|
@@ -80,15 +88,35 @@ The application will be available at `http://localhost:3000`.
|
|
|
80
88
|
- `npm run db:up`: Start the PostgreSQL Docker container.
|
|
81
89
|
- `npm run db:down`: Stop and remove the database container.
|
|
82
90
|
- `npm run db:logs`: Tail logs from the database container.
|
|
91
|
+
- `npm run db:push --filter @workspace/db`: Push Drizzle schema to the database.
|
|
92
|
+
- `npm run db:studio --filter @workspace/db`: Open Drizzle Studio to explore your data.
|
|
83
93
|
- `npm run lint`: Lint all packages.
|
|
94
|
+
- `npm run format`: Format all packages using Prettier.
|
|
84
95
|
- `npm run typecheck`: Run TypeScript type checking.
|
|
85
96
|
|
|
97
|
+
## 🔗 oRPC & Type Safety
|
|
98
|
+
|
|
99
|
+
The project uses oRPC for end-to-end type safety. The router is modularized for better maintainability:
|
|
100
|
+
|
|
101
|
+
- `packages/orpc/src/lib/router.ts`: Main router entry point.
|
|
102
|
+
- `packages/orpc/src/lib/planets.ts`: Planet-related procedures.
|
|
103
|
+
|
|
104
|
+
On the client side, you can infer types directly from the router:
|
|
105
|
+
|
|
106
|
+
```typescript
|
|
107
|
+
import type { router } from "@workspace/orpc/router"
|
|
108
|
+
import type { InferRouterInputs, InferRouterOutputs } from "@orpc/server"
|
|
109
|
+
|
|
110
|
+
type Inputs = InferRouterInputs<typeof router>
|
|
111
|
+
type Outputs = InferRouterOutputs<typeof router>
|
|
112
|
+
```
|
|
113
|
+
|
|
86
114
|
## 🧱 Adding Components
|
|
87
115
|
|
|
88
116
|
To add components to the shared UI package:
|
|
89
117
|
|
|
90
118
|
```bash
|
|
91
|
-
|
|
119
|
+
npx shadcn@latest add [component-name] -c apps/web
|
|
92
120
|
```
|
|
93
121
|
|
|
94
122
|
This will place the UI components in `packages/ui/src/components`.
|