saas-init 1.0.0
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/README.md +98 -0
- package/dist/index.js +765 -0
- package/package.json +68 -0
- package/templates/auth/clerk/app/sign-in/[[...sign-in]]/page.tsx +9 -0
- package/templates/auth/clerk/app/sign-up/[[...sign-up]]/page.tsx +9 -0
- package/templates/auth/clerk/middleware.ts +12 -0
- package/templates/auth/nextauth/app/api/auth/route.ts +3 -0
- package/templates/auth/nextauth/auth.ts +12 -0
- package/templates/auth/supabase/middleware.ts +59 -0
- package/templates/auth/supabase/utils/supabase/client.ts +12 -0
- package/templates/auth/supabase/utils/supabase/server.ts +35 -0
- package/templates/base/app/globals.css +87 -0
- package/templates/base/app/layout.tsx +19 -0
- package/templates/base/app/page.tsx +7 -0
- package/templates/base/components.json +21 -0
- package/templates/base/lib/utils.ts +6 -0
- package/templates/base/next.config.ts +7 -0
- package/templates/base/package.json +23 -0
- package/templates/base/postcss.config.mjs +5 -0
- package/templates/base/tsconfig.json +27 -0
- package/templates/database/postgres/db/index.ts +12 -0
- package/templates/database/postgres/db/schema.ts +7 -0
- package/templates/database/postgres/drizzle.config.ts +10 -0
- package/templates/database/sqlite/db/index.ts +7 -0
- package/templates/database/sqlite/db/schema.ts +7 -0
- package/templates/database/sqlite/drizzle.config.ts +10 -0
- package/templates/database/supabase/utils/supabase/client.ts +12 -0
- package/templates/database/supabase/utils/supabase/db.ts +10 -0
- package/templates/docker/.dockerignore +5 -0
- package/templates/docker/Dockerfile +25 -0
- package/templates/docker/docker-compose.yml +22 -0
- package/templates/email/postmark/lib/email.ts +17 -0
- package/templates/email/resend/lib/email.ts +20 -0
- package/templates/github/.github/workflows/ci.yml +55 -0
- package/templates/landing/app/page.tsx +21 -0
- package/templates/landing/components/Footer.tsx +37 -0
- package/templates/landing/components/Hero.tsx +29 -0
- package/templates/landing/components/ProblemAgitate.tsx +34 -0
- package/templates/landing/components/SecondaryCTA.tsx +20 -0
- package/templates/landing/components/SocialProof.tsx +43 -0
- package/templates/landing/components/Transformation.tsx +48 -0
- package/templates/landing/components/ValueStack.tsx +54 -0
- package/templates/payments/lemonsqueezy/app/api/webhooks/lemonsqueezy/route.ts +58 -0
- package/templates/payments/lemonsqueezy/lib/lemonsqueezy.ts +13 -0
- package/templates/payments/stripe/app/api/webhooks/stripe/route.ts +46 -0
- package/templates/payments/stripe/lib/stripe.ts +10 -0
package/README.md
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
# saas-init
|
|
2
|
+
|
|
3
|
+
CLI scaffolding tool that generates production-ready SaaS projects on top of Next.js.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install -g saas-init
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Or use directly without installing:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npx saas-init init
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
saas-init init
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
The CLI walks you through a short prompt sequence:
|
|
24
|
+
|
|
25
|
+
1. Project name (lowercase, npm-valid, e.g. `my-app`)
|
|
26
|
+
2. Output directory (default: `./<project-name>`)
|
|
27
|
+
3. Auth provider
|
|
28
|
+
4. Database
|
|
29
|
+
5. Payments (optional)
|
|
30
|
+
6. Email (optional)
|
|
31
|
+
7. Summary — confirm before any files are written
|
|
32
|
+
|
|
33
|
+
After confirming, saas-init generates the project files and optionally runs `pnpm install` in the output directory.
|
|
34
|
+
|
|
35
|
+
## What's Included
|
|
36
|
+
|
|
37
|
+
Every generated project comes with:
|
|
38
|
+
|
|
39
|
+
- **Landing Page**: Production-ready landing page with multiple sections (hero, problem agitate, value proposition, social proof, transformation, CTA, footer). Fully customizable via template variables.
|
|
40
|
+
- **Docker**: Pre-configured `Dockerfile` and `docker-compose.yml` for easy containerization.
|
|
41
|
+
- **GitHub Actions**: Automated CI workflow for testing and linting on every push and PR.
|
|
42
|
+
|
|
43
|
+
## Supported Stack Options
|
|
44
|
+
|
|
45
|
+
| Category | Options |
|
|
46
|
+
|-----------|-------------------------------------|
|
|
47
|
+
| Auth | Clerk, NextAuth, Supabase Auth |
|
|
48
|
+
| Database | Postgres (Drizzle), SQLite (Drizzle), Supabase |
|
|
49
|
+
| Payments | Stripe, Lemon Squeezy, None |
|
|
50
|
+
| Email | Resend, Postmark, None |
|
|
51
|
+
|
|
52
|
+
## Adding a New Provider
|
|
53
|
+
|
|
54
|
+
1. Add templates under `templates/<category>/<provider>/`. Use `{{key}}` placeholders for variables that come from `ProjectConfig`.
|
|
55
|
+
|
|
56
|
+
2. Create a generator at `src/generators/<category>/<provider>.ts` that exports:
|
|
57
|
+
|
|
58
|
+
```ts
|
|
59
|
+
export async function generate(config: ProjectConfig, outDir: string): Promise<void>
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Inside it, use the file utilities to copy templates and merge dependencies:
|
|
63
|
+
|
|
64
|
+
```ts
|
|
65
|
+
import path from 'path'
|
|
66
|
+
import fs from 'fs-extra'
|
|
67
|
+
import { writeTemplate, appendEnv } from '../../utils/files.js'
|
|
68
|
+
import { mergeDeps } from '../../utils/deps.js'
|
|
69
|
+
import { TEMPLATES_ROOT } from '../../utils/paths.js'
|
|
70
|
+
|
|
71
|
+
const TEMPLATES_DIR = path.join(TEMPLATES_ROOT, '<category>/<provider>')
|
|
72
|
+
|
|
73
|
+
export async function generate(config: ProjectConfig, outDir: string): Promise<void> {
|
|
74
|
+
await writeTemplate(
|
|
75
|
+
path.join(TEMPLATES_DIR, 'lib/client.ts'),
|
|
76
|
+
path.join(outDir, 'lib/client.ts'),
|
|
77
|
+
{}
|
|
78
|
+
)
|
|
79
|
+
const pkgPath = path.join(outDir, 'package.json')
|
|
80
|
+
const pkg = await fs.readJson(pkgPath)
|
|
81
|
+
pkg.dependencies = mergeDeps(pkg.dependencies ?? {}, { '<package>': '^1.0.0' })
|
|
82
|
+
await fs.writeJson(pkgPath, pkg, { spaces: 2 })
|
|
83
|
+
await appendEnv(outDir, { MY_API_KEY: '' })
|
|
84
|
+
}
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
3. Register the generator in `src/generators/index.ts` by adding it to the relevant map (e.g. `authGenerators`, `databaseGenerators`, etc.).
|
|
88
|
+
|
|
89
|
+
4. Add the new value to the relevant union type in `src/types.ts` and the matching zod enum in `projectConfigSchema`.
|
|
90
|
+
|
|
91
|
+
5. Add a prompt option in `src/prompts/<category>.ts`.
|
|
92
|
+
|
|
93
|
+
6. Write tests in `tests/generators/<category>/<provider>.test.ts` following the patterns of existing generator tests.
|
|
94
|
+
|
|
95
|
+
## Requirements
|
|
96
|
+
|
|
97
|
+
- Node.js >= 18
|
|
98
|
+
- pnpm (for generated projects)
|