umpordez 1.0.1 → 1.0.2
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 +1 -1
- package/package.json +1 -1
- package/template/README.md +128 -0
package/README.md
CHANGED
package/package.json
CHANGED
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
# {{PROJECT_NAME}}
|
|
2
|
+
|
|
3
|
+
{{PROJECT_DESCRIPTION}}
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Quick start
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
./install.sh # install all deps
|
|
11
|
+
./seed.sh # create db + migrate + seed admin user
|
|
12
|
+
./dev.sh # start everything (Ctrl+C to stop)
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Admin panel: `http://localhost:{{ADMIN_UI_PORT}}`
|
|
16
|
+
Admin API: `http://localhost:{{API_PORT}}`
|
|
17
|
+
Site: `http://localhost:{{SITE_PORT}}`
|
|
18
|
+
|
|
19
|
+
## How it works
|
|
20
|
+
|
|
21
|
+
Multi-tenant SaaS; users can belong to multiple accounts with
|
|
22
|
+
different roles. Each request gets a fresh Context with all models
|
|
23
|
+
instantiated (no singletons, no global state).
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
users (global identity)
|
|
27
|
+
|
|
|
28
|
+
user_in_accounts (user_id + account_id + role)
|
|
29
|
+
|
|
|
30
|
+
accounts (tenant)
|
|
31
|
+
|
|
|
32
|
+
[your domain entities scoped by account_id]
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Roles: `admin` (platform-wide), `owner`, `manager`, `user`
|
|
36
|
+
|
|
37
|
+
For the full architecture details, patterns and how-tos see
|
|
38
|
+
[architecture.md](architecture.md). For coding standards and style
|
|
39
|
+
rules see [code.md](code.md).
|
|
40
|
+
|
|
41
|
+
## Project structure
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
server/
|
|
45
|
+
apps/api/ Admin API (Express, port {{API_PORT}})
|
|
46
|
+
routes/ auth, user, account, admin, files
|
|
47
|
+
apps/site-api/ Public API (Express, port {{SITE_API_PORT}})
|
|
48
|
+
routes/ public endpoints
|
|
49
|
+
apps/shared/ Shared middlewares + buildHandler
|
|
50
|
+
core/ Business logic
|
|
51
|
+
context.ts DI container (fresh per request)
|
|
52
|
+
models/ One model per entity (extends BaseModel)
|
|
53
|
+
db.ts Knex wrapper
|
|
54
|
+
s3.ts S3 uploads + signed URLs
|
|
55
|
+
email.ts Nodemailer + HTML templates
|
|
56
|
+
errors.ts AppError hierarchy (400, 401, 403, 404, 409)
|
|
57
|
+
console/ Task runner
|
|
58
|
+
tasks/ One file per task (seed-admin, etc.)
|
|
59
|
+
migrations/ Raw SQL (Knex)
|
|
60
|
+
emails/ HTML email templates
|
|
61
|
+
|
|
62
|
+
ui/admin/ React SPA (Vite, port {{ADMIN_UI_PORT}})
|
|
63
|
+
src/
|
|
64
|
+
pages/ public/, user/, admin/, account/
|
|
65
|
+
layouts/ One layout per scope
|
|
66
|
+
components/ui/ shadcn/ui (Radix + Tailwind)
|
|
67
|
+
hooks/queries/ React Query hooks per entity
|
|
68
|
+
lib/ fetchApi, query-keys, utils
|
|
69
|
+
|
|
70
|
+
ui/site/ Public site (Express + EJS, port {{SITE_PORT}})
|
|
71
|
+
views/ EJS templates
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Commands
|
|
75
|
+
|
|
76
|
+
### Server (from `server/`)
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
npm run dev # admin API with hot-reload
|
|
80
|
+
npm run dev:site-api # site API with hot-reload
|
|
81
|
+
npm run build # TypeScript compilation
|
|
82
|
+
npm run migrate:latest # run pending migrations
|
|
83
|
+
npm run migrate:rollback # rollback last batch
|
|
84
|
+
npm run migrate:make NAME # create new migration
|
|
85
|
+
npm run console -- --task=TASK_NAME
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Admin UI (from `ui/admin/`)
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
npm run dev # Vite dev server
|
|
92
|
+
npm run build # production build
|
|
93
|
+
npm run lint # ESLint
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### Site (from `ui/site/`)
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
npm run dev # Express + Tailwind watcher
|
|
100
|
+
npm run build # production build
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### Production build
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
umpordez build ../app ../builds # compile + move artifacts
|
|
107
|
+
umpordez build-deps ../builds # install prod deps on target
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## Tech stack
|
|
111
|
+
|
|
112
|
+
| What | How |
|
|
113
|
+
|-------------|-----|
|
|
114
|
+
| Backend | TypeScript, Express, PostgreSQL, Knex.js, Zod |
|
|
115
|
+
| Admin UI | React 18, Vite, Tailwind, shadcn/ui, React Query v5 |
|
|
116
|
+
| Public site | Express + EJS + Tailwind |
|
|
117
|
+
| Auth | httpOnly JWT cookies (bcrypt, 30-day expiry) |
|
|
118
|
+
| Uploads | AWS S3 via multer-s3, signed URLs |
|
|
119
|
+
| Email | Nodemailer + HTML templates |
|
|
120
|
+
|
|
121
|
+
## Docs
|
|
122
|
+
|
|
123
|
+
- [architecture.md](architecture.md) - patterns, how-tos, examples
|
|
124
|
+
- [code.md](code.md) - coding standards, naming, style rules
|
|
125
|
+
|
|
126
|
+
## License
|
|
127
|
+
|
|
128
|
+
MIT
|