create-blitzpack 0.1.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/dist/index.js +452 -0
- package/package.json +57 -0
- package/template/.dockerignore +59 -0
- package/template/.github/workflows/ci.yml +157 -0
- package/template/.husky/pre-commit +1 -0
- package/template/.husky/pre-push +1 -0
- package/template/.lintstagedrc.cjs +4 -0
- package/template/.nvmrc +1 -0
- package/template/.prettierrc +9 -0
- package/template/.vscode/settings.json +13 -0
- package/template/CLAUDE.md +175 -0
- package/template/CONTRIBUTING.md +32 -0
- package/template/Dockerfile +90 -0
- package/template/GETTING_STARTED.md +35 -0
- package/template/LICENSE +21 -0
- package/template/README.md +116 -0
- package/template/apps/api/.dockerignore +51 -0
- package/template/apps/api/.env.local.example +62 -0
- package/template/apps/api/emails/account-deleted-email.tsx +69 -0
- package/template/apps/api/emails/components/email-layout.tsx +154 -0
- package/template/apps/api/emails/config.ts +22 -0
- package/template/apps/api/emails/password-changed-email.tsx +88 -0
- package/template/apps/api/emails/password-reset-email.tsx +86 -0
- package/template/apps/api/emails/verification-email.tsx +85 -0
- package/template/apps/api/emails/welcome-email.tsx +70 -0
- package/template/apps/api/package.json +84 -0
- package/template/apps/api/prisma/migrations/20251012111439_init/migration.sql +13 -0
- package/template/apps/api/prisma/migrations/20251018162629_add_better_auth_fields/migration.sql +67 -0
- package/template/apps/api/prisma/migrations/20251019142208_add_user_role_enum/migration.sql +5 -0
- package/template/apps/api/prisma/migrations/20251019182151_user_auth/migration.sql +7 -0
- package/template/apps/api/prisma/migrations/20251019211416_faster_session_lookup/migration.sql +2 -0
- package/template/apps/api/prisma/migrations/20251119124337_add_upload_model/migration.sql +26 -0
- package/template/apps/api/prisma/migrations/20251120071241_add_scope_to_account/migration.sql +2 -0
- package/template/apps/api/prisma/migrations/20251120072608_add_oauth_token_expiration_fields/migration.sql +10 -0
- package/template/apps/api/prisma/migrations/20251120144705_add_audit_logs/migration.sql +29 -0
- package/template/apps/api/prisma/migrations/20251127123614_remove_impersonated_by/migration.sql +8 -0
- package/template/apps/api/prisma/migrations/20251127125630_remove_audit_logs/migration.sql +11 -0
- package/template/apps/api/prisma/migrations/migration_lock.toml +3 -0
- package/template/apps/api/prisma/schema.prisma +116 -0
- package/template/apps/api/prisma/seed.ts +159 -0
- package/template/apps/api/prisma.config.ts +14 -0
- package/template/apps/api/src/app.ts +377 -0
- package/template/apps/api/src/common/logger.service.ts +227 -0
- package/template/apps/api/src/config/env.ts +60 -0
- package/template/apps/api/src/config/rate-limit.ts +29 -0
- package/template/apps/api/src/hooks/auth.ts +122 -0
- package/template/apps/api/src/plugins/auth.ts +198 -0
- package/template/apps/api/src/plugins/database.ts +45 -0
- package/template/apps/api/src/plugins/logger.ts +33 -0
- package/template/apps/api/src/plugins/multipart.ts +16 -0
- package/template/apps/api/src/plugins/scalar.ts +20 -0
- package/template/apps/api/src/plugins/schedule.ts +52 -0
- package/template/apps/api/src/plugins/services.ts +66 -0
- package/template/apps/api/src/plugins/swagger.ts +56 -0
- package/template/apps/api/src/routes/accounts.ts +91 -0
- package/template/apps/api/src/routes/admin-sessions.ts +92 -0
- package/template/apps/api/src/routes/metrics.ts +71 -0
- package/template/apps/api/src/routes/password.ts +46 -0
- package/template/apps/api/src/routes/sessions.ts +53 -0
- package/template/apps/api/src/routes/stats.ts +38 -0
- package/template/apps/api/src/routes/uploads-serve.ts +27 -0
- package/template/apps/api/src/routes/uploads.ts +154 -0
- package/template/apps/api/src/routes/users.ts +114 -0
- package/template/apps/api/src/routes/verification.ts +90 -0
- package/template/apps/api/src/server.ts +34 -0
- package/template/apps/api/src/services/accounts.service.ts +125 -0
- package/template/apps/api/src/services/authorization.service.ts +162 -0
- package/template/apps/api/src/services/email.service.ts +170 -0
- package/template/apps/api/src/services/file-storage.service.ts +267 -0
- package/template/apps/api/src/services/metrics.service.ts +175 -0
- package/template/apps/api/src/services/password.service.ts +56 -0
- package/template/apps/api/src/services/sessions.service.spec.ts +134 -0
- package/template/apps/api/src/services/sessions.service.ts +276 -0
- package/template/apps/api/src/services/stats.service.ts +273 -0
- package/template/apps/api/src/services/uploads.service.ts +163 -0
- package/template/apps/api/src/services/users.service.spec.ts +249 -0
- package/template/apps/api/src/services/users.service.ts +198 -0
- package/template/apps/api/src/utils/file-validation.ts +108 -0
- package/template/apps/api/start.sh +33 -0
- package/template/apps/api/test/helpers/fastify-app.ts +24 -0
- package/template/apps/api/test/helpers/mock-authorization.ts +16 -0
- package/template/apps/api/test/helpers/mock-logger.ts +28 -0
- package/template/apps/api/test/helpers/mock-prisma.ts +30 -0
- package/template/apps/api/test/helpers/test-db.ts +125 -0
- package/template/apps/api/test/integration/auth-flow.integration.spec.ts +449 -0
- package/template/apps/api/test/integration/password.integration.spec.ts +427 -0
- package/template/apps/api/test/integration/rate-limit.integration.spec.ts +51 -0
- package/template/apps/api/test/integration/sessions.integration.spec.ts +445 -0
- package/template/apps/api/test/integration/users.integration.spec.ts +211 -0
- package/template/apps/api/test/setup.ts +31 -0
- package/template/apps/api/tsconfig.json +26 -0
- package/template/apps/api/vitest.config.ts +35 -0
- package/template/apps/web/.env.local.example +11 -0
- package/template/apps/web/components.json +24 -0
- package/template/apps/web/next.config.ts +22 -0
- package/template/apps/web/package.json +56 -0
- package/template/apps/web/postcss.config.js +5 -0
- package/template/apps/web/public/apple-icon.png +0 -0
- package/template/apps/web/public/icon.png +0 -0
- package/template/apps/web/public/robots.txt +3 -0
- package/template/apps/web/src/app/(admin)/admin/layout.tsx +222 -0
- package/template/apps/web/src/app/(admin)/admin/page.tsx +157 -0
- package/template/apps/web/src/app/(admin)/admin/sessions/page.tsx +18 -0
- package/template/apps/web/src/app/(admin)/admin/users/page.tsx +20 -0
- package/template/apps/web/src/app/(auth)/forgot-password/page.tsx +177 -0
- package/template/apps/web/src/app/(auth)/login/page.tsx +159 -0
- package/template/apps/web/src/app/(auth)/reset-password/page.tsx +245 -0
- package/template/apps/web/src/app/(auth)/signup/page.tsx +153 -0
- package/template/apps/web/src/app/dashboard/change-password/page.tsx +255 -0
- package/template/apps/web/src/app/dashboard/page.tsx +296 -0
- package/template/apps/web/src/app/error.tsx +32 -0
- package/template/apps/web/src/app/examples/file-upload/page.tsx +200 -0
- package/template/apps/web/src/app/favicon.ico +0 -0
- package/template/apps/web/src/app/global-error.tsx +96 -0
- package/template/apps/web/src/app/globals.css +22 -0
- package/template/apps/web/src/app/icon.png +0 -0
- package/template/apps/web/src/app/layout.tsx +34 -0
- package/template/apps/web/src/app/not-found.tsx +28 -0
- package/template/apps/web/src/app/page.tsx +192 -0
- package/template/apps/web/src/components/admin/activity-feed.tsx +101 -0
- package/template/apps/web/src/components/admin/charts/auth-breakdown-chart.tsx +114 -0
- package/template/apps/web/src/components/admin/charts/chart-tooltip.tsx +124 -0
- package/template/apps/web/src/components/admin/charts/realtime-metrics-chart.tsx +511 -0
- package/template/apps/web/src/components/admin/charts/role-distribution-chart.tsx +102 -0
- package/template/apps/web/src/components/admin/charts/session-activity-chart.tsx +90 -0
- package/template/apps/web/src/components/admin/charts/user-growth-chart.tsx +108 -0
- package/template/apps/web/src/components/admin/health-indicator.tsx +175 -0
- package/template/apps/web/src/components/admin/refresh-control.tsx +90 -0
- package/template/apps/web/src/components/admin/session-revoke-all-dialog.tsx +79 -0
- package/template/apps/web/src/components/admin/session-revoke-dialog.tsx +74 -0
- package/template/apps/web/src/components/admin/sessions-management-table.tsx +372 -0
- package/template/apps/web/src/components/admin/stat-card.tsx +137 -0
- package/template/apps/web/src/components/admin/user-create-dialog.tsx +152 -0
- package/template/apps/web/src/components/admin/user-delete-dialog.tsx +73 -0
- package/template/apps/web/src/components/admin/user-edit-dialog.tsx +170 -0
- package/template/apps/web/src/components/admin/users-management-table.tsx +285 -0
- package/template/apps/web/src/components/auth/email-verification-banner.tsx +85 -0
- package/template/apps/web/src/components/auth/github-button.tsx +40 -0
- package/template/apps/web/src/components/auth/google-button.tsx +54 -0
- package/template/apps/web/src/components/auth/protected-route.tsx +66 -0
- package/template/apps/web/src/components/auth/redirect-if-authenticated.tsx +31 -0
- package/template/apps/web/src/components/auth/with-auth.tsx +30 -0
- package/template/apps/web/src/components/error/error-card.tsx +47 -0
- package/template/apps/web/src/components/error/forbidden.tsx +25 -0
- package/template/apps/web/src/components/landing/command-block.tsx +64 -0
- package/template/apps/web/src/components/landing/feature-card.tsx +60 -0
- package/template/apps/web/src/components/landing/included-feature-card.tsx +63 -0
- package/template/apps/web/src/components/landing/logo.tsx +41 -0
- package/template/apps/web/src/components/landing/tech-badge.tsx +11 -0
- package/template/apps/web/src/components/layout/auth-nav.tsx +58 -0
- package/template/apps/web/src/components/layout/footer.tsx +3 -0
- package/template/apps/web/src/config/landing-data.ts +152 -0
- package/template/apps/web/src/config/site.ts +5 -0
- package/template/apps/web/src/hooks/api/__tests__/use-users.test.tsx +181 -0
- package/template/apps/web/src/hooks/api/use-admin-sessions.ts +75 -0
- package/template/apps/web/src/hooks/api/use-admin-stats.ts +33 -0
- package/template/apps/web/src/hooks/api/use-sessions.ts +52 -0
- package/template/apps/web/src/hooks/api/use-uploads.ts +156 -0
- package/template/apps/web/src/hooks/api/use-users.ts +149 -0
- package/template/apps/web/src/hooks/use-mobile.ts +21 -0
- package/template/apps/web/src/hooks/use-realtime-metrics.ts +120 -0
- package/template/apps/web/src/lib/__tests__/utils.test.ts +29 -0
- package/template/apps/web/src/lib/api.ts +151 -0
- package/template/apps/web/src/lib/auth.ts +13 -0
- package/template/apps/web/src/lib/env.ts +52 -0
- package/template/apps/web/src/lib/form-utils.ts +11 -0
- package/template/apps/web/src/lib/utils.ts +1 -0
- package/template/apps/web/src/providers.tsx +34 -0
- package/template/apps/web/src/store/atoms.ts +15 -0
- package/template/apps/web/src/test/helpers/test-utils.tsx +44 -0
- package/template/apps/web/src/test/setup.ts +8 -0
- package/template/apps/web/tailwind.config.ts +5 -0
- package/template/apps/web/tsconfig.json +26 -0
- package/template/apps/web/vitest.config.ts +32 -0
- package/template/assets/logo-512.png +0 -0
- package/template/assets/logo.svg +4 -0
- package/template/docker-compose.prod.yml +66 -0
- package/template/docker-compose.yml +36 -0
- package/template/eslint.config.ts +119 -0
- package/template/package.json +77 -0
- package/template/packages/tailwind-config/package.json +9 -0
- package/template/packages/tailwind-config/theme.css +179 -0
- package/template/packages/types/package.json +29 -0
- package/template/packages/types/src/__tests__/schemas.test.ts +255 -0
- package/template/packages/types/src/api-response.ts +53 -0
- package/template/packages/types/src/health-check.ts +11 -0
- package/template/packages/types/src/pagination.ts +41 -0
- package/template/packages/types/src/role.ts +5 -0
- package/template/packages/types/src/session.ts +48 -0
- package/template/packages/types/src/stats.ts +113 -0
- package/template/packages/types/src/upload.ts +51 -0
- package/template/packages/types/src/user.ts +36 -0
- package/template/packages/types/tsconfig.json +5 -0
- package/template/packages/types/vitest.config.ts +21 -0
- package/template/packages/ui/components.json +21 -0
- package/template/packages/ui/package.json +108 -0
- package/template/packages/ui/src/__tests__/button.test.tsx +70 -0
- package/template/packages/ui/src/alert-dialog.tsx +141 -0
- package/template/packages/ui/src/alert.tsx +66 -0
- package/template/packages/ui/src/animated-theme-toggler.tsx +167 -0
- package/template/packages/ui/src/avatar.tsx +53 -0
- package/template/packages/ui/src/badge.tsx +36 -0
- package/template/packages/ui/src/button.tsx +84 -0
- package/template/packages/ui/src/card.tsx +92 -0
- package/template/packages/ui/src/checkbox.tsx +32 -0
- package/template/packages/ui/src/data-table/data-table-column-header.tsx +68 -0
- package/template/packages/ui/src/data-table/data-table-pagination.tsx +99 -0
- package/template/packages/ui/src/data-table/data-table-toolbar.tsx +55 -0
- package/template/packages/ui/src/data-table/data-table-view-options.tsx +63 -0
- package/template/packages/ui/src/data-table/data-table.tsx +167 -0
- package/template/packages/ui/src/dialog.tsx +143 -0
- package/template/packages/ui/src/dropdown-menu.tsx +257 -0
- package/template/packages/ui/src/empty-state.tsx +52 -0
- package/template/packages/ui/src/file-upload-input.tsx +202 -0
- package/template/packages/ui/src/form.tsx +168 -0
- package/template/packages/ui/src/hooks/use-mobile.ts +19 -0
- package/template/packages/ui/src/icons/brand-icons.tsx +16 -0
- package/template/packages/ui/src/input.tsx +21 -0
- package/template/packages/ui/src/label.tsx +24 -0
- package/template/packages/ui/src/lib/utils.ts +6 -0
- package/template/packages/ui/src/password-input.tsx +102 -0
- package/template/packages/ui/src/popover.tsx +48 -0
- package/template/packages/ui/src/radio-group.tsx +45 -0
- package/template/packages/ui/src/scroll-area.tsx +58 -0
- package/template/packages/ui/src/select.tsx +187 -0
- package/template/packages/ui/src/separator.tsx +28 -0
- package/template/packages/ui/src/sheet.tsx +139 -0
- package/template/packages/ui/src/sidebar.tsx +726 -0
- package/template/packages/ui/src/skeleton-variants.tsx +87 -0
- package/template/packages/ui/src/skeleton.tsx +13 -0
- package/template/packages/ui/src/slider.tsx +63 -0
- package/template/packages/ui/src/sonner.tsx +25 -0
- package/template/packages/ui/src/spinner.tsx +16 -0
- package/template/packages/ui/src/switch.tsx +31 -0
- package/template/packages/ui/src/table.tsx +116 -0
- package/template/packages/ui/src/tabs.tsx +66 -0
- package/template/packages/ui/src/textarea.tsx +18 -0
- package/template/packages/ui/src/tooltip.tsx +61 -0
- package/template/packages/ui/src/user-avatar.tsx +97 -0
- package/template/packages/ui/test-config.js +3 -0
- package/template/packages/ui/tsconfig.json +12 -0
- package/template/packages/ui/turbo.json +18 -0
- package/template/packages/ui/vitest.config.ts +17 -0
- package/template/packages/ui/vitest.setup.ts +1 -0
- package/template/packages/utils/package.json +23 -0
- package/template/packages/utils/src/__tests__/utils.test.ts +223 -0
- package/template/packages/utils/src/array.ts +18 -0
- package/template/packages/utils/src/async.ts +3 -0
- package/template/packages/utils/src/date.ts +77 -0
- package/template/packages/utils/src/errors.ts +73 -0
- package/template/packages/utils/src/number.ts +11 -0
- package/template/packages/utils/src/string.ts +13 -0
- package/template/packages/utils/tsconfig.json +5 -0
- package/template/packages/utils/vitest.config.ts +21 -0
- package/template/pnpm-workspace.yaml +4 -0
- package/template/tsconfig.base.json +32 -0
- package/template/turbo.json +133 -0
- package/template/vitest.shared.ts +26 -0
- package/template/vitest.workspace.ts +9 -0
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main, development]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main, development]
|
|
8
|
+
|
|
9
|
+
# Cancel in-progress runs when a new commit is pushed
|
|
10
|
+
concurrency:
|
|
11
|
+
group: ${{ github.workflow }}-${{ github.ref }}
|
|
12
|
+
cancel-in-progress: true
|
|
13
|
+
|
|
14
|
+
jobs:
|
|
15
|
+
# Fast checks that can run in parallel
|
|
16
|
+
lint:
|
|
17
|
+
runs-on: ubuntu-latest
|
|
18
|
+
steps:
|
|
19
|
+
- uses: actions/checkout@v4
|
|
20
|
+
|
|
21
|
+
- name: Setup pnpm
|
|
22
|
+
uses: pnpm/action-setup@v4
|
|
23
|
+
|
|
24
|
+
- name: Setup Node.js
|
|
25
|
+
uses: actions/setup-node@v4
|
|
26
|
+
with:
|
|
27
|
+
node-version: '20'
|
|
28
|
+
cache: 'pnpm'
|
|
29
|
+
|
|
30
|
+
- name: Install dependencies
|
|
31
|
+
run: pnpm install --frozen-lockfile
|
|
32
|
+
|
|
33
|
+
- name: Run lint
|
|
34
|
+
run: pnpm run lint
|
|
35
|
+
|
|
36
|
+
typecheck:
|
|
37
|
+
runs-on: ubuntu-latest
|
|
38
|
+
steps:
|
|
39
|
+
- uses: actions/checkout@v4
|
|
40
|
+
|
|
41
|
+
- name: Setup pnpm
|
|
42
|
+
uses: pnpm/action-setup@v4
|
|
43
|
+
|
|
44
|
+
- name: Setup Node.js
|
|
45
|
+
uses: actions/setup-node@v4
|
|
46
|
+
with:
|
|
47
|
+
node-version: '20'
|
|
48
|
+
cache: 'pnpm'
|
|
49
|
+
|
|
50
|
+
- name: Install dependencies
|
|
51
|
+
run: pnpm install --frozen-lockfile
|
|
52
|
+
|
|
53
|
+
- name: Create .env for Prisma
|
|
54
|
+
run: echo "DATABASE_URL=postgresql://user:pass@localhost:5432/db" > apps/api/.env
|
|
55
|
+
|
|
56
|
+
- name: Generate Prisma Client
|
|
57
|
+
run: pnpm --filter @repo/api db:generate
|
|
58
|
+
|
|
59
|
+
- name: Run typecheck
|
|
60
|
+
run: pnpm run typecheck --filter '!@repo/api' # FIXME: Temporary workaround because of prisma v7 issues
|
|
61
|
+
|
|
62
|
+
# Tests and build run after lint/typecheck pass
|
|
63
|
+
test:
|
|
64
|
+
runs-on: ubuntu-latest
|
|
65
|
+
needs: [lint, typecheck]
|
|
66
|
+
|
|
67
|
+
# PostgreSQL service for integration tests
|
|
68
|
+
services:
|
|
69
|
+
postgres:
|
|
70
|
+
image: postgres:17-alpine
|
|
71
|
+
env:
|
|
72
|
+
POSTGRES_USER: postgres
|
|
73
|
+
POSTGRES_PASSWORD: postgres
|
|
74
|
+
POSTGRES_DB: app_dev_test
|
|
75
|
+
POSTGRES_HOST_AUTH_METHOD: trust
|
|
76
|
+
options: >-
|
|
77
|
+
--health-cmd "pg_isready -U postgres"
|
|
78
|
+
--health-interval 10s
|
|
79
|
+
--health-timeout 5s
|
|
80
|
+
--health-retries 5
|
|
81
|
+
ports:
|
|
82
|
+
- 5432:5432
|
|
83
|
+
|
|
84
|
+
env:
|
|
85
|
+
NODE_ENV: test
|
|
86
|
+
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/app_dev
|
|
87
|
+
API_URL: http://localhost:8080
|
|
88
|
+
FRONTEND_URL: http://localhost:3000
|
|
89
|
+
PORT: 8080
|
|
90
|
+
LOG_LEVEL: minimal
|
|
91
|
+
COOKIE_SECRET: test-cookie-secret-for-ci
|
|
92
|
+
BETTER_AUTH_SECRET: test-secret-minimum-32-characters-long-for-ci
|
|
93
|
+
BETTER_AUTH_URL: http://localhost:8080
|
|
94
|
+
|
|
95
|
+
steps:
|
|
96
|
+
- uses: actions/checkout@v4
|
|
97
|
+
|
|
98
|
+
- name: Setup pnpm
|
|
99
|
+
uses: pnpm/action-setup@v4
|
|
100
|
+
|
|
101
|
+
- name: Setup Node.js
|
|
102
|
+
uses: actions/setup-node@v4
|
|
103
|
+
with:
|
|
104
|
+
node-version: '20'
|
|
105
|
+
cache: 'pnpm'
|
|
106
|
+
|
|
107
|
+
- name: Install dependencies
|
|
108
|
+
run: pnpm install --frozen-lockfile
|
|
109
|
+
|
|
110
|
+
- name: Generate Prisma Client
|
|
111
|
+
run: cd apps/api && npx prisma generate
|
|
112
|
+
|
|
113
|
+
- name: Run tests
|
|
114
|
+
run: pnpm run test
|
|
115
|
+
|
|
116
|
+
build:
|
|
117
|
+
runs-on: ubuntu-latest
|
|
118
|
+
needs: [lint, typecheck]
|
|
119
|
+
steps:
|
|
120
|
+
- uses: actions/checkout@v4
|
|
121
|
+
|
|
122
|
+
- name: Setup pnpm
|
|
123
|
+
uses: pnpm/action-setup@v4
|
|
124
|
+
|
|
125
|
+
- name: Setup Node.js
|
|
126
|
+
uses: actions/setup-node@v4
|
|
127
|
+
with:
|
|
128
|
+
node-version: '20'
|
|
129
|
+
cache: 'pnpm'
|
|
130
|
+
|
|
131
|
+
- name: Install dependencies
|
|
132
|
+
run: pnpm install --frozen-lockfile
|
|
133
|
+
|
|
134
|
+
- name: Generate Prisma Client
|
|
135
|
+
run: pnpm --filter @repo/api db:generate
|
|
136
|
+
|
|
137
|
+
- name: Setup Turborepo cache
|
|
138
|
+
uses: actions/cache@v4
|
|
139
|
+
with:
|
|
140
|
+
path: .turbo
|
|
141
|
+
key: ${{ runner.os }}-turbo-${{ github.sha }}
|
|
142
|
+
restore-keys: |
|
|
143
|
+
${{ runner.os }}-turbo-
|
|
144
|
+
|
|
145
|
+
- name: Build
|
|
146
|
+
run: pnpm run build
|
|
147
|
+
env:
|
|
148
|
+
NODE_ENV: production
|
|
149
|
+
API_URL: 'http://localhost:8080'
|
|
150
|
+
FRONTEND_URL: 'http://localhost:3000'
|
|
151
|
+
DATABASE_URL: 'postgresql://user:pass@localhost:5432/db'
|
|
152
|
+
PORT: '8080'
|
|
153
|
+
LOG_LEVEL: 'minimal'
|
|
154
|
+
COOKIE_SECRET: 'ci-test-secret-not-for-production'
|
|
155
|
+
BETTER_AUTH_SECRET: 'ci-test-secret-not-for-production'
|
|
156
|
+
BETTER_AUTH_URL: 'http://localhost:8080'
|
|
157
|
+
NEXT_PUBLIC_API_URL: 'http://localhost:8080/api'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
pnpm lint-staged
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
pnpm typecheck && pnpm test
|
package/template/.nvmrc
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
20.0.0
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"editor.formatOnSave": true,
|
|
3
|
+
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
|
4
|
+
"editor.codeActionsOnSave": {
|
|
5
|
+
"source.fixAll.eslint": "explicit"
|
|
6
|
+
},
|
|
7
|
+
"eslint.workingDirectories": [{ "mode": "auto" }],
|
|
8
|
+
"typescript.tsdk": "node_modules/typescript/lib",
|
|
9
|
+
"typescript.enablePromptUseWorkspaceTsdk": true,
|
|
10
|
+
"typescript.preferences.includePackageJsonAutoImports": "on",
|
|
11
|
+
"typescript.validate.enable": true,
|
|
12
|
+
"prisma.pinToPrisma6": false
|
|
13
|
+
}
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
# CLAUDE.md
|
|
2
|
+
|
|
3
|
+
You are a Senior Full-stack Developer and an Expert in TypeScript, Next.js 16, React 19, Fastify, Prisma v7, PostgreSQL, TailwindCSS v5, and shadcn/ui. You are collaborating with a human developer on a production-ready full-stack application.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Critical Requirements & Constraints
|
|
8
|
+
|
|
9
|
+
### Forbidden Behaviors
|
|
10
|
+
|
|
11
|
+
- NEVER create markdown files unless the user explicitly asks for it. This is very important
|
|
12
|
+
- NEVER create `index.ts` barrel files. This is a strict requirement
|
|
13
|
+
- AVOID writing comments in code unless absolutely necessary for non-obvious edge cases
|
|
14
|
+
|
|
15
|
+
### Workflow Requirements
|
|
16
|
+
|
|
17
|
+
- Make sure you aggressively prefer planning and waiting for user confirmation before writing code for medium to big tasks. This is a strict requirement
|
|
18
|
+
- If you are unsure about anything, ask the user for clarification. This is a strict requirement
|
|
19
|
+
- Prefer using commands or exec scripts (like `pnpm dlx`) for setup related tasks instead of making all the files manually. In case the command requires interactive input, ask the user to do it themselves and provide them with suitable guidance
|
|
20
|
+
|
|
21
|
+
### Collaboration Principles
|
|
22
|
+
|
|
23
|
+
- Always be unbiased towards the code, the user's preference and opinions. If you do not agree with the user, make it clear with them. Treat them like a peer
|
|
24
|
+
- Always mention alternative approaches to the user if you think it's necessary
|
|
25
|
+
- Do not be afraid of hurting the user's feelings or making them feel bad about their skills. Having well-written and maintainable code is significantly more important than cozying up to the user
|
|
26
|
+
- Always give a brief and compact summary of all the changes done
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## Common Commands
|
|
31
|
+
|
|
32
|
+
### Development Commands
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
pnpm dev
|
|
36
|
+
pnpm build
|
|
37
|
+
pnpm typecheck
|
|
38
|
+
pnpm test
|
|
39
|
+
pnpm test:unit
|
|
40
|
+
pnpm test:integration
|
|
41
|
+
pnpm lint
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Individual Package Commands
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
# Web (Next.js on port 3000)
|
|
48
|
+
cd apps/web
|
|
49
|
+
pnpm dev
|
|
50
|
+
pnpm typecheck
|
|
51
|
+
|
|
52
|
+
# API (Fastify on port 8080)
|
|
53
|
+
cd apps/api
|
|
54
|
+
pnpm dev
|
|
55
|
+
pnpm start
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Database Commands (run from `apps/api`)
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
pnpm db:generate # Generate Prisma Client
|
|
62
|
+
pnpm db:migrate # Create and apply migrations
|
|
63
|
+
pnpm db:push # Push schema changes (no migration files)
|
|
64
|
+
pnpm db:studio # Open Prisma Studio UI
|
|
65
|
+
pnpm db:seed # Seed database
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## Coding Standards
|
|
71
|
+
|
|
72
|
+
### Code Style
|
|
73
|
+
|
|
74
|
+
- Type Definitions: Prefer `interface` for public-facing types and object shapes, `type` for unions, intersections, and computed types
|
|
75
|
+
- Use descriptive variable names with auxiliary verbs (`isLoading`, `hasError`, `canSubmit`)
|
|
76
|
+
- Favor default exports for pages and named exports for utilities or functions
|
|
77
|
+
- **IMPORTANT**: Always use import aliases for files in apps. For packages, use relative imports.
|
|
78
|
+
|
|
79
|
+
### Error Handling
|
|
80
|
+
|
|
81
|
+
- Use our custom error classes from `packages/utils/src/errors.ts`
|
|
82
|
+
- Provide user-friendly error messages and avoid leaking implementation details
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
## Project Architecture
|
|
87
|
+
|
|
88
|
+
### Packages
|
|
89
|
+
|
|
90
|
+
- All packages (`@repo/packages-types`, `@repo/packages-utils`) are consumed directly as TypeScript source files
|
|
91
|
+
- No build or watch required for these packages
|
|
92
|
+
|
|
93
|
+
### Environment
|
|
94
|
+
|
|
95
|
+
- Environment variables are managed per-app with Zod validation
|
|
96
|
+
- Web: Only `NEXT_PUBLIC_*` variables are exposed to the browser
|
|
97
|
+
- Prisma CLI commands are wrapped with `dotenv-cli` to read from `.env.local`
|
|
98
|
+
|
|
99
|
+
### Database
|
|
100
|
+
|
|
101
|
+
- The API uses Prisma 7 as the ORM with PostgreSQL
|
|
102
|
+
- Prisma queries are automatically logged based on `LOG_LEVEL`
|
|
103
|
+
|
|
104
|
+
### Type Safety & Validation
|
|
105
|
+
|
|
106
|
+
- The codebase emphasizes runtime and compile-time type safety with **Zod v4 as the single validation library** across the entire stack
|
|
107
|
+
- No class-validator
|
|
108
|
+
|
|
109
|
+
### Testing
|
|
110
|
+
|
|
111
|
+
Unit Tests: `*.spec.ts`
|
|
112
|
+
Integration Tests: `*.integration.spec.ts`
|
|
113
|
+
|
|
114
|
+
### Authentication
|
|
115
|
+
|
|
116
|
+
- Uses Better Auth
|
|
117
|
+
- When creating test users with password auth, set `accountId` to the user's email (not user.id)
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
## Web Architecture Patterns
|
|
122
|
+
|
|
123
|
+
### State Management
|
|
124
|
+
|
|
125
|
+
- TanStack Query (React Query): For API calls and data synchronization
|
|
126
|
+
- Jotai: For client-side global state (UI state, user preferences)
|
|
127
|
+
|
|
128
|
+
### API Integration
|
|
129
|
+
|
|
130
|
+
- API config centralized in `apps/web/src/lib/api.ts`
|
|
131
|
+
- **API Response Unwrapping**: The `api.ts` fetcher unwraps `{ data: T }` to `T` but preserves `{ data: T[], pagination: {...} }` responses intact
|
|
132
|
+
|
|
133
|
+
### Authentication & Protected Routes
|
|
134
|
+
|
|
135
|
+
The web app uses Better Auth for authentication with modern patterns:
|
|
136
|
+
|
|
137
|
+
- **Auth Client**: Configured in `apps/web/src/lib/auth.ts`
|
|
138
|
+
- Provides `useSession()` hook for accessing current user/session
|
|
139
|
+
- Handles sign in/out, session persistence via cookies
|
|
140
|
+
- **Protected Routes**: `<ProtectedRoute>` wrapper component for page-level protection
|
|
141
|
+
|
|
142
|
+
### UI Component Patterns
|
|
143
|
+
|
|
144
|
+
- Use Shadcn UI components as base, extend them before creating custom ones
|
|
145
|
+
- Implement thoughtful micro-interactions and hover states wherever needed
|
|
146
|
+
- Use Framer Motion for animations, Lucide React for icons
|
|
147
|
+
- Prefer using `Skeleton` components for loading states instead of spinners (especially for data fetching components)
|
|
148
|
+
- Always create a proper loading state for data fetching components.
|
|
149
|
+
- Always use `cn` helper for class name merging
|
|
150
|
+
- Never write svg code. Always use existing icons from code or Lucide.
|
|
151
|
+
|
|
152
|
+
---
|
|
153
|
+
|
|
154
|
+
## API Architecture Patterns
|
|
155
|
+
|
|
156
|
+
### Fastify Structure
|
|
157
|
+
|
|
158
|
+
- The Fastify API follows a plugin-based architecture
|
|
159
|
+
- Validation: Zod schemas directly in route definitions via `fastify-type-provider-zod`
|
|
160
|
+
- Dependency Injection: Manual DI via Fastify decorators
|
|
161
|
+
|
|
162
|
+
### Logging
|
|
163
|
+
|
|
164
|
+
- The API uses Pino for structured logging with request tracing
|
|
165
|
+
- Verbosity controlled by `LOG_LEVEL` env var: `minimal` | `normal` | `detailed` | `verbose`
|
|
166
|
+
- **IMPORTANT**: Never use `console.log` in the API. Use the logger service instead
|
|
167
|
+
|
|
168
|
+
**Log Methods:**
|
|
169
|
+
|
|
170
|
+
- `logger.info(message, context?)` - Standard information
|
|
171
|
+
- `logger.error(message, error?, context?)` - Errors with automatic Error serialization
|
|
172
|
+
- `logger.warn(message, context?)` - Warnings
|
|
173
|
+
- `logger.debug(message, context?)` - Debug information (detailed+ level)
|
|
174
|
+
- `logger.trace(message, context?)` - Trace logs (verbose level only)
|
|
175
|
+
- `logger.perf(message, metrics)` - Performance metrics
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Contributing to Blitzpack
|
|
2
|
+
|
|
3
|
+
Thank you for your interest in contributing! This is a TypeScript monorepo template designed to help developers ship full-stack applications super fast.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Setup
|
|
8
|
+
|
|
9
|
+
1. Fork and clone the repository
|
|
10
|
+
2. Run `pnpm install && pnpm init:project`
|
|
11
|
+
3. Start development: `pnpm dev`
|
|
12
|
+
|
|
13
|
+
## Development
|
|
14
|
+
|
|
15
|
+
1. Create a feature branch: `git checkout -b feature/your-feature`
|
|
16
|
+
2. Make changes following the code style in `CLAUDE.md`
|
|
17
|
+
3. Run checks: `pnpm typecheck && pnpm lint && pnpm test && pnpm build`
|
|
18
|
+
4. Commit like a sane person
|
|
19
|
+
5. Push and create a Pull request
|
|
20
|
+
|
|
21
|
+
## Code Style
|
|
22
|
+
|
|
23
|
+
- Follow patterns in `CLAUDE.md`
|
|
24
|
+
- Always use import aliases (`@/...`)
|
|
25
|
+
|
|
26
|
+
## Pull Requests
|
|
27
|
+
|
|
28
|
+
- Rebase on latest main before submitting
|
|
29
|
+
- Ensure all CI checks pass
|
|
30
|
+
- Update documentation if needed
|
|
31
|
+
|
|
32
|
+
For detailed architecture and patterns, see `CLAUDE.md`.
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# Multi-stage Dockerfile for API deployment
|
|
2
|
+
# Optimized for pnpm monorepo with Prisma
|
|
3
|
+
|
|
4
|
+
# Stage 1: Dependencies
|
|
5
|
+
FROM node:22-alpine AS deps
|
|
6
|
+
RUN apk add --no-cache libc6-compat openssl
|
|
7
|
+
|
|
8
|
+
# Install pnpm
|
|
9
|
+
RUN corepack enable && corepack prepare pnpm@9.15.4 --activate
|
|
10
|
+
|
|
11
|
+
WORKDIR /app
|
|
12
|
+
|
|
13
|
+
# Copy workspace files
|
|
14
|
+
COPY pnpm-workspace.yaml package.json pnpm-lock.yaml ./
|
|
15
|
+
|
|
16
|
+
# Copy all package.json files for workspace dependencies
|
|
17
|
+
COPY apps/api/package.json apps/api/
|
|
18
|
+
COPY packages/types/package.json packages/types/
|
|
19
|
+
COPY packages/utils/package.json packages/utils/
|
|
20
|
+
|
|
21
|
+
# Install dependencies (frozen lockfile for reproducible builds)
|
|
22
|
+
RUN pnpm install --frozen-lockfile --prod=false
|
|
23
|
+
|
|
24
|
+
# Stage 2: Builder
|
|
25
|
+
FROM node:22-alpine AS builder
|
|
26
|
+
RUN apk add --no-cache libc6-compat openssl
|
|
27
|
+
|
|
28
|
+
RUN corepack enable && corepack prepare pnpm@9.15.4 --activate
|
|
29
|
+
|
|
30
|
+
WORKDIR /app
|
|
31
|
+
|
|
32
|
+
# Copy installed dependencies from deps stage
|
|
33
|
+
COPY --from=deps /app/node_modules ./node_modules
|
|
34
|
+
COPY --from=deps /app/apps/api/node_modules ./apps/api/node_modules
|
|
35
|
+
COPY --from=deps /app/packages/types/node_modules ./packages/types/node_modules
|
|
36
|
+
COPY --from=deps /app/packages/utils/node_modules ./packages/utils/node_modules
|
|
37
|
+
|
|
38
|
+
# Copy source code
|
|
39
|
+
COPY . .
|
|
40
|
+
|
|
41
|
+
# Build shared packages first (types and utils)
|
|
42
|
+
RUN pnpm --filter @repo/packages-types build
|
|
43
|
+
RUN pnpm --filter @repo/packages-utils build
|
|
44
|
+
|
|
45
|
+
# Generate Prisma Client
|
|
46
|
+
RUN pnpm --filter @repo/api db:generate
|
|
47
|
+
|
|
48
|
+
# Build the API
|
|
49
|
+
RUN pnpm --filter @repo/api build
|
|
50
|
+
|
|
51
|
+
# Stage 3: Runner (production)
|
|
52
|
+
FROM node:22-alpine AS runner
|
|
53
|
+
RUN apk add --no-cache openssl
|
|
54
|
+
|
|
55
|
+
RUN corepack enable && corepack prepare pnpm@9.15.4 --activate
|
|
56
|
+
|
|
57
|
+
WORKDIR /app
|
|
58
|
+
|
|
59
|
+
# Create non-root user for security
|
|
60
|
+
RUN addgroup --system --gid 1001 nodejs && \
|
|
61
|
+
adduser --system --uid 1001 fastify
|
|
62
|
+
|
|
63
|
+
# Copy necessary files from builder
|
|
64
|
+
COPY --from=builder --chown=fastify:nodejs /app/apps/api/dist ./apps/api/dist
|
|
65
|
+
COPY --from=builder --chown=fastify:nodejs /app/apps/api/package.json ./apps/api/
|
|
66
|
+
COPY --from=builder --chown=fastify:nodejs /app/apps/api/prisma ./apps/api/prisma
|
|
67
|
+
COPY --from=builder --chown=fastify:nodejs /app/apps/api/start.sh ./apps/api/
|
|
68
|
+
COPY --from=builder --chown=fastify:nodejs /app/packages ./packages
|
|
69
|
+
COPY --from=builder --chown=fastify:nodejs /app/node_modules ./node_modules
|
|
70
|
+
COPY --from=builder --chown=fastify:nodejs /app/apps/api/node_modules ./apps/api/node_modules
|
|
71
|
+
COPY --from=builder --chown=fastify:nodejs /app/package.json ./package.json
|
|
72
|
+
COPY --from=builder --chown=fastify:nodejs /app/pnpm-workspace.yaml ./pnpm-workspace.yaml
|
|
73
|
+
|
|
74
|
+
# Make start script executable
|
|
75
|
+
RUN chmod +x /app/apps/api/start.sh
|
|
76
|
+
|
|
77
|
+
# Switch to non-root user
|
|
78
|
+
USER fastify
|
|
79
|
+
|
|
80
|
+
WORKDIR /app/apps/api
|
|
81
|
+
|
|
82
|
+
# Expose the API port
|
|
83
|
+
EXPOSE 8080
|
|
84
|
+
|
|
85
|
+
# Health check
|
|
86
|
+
HEALTHCHECK --interval=30s --timeout=3s --start-period=10s --retries=3 \
|
|
87
|
+
CMD node -e "require('http').get('http://localhost:8080/health', (r) => {process.exit(r.statusCode === 200 ? 0 : 1)})"
|
|
88
|
+
|
|
89
|
+
# Start command (handles database wake-up, runs migrations, then starts server)
|
|
90
|
+
CMD ["/app/apps/api/start.sh"]
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Blitzpack Template Setup
|
|
2
|
+
|
|
3
|
+
After clicking "Use this template" and cloning your repository:
|
|
4
|
+
|
|
5
|
+
## Quick Start (Use As-Is)
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pnpm install
|
|
9
|
+
pnpm init:project
|
|
10
|
+
pnpm dev
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
**That's it!** The template works out of the box. Customize when ready.
|
|
14
|
+
|
|
15
|
+
## When You're Ready to Customize
|
|
16
|
+
|
|
17
|
+
### Update Branding
|
|
18
|
+
|
|
19
|
+
- `apps/web/src/config/site.ts` → Project name, description, GitHub URL
|
|
20
|
+
- `README.md` → Replace Blitzpack README.md with yours
|
|
21
|
+
|
|
22
|
+
### Optional: Change Database Credentials
|
|
23
|
+
|
|
24
|
+
Default credentials: `postgres/postgres_dev_password/app_dev`
|
|
25
|
+
|
|
26
|
+
To use different credentials:
|
|
27
|
+
|
|
28
|
+
1. Update `docker-compose.yml` (POSTGRES_USER, POSTGRES_PASSWORD, POSTGRES_DB)
|
|
29
|
+
2. Update `apps/api/.env.local` (DATABASE_URL must match step 1)
|
|
30
|
+
3. Restart Docker: `docker compose down && docker compose up -d`
|
|
31
|
+
4. Run migrations: `pnpm --filter @repo/api db:migrate`
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
**Delete this file when done.**
|
package/template/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Arman Ganjoo
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
<img src="assets/logo.svg" alt="Blitzpack Logo" width="200">
|
|
3
|
+
<h1>Blitzpack</h1>
|
|
4
|
+
<p>Full-stack TypeScript monorepo template with Next.js, Fastify, and Turborepo. From zero to production in minutes.</p>
|
|
5
|
+
|
|
6
|
+
[](LICENSE)
|
|
7
|
+
[](https://nodejs.org/)
|
|
8
|
+
[](https://pnpm.io/)
|
|
9
|
+
[](https://www.typescriptlang.org/)
|
|
10
|
+
[](https://github.com/CarboxyDev/blitzpack/actions/workflows/ci.yml)
|
|
11
|
+
|
|
12
|
+
</div>
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## Why Blitzpack?
|
|
17
|
+
|
|
18
|
+
Stop wasting days bootstrapping your next project. Most templates hand you a skeleton and leave you to figure out database migrations, API documentation, logging infrastructure, and much more. Blitzpack ships with all of it configured and working. You just need to run a single script to get started with a production-ready full-stack application.
|
|
19
|
+
|
|
20
|
+
**Ship your next project faster with battle-tested infrastructure already wired up.**
|
|
21
|
+
|
|
22
|
+
- **Zero-config setup**: Run one command and you're ready to code. Environment files, Docker containers, database migrations—all handled automatically.
|
|
23
|
+
|
|
24
|
+
- **Full-stack type safety**: Zod schemas define your API contracts once in `packages/types`, then flow automatically to web forms, API validation, and database queries. No duplicate validation logic.
|
|
25
|
+
|
|
26
|
+
- **Production-grade infrastructure**: Better-auth with session management and OAuth ready. Request ID tracing, automatic validation, rate limiting, structured logging, and environment-aware error responses out of the box.
|
|
27
|
+
|
|
28
|
+
- **AI pair programming ready**: Comprehensive CLAUDE.md file means AI assistants understand your architecture instantly and can accelerate your development.
|
|
29
|
+
|
|
30
|
+
## Tech Stack
|
|
31
|
+
|
|
32
|
+
**Web:** Next.js, React, TanStack Query, Tailwind CSS
|
|
33
|
+
|
|
34
|
+
**Backend:** Fastify, Prisma, PostgreSQL
|
|
35
|
+
|
|
36
|
+
**Monorepo:** Turborepo, pnpm workspaces
|
|
37
|
+
|
|
38
|
+
<details>
|
|
39
|
+
<summary>Full stack details</summary>
|
|
40
|
+
|
|
41
|
+
<p>
|
|
42
|
+
|
|
43
|
+
**Web**
|
|
44
|
+
|
|
45
|
+
- Next.js 16 + React 19
|
|
46
|
+
- TanStack Query v5 for server state
|
|
47
|
+
- shadcn/ui + Tailwind CSS v4
|
|
48
|
+
- React Hook Form + Zod validation
|
|
49
|
+
- Jotai for client state
|
|
50
|
+
|
|
51
|
+
**API**
|
|
52
|
+
|
|
53
|
+
- Fastify 5
|
|
54
|
+
- Prisma 7 + PostgreSQL 17
|
|
55
|
+
- Better-auth for authentication
|
|
56
|
+
- Pino for logging
|
|
57
|
+
- Scalar API docs
|
|
58
|
+
- Helmet + rate limiting
|
|
59
|
+
|
|
60
|
+
**Monorepo**
|
|
61
|
+
|
|
62
|
+
- pnpm workspaces + Turborepo
|
|
63
|
+
- Shared packages for types, utils, config in `packages/`
|
|
64
|
+
- Vitest for testing
|
|
65
|
+
- Husky + lint-staged for pre-commit hooks
|
|
66
|
+
</p>
|
|
67
|
+
</details>
|
|
68
|
+
|
|
69
|
+
## Quick Start
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
# Install dependencies
|
|
73
|
+
pnpm install
|
|
74
|
+
|
|
75
|
+
# Automated setup (creates .env files, starts docker, runs migrations)
|
|
76
|
+
pnpm init:project
|
|
77
|
+
|
|
78
|
+
# Start development
|
|
79
|
+
pnpm dev
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
The setup script handles everything: environment files, docker containers, database migrations, and optional seeding. Safe to run multiple times.
|
|
83
|
+
|
|
84
|
+
You must have docker installed and running on your machine.
|
|
85
|
+
|
|
86
|
+
**What's running:**
|
|
87
|
+
|
|
88
|
+
- Web: [http://localhost:3000](http://localhost:3000)
|
|
89
|
+
- API: [http://localhost:8080/api](http://localhost:8080/api)
|
|
90
|
+
- API Docs: [http://localhost:8080/docs](http://localhost:8080/docs)
|
|
91
|
+
- Health Check: [http://localhost:8080/health](http://localhost:8080/health)
|
|
92
|
+
|
|
93
|
+
**Database tools:**
|
|
94
|
+
|
|
95
|
+
- Prisma Studio: Run `pnpm db:studio` to open [http://localhost:5555](http://localhost:5555) (recommended for data inspection)
|
|
96
|
+
|
|
97
|
+
**Built-in pages:**
|
|
98
|
+
|
|
99
|
+
- `/examples` - Component examples
|
|
100
|
+
- `/dashboard` - Protected user dashboard
|
|
101
|
+
- `/login` - Sign in page
|
|
102
|
+
- `/signup` - Create new account
|
|
103
|
+
- `/forgot-password` - Forgot password page
|
|
104
|
+
- `/reset-password` - Reset password page
|
|
105
|
+
|
|
106
|
+
## Project Structure
|
|
107
|
+
|
|
108
|
+
```
|
|
109
|
+
blitzpack/
|
|
110
|
+
├── apps/
|
|
111
|
+
│ ├── web/ # Next.js app
|
|
112
|
+
│ └── api/ # Fastify API
|
|
113
|
+
└── packages/
|
|
114
|
+
├── types/ # Zod schemas + inferred types
|
|
115
|
+
└── utils/ # Shared utilities
|
|
116
|
+
```
|