@pradip1995/create-storefront-app 0.2.2 → 0.3.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.
Files changed (53) hide show
  1. package/bin/create-storefront-app.js +149 -53
  2. package/lib/build-backend-package.js +54 -0
  3. package/lib/build-homepage-defaults.cjs +50 -0
  4. package/lib/deps.js +3 -1
  5. package/lib/docker-template-vars.js +32 -0
  6. package/lib/medusa-plugin-versions.json +55 -0
  7. package/lib/scaffold-backend.js +107 -0
  8. package/lib/scaffold-docker.js +82 -0
  9. package/lib/versions.js +4 -3
  10. package/package.json +3 -2
  11. package/templates/backend/.cursor/commands/seed-backend.md +16 -0
  12. package/templates/backend/.cursor/rules/medusa-backend.mdc +55 -0
  13. package/templates/backend/config/README.md +21 -0
  14. package/templates/backend/config/homepage-config.json +568 -0
  15. package/templates/backend/env.template +53 -0
  16. package/templates/backend/gitignore +8 -0
  17. package/templates/backend/medusa-config.full.ts +251 -0
  18. package/templates/backend/medusa-config.minimal.ts +141 -0
  19. package/templates/backend/scripts/build-dynamic-config-defaults.mjs +25 -0
  20. package/templates/backend/scripts/build-homepage-defaults.cjs +50 -0
  21. package/templates/backend/src/config/product-metadata-descriptors.ts +27 -0
  22. package/templates/backend/src/scripts/seed.ts +212 -0
  23. package/templates/backend/tsconfig.json +24 -0
  24. package/templates/docker/Makefile +86 -0
  25. package/templates/docker/backend/.dockerignore +8 -0
  26. package/templates/docker/backend/Dockerfile +30 -0
  27. package/templates/docker/data/README.md +12 -0
  28. package/templates/docker/data/dump.sql +3 -0
  29. package/templates/docker/docker/.env.example +36 -0
  30. package/templates/docker/docker/frontend.build.defaults +7 -0
  31. package/templates/docker/docker/gitignore +1 -0
  32. package/templates/docker/docker/postgres/01-create-postgres-role.sql +9 -0
  33. package/templates/docker/docker/postgres/docker-entrypoint-wrapper.sh +49 -0
  34. package/templates/docker/docker-compose.infra.yml +64 -0
  35. package/templates/docker/docker-compose.yml +138 -0
  36. package/templates/docker/storefront/.dockerignore +9 -0
  37. package/templates/docker/storefront/Dockerfile +53 -0
  38. package/templates/root/.cursor/commands/docker-dev.md +32 -0
  39. package/templates/root/.cursor/rules/monorepo-layout.mdc +55 -0
  40. package/templates/shared/.cursor/commands/change-theme-colors.md +28 -0
  41. package/templates/shared/.cursor/commands/fix-segment-issue.md +56 -0
  42. package/templates/shared/.cursor/commands/rebuild-storefront.md +19 -0
  43. package/templates/shared/.cursor/commands/update-home-sections.md +50 -0
  44. package/templates/shared/.cursor/rules/customize-sections.mdc +49 -0
  45. package/templates/shared/.cursor/rules/customize-theme.mdc +57 -0
  46. package/templates/shared/.cursor/rules/storefront-architecture.mdc +41 -0
  47. package/templates/shared/.cursor/skills/customize-storefront-theme/SKILL.md +47 -0
  48. package/templates/shared/.cursor/skills/fix-segment-issues/SKILL.md +68 -0
  49. package/templates/shared/.cursor/skills/update-storefront-sections/SKILL.md +52 -0
  50. package/templates/shared/README.md +100 -0
  51. package/templates/shared/root-gitignore +6 -0
  52. package/templates/shared/storefront-only-README.md +25 -0
  53. package/templates/shared/theme-overrides.css +16 -0
