@alexmc2/create-express-api-starter 0.1.0 → 0.1.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 +63 -17
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,42 +1,71 @@
|
|
|
1
1
|
# @alexmc2/create-express-api-starter
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/@alexmc2/create-express-api-starter)
|
|
4
|
+
|
|
5
|
+
A beginner-friendly npm CLI that scaffolds Express APIs with best-practice structure and optional educational comments.
|
|
6
|
+
|
|
7
|
+
- JavaScript or TypeScript
|
|
8
|
+
- Simple or MVC architecture
|
|
9
|
+
- In-memory or PostgreSQL (local `psql` or Docker)
|
|
10
|
+
- npm workflow (`npx` for one-off usage)
|
|
11
|
+
|
|
12
|
+
<br />
|
|
4
13
|
|
|
5
14
|

|
|
6
15
|
|
|
16
|
+
<br />
|
|
17
|
+
|
|
7
18
|
> Works on Linux, macOS, and Windows. The screenshot above shows Linux-specific Postgres setup, but the generated README includes instructions for all platforms.
|
|
8
19
|
|
|
9
|
-
|
|
10
|
-
npx @alexmc2/create-express-api-starter my-api
|
|
11
|
-
```
|
|
20
|
+
## Table of contents
|
|
12
21
|
|
|
13
|
-
|
|
22
|
+
- [Installation](#installation)
|
|
23
|
+
- [Usage examples](#usage-examples)
|
|
24
|
+
- [Why this exists](#why-this-exists)
|
|
25
|
+
- [How it works](#how-it-works)
|
|
26
|
+
- [Options](#options)
|
|
27
|
+
- [What gets generated](#what-gets-generated)
|
|
28
|
+
- [Database modes](#database-modes)
|
|
29
|
+
- [Educational comments](#educational-comments)
|
|
30
|
+
- [Design decisions](#design-decisions)
|
|
31
|
+
- [Requirements](#requirements)
|
|
32
|
+
- [Built with](#built-with)
|
|
33
|
+
- [Contributing](#contributing)
|
|
34
|
+
- [Licence](#licence)
|
|
14
35
|
|
|
15
|
-
##
|
|
36
|
+
## Installation
|
|
16
37
|
|
|
17
|
-
|
|
38
|
+
### No install (recommended)
|
|
18
39
|
|
|
19
|
-
|
|
40
|
+
```bash
|
|
41
|
+
npx @alexmc2/create-express-api-starter my-api
|
|
42
|
+
```
|
|
20
43
|
|
|
21
|
-
|
|
44
|
+
### Global install (optional)
|
|
22
45
|
|
|
23
|
-
|
|
46
|
+
```bash
|
|
47
|
+
npm install -g @alexmc2/create-express-api-starter
|
|
48
|
+
```
|
|
24
49
|
|
|
25
|
-
|
|
26
|
-
2. **The generated project** - a standalone Express API in its own folder with its own dependencies, scripts, and tests. The CLI exits after creating it.
|
|
50
|
+
> The npm package page may show `npm i @alexmc2/create-express-api-starter`. That command installs the package into your current project. For one-off scaffolding, use `npx` above.
|
|
27
51
|
|
|
28
|
-
|
|
52
|
+
## Usage examples
|
|
29
53
|
|
|
30
|
-
|
|
54
|
+
### Interactive flow
|
|
31
55
|
|
|
32
56
|
```bash
|
|
33
|
-
# Interactive - answer a few questions
|
|
34
57
|
npx @alexmc2/create-express-api-starter my-api
|
|
58
|
+
```
|
|
35
59
|
|
|
36
|
-
|
|
60
|
+
### Accept defaults (non-interactive)
|
|
61
|
+
|
|
62
|
+
```bash
|
|
37
63
|
npx @alexmc2/create-express-api-starter my-api --yes
|
|
64
|
+
```
|
|
38
65
|
|
|
39
|
-
|
|
66
|
+
### Dry run
|
|
67
|
+
|
|
68
|
+
```bash
|
|
40
69
|
npx @alexmc2/create-express-api-starter my-api --dry-run
|
|
41
70
|
```
|
|
42
71
|
|
|
@@ -52,6 +81,21 @@ npm run lint # Run ESLint
|
|
|
52
81
|
|
|
53
82
|
Your API is live at `http://localhost:3000`. Hit `http://localhost:3000/health` to confirm.
|
|
54
83
|
|
|
84
|
+
## Why this exists
|
|
85
|
+
|
|
86
|
+
Express is unopinionated by design. That's great, but it means every new project starts with the same setup: folder structure, middleware wiring, error handlers, test runner, linting. This tool does all of that for you so you can skip straight to writing routes.
|
|
87
|
+
|
|
88
|
+
The generated project is simple enough to understand and modify. It's not a framework - it's a starting point that gets out of your way.
|
|
89
|
+
|
|
90
|
+
## How it works
|
|
91
|
+
|
|
92
|
+
This is a two-part system:
|
|
93
|
+
|
|
94
|
+
1. **The CLI** (this package) - asks what you want, then generates files from templates.
|
|
95
|
+
2. **The generated project** - a standalone Express API in its own folder with its own dependencies, scripts, and tests. The CLI exits after creating it.
|
|
96
|
+
|
|
97
|
+
When you run `npx @alexmc2/create-express-api-starter my-api`, npm downloads the CLI, generates the project into `my-api/`, optionally runs `npm install`, and exits. The generated project has no dependency on this tool.
|
|
98
|
+
|
|
55
99
|
## Options
|
|
56
100
|
|
|
57
101
|
The CLI walks you through these choices interactively. Use `--yes` to skip prompts and accept all defaults.
|
|
@@ -191,6 +235,8 @@ For developers who already have PostgreSQL installed locally. The generated proj
|
|
|
191
235
|
- A project-specific database name derived from your project name (e.g. `my-api` → `my_api_dev`)
|
|
192
236
|
- `DATABASE_URL` pre-configured with your OS username
|
|
193
237
|
|
|
238
|
+
> Note: Local dev defaults are for convenience only; update DB credentials in `.env` before deployment.
|
|
239
|
+
|
|
194
240
|
**Requires:** PostgreSQL installed and running locally.
|
|
195
241
|
|
|
196
242
|
```bash
|