business-stack 0.1.0 → 0.1.1
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 +106 -0
- package/bin/business-stack.cjs +1 -1
- package/package.json +2 -1
package/README.md
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
# business-stack
|
|
2
|
+
|
|
3
|
+
Single npm package bundling a **Next.js** app, **Hono** gateway (Better Auth, integrations, authenticated proxy to FastAPI), and **FastAPI** backend. Turborepo runs web, gateway, and backend together.
|
|
4
|
+
|
|
5
|
+
## Prerequisites
|
|
6
|
+
|
|
7
|
+
Install these on your machine and ensure they are on your `PATH`:
|
|
8
|
+
|
|
9
|
+
| Tool | Purpose |
|
|
10
|
+
|------|---------|
|
|
11
|
+
| [Node.js](https://nodejs.org/) 20+ | Runs the `business-stack` CLI (`setup`, `start`, `doctor`) |
|
|
12
|
+
| [Bun](https://bun.sh) | Installs JS workspaces and runs the gateway |
|
|
13
|
+
| [uv](https://docs.astral.sh/uv/) | Installs and runs the Python backend |
|
|
14
|
+
| Python **3.12** | Required by the backend (managed via `uv`) |
|
|
15
|
+
|
|
16
|
+
Check your environment:
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
npx business-stack doctor
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Installation (recommended: project-level)
|
|
23
|
+
|
|
24
|
+
**Prefer a local (project) install** so the stack, generated `.env` files, and SQLite database live under your project’s `node_modules/business-stack/`, match npm’s default `npm i business-stack`, and avoid permission or PATH issues from global installs.
|
|
25
|
+
|
|
26
|
+
### 1. Create or use a project directory
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
mkdir my-stack && cd my-stack
|
|
30
|
+
npm init -y
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### 2. Install the package locally
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
npm install business-stack
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
This installs the full app tree at `node_modules/business-stack/` (Next app, gateway, backend sources).
|
|
40
|
+
|
|
41
|
+
### 3. Run the CLI via `npx` (or package scripts)
|
|
42
|
+
|
|
43
|
+
From the **same directory** as your `package.json` (so npm resolves the local install):
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
npx business-stack doctor
|
|
47
|
+
npx business-stack setup --yes
|
|
48
|
+
npx business-stack start
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
- **`setup`** generates secrets, stores them in SQLite (`node_modules/business-stack/gateway/auth.sqlite`, table `stack_secrets`), and writes `gateway/.env`, `frontend/web/.env.local`, and `backend/.env` under that package path. You do not need to create `.env` files by hand.
|
|
52
|
+
- **`start`** runs `bun install`, `uv sync`, production build, Alembic migrations, then starts Next (`next start`), the gateway, and uvicorn. First run can take several minutes.
|
|
53
|
+
|
|
54
|
+
Optional flags for `start`: `--skip-install`, `--skip-build`, `--skip-migrate`.
|
|
55
|
+
|
|
56
|
+
Development servers (hot reload) instead of production:
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
npx business-stack dev
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### 4. Optional: npm scripts in your `package.json`
|
|
63
|
+
|
|
64
|
+
```json
|
|
65
|
+
{
|
|
66
|
+
"scripts": {
|
|
67
|
+
"stack:doctor": "business-stack doctor",
|
|
68
|
+
"stack:setup": "business-stack setup --yes",
|
|
69
|
+
"stack:start": "business-stack start",
|
|
70
|
+
"stack:dev": "business-stack dev"
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
After a local install, npm adds `node_modules/.bin/business-stack`, so these scripts work without `npx`.
|
|
76
|
+
|
|
77
|
+
## Global install (optional)
|
|
78
|
+
|
|
79
|
+
If you want the `business-stack` command on your PATH for every shell:
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
npm install -g business-stack
|
|
83
|
+
business-stack doctor
|
|
84
|
+
business-stack setup --yes
|
|
85
|
+
business-stack start
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Files and secrets are then under your global npm prefix (for example `%AppData%\npm\node_modules\business-stack` on Windows). Use global install only if you are comfortable with that layout and upgrades overwriting the same tree.
|
|
89
|
+
|
|
90
|
+
## Default URLs
|
|
91
|
+
|
|
92
|
+
| Service | URL |
|
|
93
|
+
|---------|-----|
|
|
94
|
+
| Web (Next) | `http://127.0.0.1:3000` |
|
|
95
|
+
| Gateway | `http://127.0.0.1:3001` |
|
|
96
|
+
| FastAPI | `http://127.0.0.1:8000` |
|
|
97
|
+
|
|
98
|
+
`setup` uses these by default; interactive `business-stack setup` (without `--yes`) prompts for URLs.
|
|
99
|
+
|
|
100
|
+
## Security note
|
|
101
|
+
|
|
102
|
+
Secrets in `stack_secrets` and generated `.env` files are **plaintext at rest**, like a normal `.env`. Protect the install directory and do not commit `gateway/.env`, `frontend/web/.env.local`, `backend/.env`, or `*.sqlite`.
|
|
103
|
+
|
|
104
|
+
## License
|
|
105
|
+
|
|
106
|
+
See `package.json` (`license` field).
|
package/bin/business-stack.cjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "business-stack",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Next.js + Hono gateway + FastAPI monorepo",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"packageManager": "bun@1.3.1",
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
"business-stack": "bin/business-stack.cjs"
|
|
16
16
|
},
|
|
17
17
|
"files": [
|
|
18
|
+
"README.md",
|
|
18
19
|
"bin",
|
|
19
20
|
"turbo.json",
|
|
20
21
|
".python-version",
|