@@ -0,0 +1,100 @@
1
+ # {{PROJECT_NAME}}
2
+
3
+ Full-stack Medusa shop: **backend** (Medusa v2) + **storefront** (segment-based Next.js).
4
+
5
+ Run **with Docker**, **Docker infra + local Node**, or **fully local** (PostgreSQL + Redis on host).
6
+
7
+ ## Prerequisites
8
+
9
+ - **Node.js 20+**
10
+ - **npm 9+**
11
+ - **Docker Desktop** (optional — for `make up` / `make up-infra`)
12
+ - **PostgreSQL + Redis** on host when running fully local without Docker infra
13
+
14
+ All `@pradip1995/*` packages and Medusa plugins resolve from the **public npm registry** — no monorepo or private registry required.
15
+
16
+ ## Option A — Full stack in Docker
17
+
18
+ ```bash
19
+ make env-init # docker/.env from example (already created on scaffold)
20
+ make up # build + start postgres, redis, mailpit, backend, storefront
21
+ make migrate # DB migrations (fresh DB may need two runs)
22
+ make seed # region, publishable key, sample product
23
+ make admin-create
24
+ ```
25
+
26
+ | Service | URL |
27
+ |------------|-----|
28
+ | Storefront | {{BASE_URL}}/{{DEFAULT_REGION}} |
29
+ | Admin | {{BACKEND_URL}}/app |
30
+ | API | {{BACKEND_URL}} |
31
+ | Mailpit | http://localhost:8025 |
32
+
33
+ After `make seed`, update `docker/frontend.build.defaults` and `storefront/.env.local` with the publishable key, then `make build-storefront` if using Docker for the storefront.
34
+
35
+ Default admin: `make admin-create` (see `Makefile` for `ADMIN_EMAIL` / `ADMIN_PASSWORD`).
36
+
37
+ ## Option B — Docker infra + local Node dev
38
+
39
+ ```bash
40
+ make up-infra # postgres, redis, mailpit only
41
+ npm run dev:backend # terminal 1 — uses backend/.env DATABASE_URL
42
+ npm run seed # from project root, or cd backend && npm run seed
43
+ npm run dev:storefront # terminal 2
44
+ ```
45
+
46
+ `backend/.env` `DATABASE_URL` matches Docker postgres credentials from scaffold.
47
+
48
+ For OTP/email in local backend with infra Docker, set `SMTP_HOST=localhost` and `SMTP_PORT=1025` (Mailpit exposes SMTP when using `docker-compose.infra.yml`).
49
+
50
+ ## Option C — Fully local (no Docker)
51
+
52
+ ```bash
53
+ cd backend && npm install
54
+ # Edit .env — PostgreSQL + Redis on localhost
55
+ npm run dev
56
+ npm run seed
57
+
58
+ cd ../storefront && npm install
59
+ # Edit .env.local — publishable key from Admin
60
+ npm run dev
61
+ ```
62
+
63
+ ## Daily dev (local Node)
64
+
65
+ ```bash
66
+ npm run dev:backend # terminal 1
67
+ npm run dev:storefront # terminal 2
68
+ ```
69
+
70
+ ## Build production
71
+
72
+ ```bash
73
+ npm run build:backend
74
+ npm run build:storefront
75
+ # or
76
+ make build
77
+ ```
78
+
79
+ ## Docker commands
80
+
81
+ ```bash
82
+ make help # all targets
83
+ make up-infra # postgres + redis + mailpit
84
+ make up-backend # infra + backend container
85
+ make logs # tail logs
86
+ make db-shell # psql
87
+ make clean # remove containers + volumes
88
+ ```
89
+
90
+ ## Customize
91
+
92
+ | Goal | Where |
93
+ |------|--------|
94
+ | Home sections | `storefront/pages.config.json` |
95
+ | Colors / fonts | `storefront/theme-overrides.css` |
96
+ | Medusa plugins | `backend/medusa-config.ts` + `backend/config/medusa-plugin-versions.json` |
97
+ | Homepage admin fields | `backend/config/homepage-config.json` |
98
+ | Docker secrets | `docker/.env` |
99
+
100
+ Cursor guides: `.cursor/` in each folder.
@@ -0,0 +1,6 @@
1
+ node_modules
2
+ .DS_Store
3
+ *.log
4
+ .env
5
+ .env.local
6
+ docker/.env
@@ -0,0 +1,25 @@
1
+ # {{PROJECT_NAME}}
2
+
3
+ Segment-based Medusa storefront (config client).
4
+
5
+ ## Setup
6
+
7
+ ```bash
8
+ npm install
9
+ # Edit .env.local — Medusa URL + publishable key
10
+ npm run dev
11
+ ```
12
+
13
+ Storefront: {{BASE_URL}}/{{DEFAULT_REGION}}
14
+
15
+ ## Customize
16
+
17
+ | Goal | File |
18
+ |------|------|
19
+ | Home sections | `pages.config.json` |
20
+ | Colors / fonts | `theme-overrides.css` |
21
+ | Brand assets | `public/` |
22
+
23
+ After config changes: `npm run storefront:build && npm run dev`
24
+
25
+ Cursor guides: `.cursor/`
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Brand color & font overrides.
3
+ * Copied into .generated-app on each `npm run storefront:build`.
4
+ * Override CSS variables from @pradip1995/segment-tokens/themes/impulse.css
5
+ */
6
+ :root {
7
+ /* Example — uncomment and edit:
8
+ --color-brand-accent: #5a2a43;
9
+ --color-brand-accent-hover: #723a56;
10
+ --color-brand-pink: #c68a8a;
11
+ --color-page-bg: #ffffff;
12
+ --color-footer-bg: #1a1a1a;
13
+ --font-sans: "Montserrat", sans-serif;
14
+ --font-heading: "Playfair Display", serif;
15
+ */
16
+ }