jru-express 1.0.0 → 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.
@@ -0,0 +1,30 @@
1
+ name: Publish JruExpress
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - "v*.*.*"
7
+
8
+ permissions:
9
+ contents: read
10
+ id-token: write
11
+
12
+ jobs:
13
+ publish:
14
+ runs-on: ubuntu-latest
15
+
16
+ steps:
17
+ - name: Checkout
18
+ uses: actions/checkout@v4
19
+
20
+ - name: Setup Node
21
+ uses: actions/setup-node@v4
22
+ with:
23
+ node-version: 22
24
+ registry-url: https://registry.npmjs.org
25
+
26
+ - name: Install dependencies
27
+ run: npm ci
28
+
29
+ - name: Publish
30
+ run: npm publish
@@ -0,0 +1,237 @@
1
+ # Contributing to JruExpress
2
+
3
+ Thank you for your interest in contributing to JruExpress. Contributions are welcome and appreciated. JruExpress is an evolving project, and there are many ways to help it improve.
4
+
5
+ ## What You Can Contribute
6
+
7
+ - Bug fixes
8
+ - New features
9
+ - CLI improvements
10
+ - Template improvements
11
+ - Documentation
12
+ - Tests
13
+ - Developer experience improvements
14
+
15
+ ## Before You Start
16
+
17
+ Please take a moment to review the following before contributing:
18
+
19
+ 1. **Read the [README.md](README.md).** Understand what JruExpress does and how it works.
20
+ 2. **Check existing issues and pull requests.** Search the issue tracker to see if your idea or bug has already been reported or is being worked on.
21
+ 3. **Avoid duplicate issues.** If a similar issue already exists, add a comment to it rather than creating a new one.
22
+ 4. **Open an issue first for large changes.** If you are planning a significant new feature, architectural change, or major improvement, open an issue first to discuss it with the maintainers. This helps avoid wasted effort and ensures the change aligns with the project's direction.
23
+
24
+ Small documentation fixes, obvious bug fixes, or minor improvements generally do not require an issue.
25
+
26
+ ## How to Contribute
27
+
28
+ ### 1. Fork the Repository
29
+
30
+ Go to the JruExpress repository on GitHub and click the **Fork** button to create your own copy of the repository.
31
+
32
+ ### 2. Clone Your Fork
33
+
34
+ Clone your fork to your local machine:
35
+
36
+ ```bash
37
+ git clone <your-fork-url>
38
+ cd jru-express
39
+ npm install
40
+ ```
41
+
42
+ ### 3. Create a Separate Branch
43
+
44
+ **This is important.** Never work directly on the `main` branch. Every change must be developed in its own branch. This keeps `main` stable and makes it easier to manage pull requests.
45
+
46
+ Create a descriptive branch based on the type of change you are making:
47
+
48
+ ```bash
49
+ git checkout -b feature/add-typescript-template
50
+ ```
51
+
52
+ For bug fixes:
53
+
54
+ ```bash
55
+ git checkout -b fix/preserve-empty-directories
56
+ ```
57
+
58
+ For documentation:
59
+
60
+ ```bash
61
+ git checkout -b docs/improve-readme
62
+ ```
63
+
64
+ ### 4. Branch Naming Convention
65
+
66
+ Use the following prefixes to name your branches clearly:
67
+
68
+ | Prefix | Purpose | Example |
69
+ |---|---|---|
70
+ | `feature/` | New functionality | `feature/add-docker-template` |
71
+ | `fix/` | Bug fixes | `fix/missing-gitkeep` |
72
+ | `docs/` | Documentation changes | `docs/update-contributing` |
73
+ | `refactor/` | Code restructuring without behavior change | `refactor/simplify-cli-parsing` |
74
+ | `test/` | Adding or updating tests | `test/add-generator-tests` |
75
+ | `chore/` | Maintenance, CI, config, etc. | `chore/update-dependencies` |
76
+
77
+ Choose descriptive names that explain the purpose of the branch at a glance.
78
+
79
+ ### 5. Make Your Changes
80
+
81
+ When making changes, keep the following in mind:
82
+
83
+ - **Keep changes focused.** Each branch and pull request should address a single concern. Do not mix unrelated changes.
84
+ - **Follow existing code style.** Match the formatting, naming conventions, and patterns already present in the codebase.
85
+ - **Keep the CLI simple.** JruExpress is intentionally lightweight. Avoid introducing unnecessary complexity or heavy dependencies.
86
+ - **Update documentation.** If your change affects how the tool is used, update the README or other relevant documentation.
87
+ - **Add or update tests.** If applicable, include tests for your changes.
88
+
89
+ ### 6. Test Your Changes
90
+
91
+ Before submitting a pull request, test your changes thoroughly.
92
+
93
+ Link the package locally:
94
+
95
+ ```bash
96
+ npm install
97
+ npm link
98
+ ```
99
+
100
+ Then test the generator from a different directory:
101
+
102
+ ```bash
103
+ cd /tmp
104
+ jru-express test-project
105
+ cd test-project
106
+ npm install
107
+ npm run dev
108
+ ```
109
+
110
+ Verify the following:
111
+
112
+ - Project directories are created correctly.
113
+ - All template files are generated.
114
+ - `package.json` contains the correct scripts.
115
+ - Express is installed and works.
116
+ - Nodemon is installed and works.
117
+ - `npm run dev` starts the server without errors.
118
+ - `npm start` starts the server without errors.
119
+ - Existing functionality is not broken.
120
+
121
+ When you are done testing, unlink the global package:
122
+
123
+ ```bash
124
+ npm uninstall -g jru-express
125
+ ```
126
+
127
+ ### 7. Commit Guidelines
128
+
129
+ Write clear, meaningful commit messages. Each commit message should describe what was changed and why.
130
+
131
+ Use this format:
132
+
133
+ ```
134
+ <type>: <short description>
135
+ ```
136
+
137
+ Examples:
138
+
139
+ ```
140
+ feat: add TypeScript template
141
+ fix: preserve empty template directories
142
+ docs: improve installation instructions
143
+ refactor: simplify template generation
144
+ test: add generator integration tests
145
+ chore: update commander dependency
146
+ ```
147
+
148
+ Avoid meaningless commit messages such as:
149
+
150
+ - `update`
151
+ - `changes`
152
+ - `stuff`
153
+ - `final final`
154
+ - `wip`
155
+
156
+ ### 8. Keep Commits Focused
157
+
158
+ Each commit should represent a single logical change. Do not bundle unrelated modifications into the same commit. If you are fixing a bug and also refactoring nearby code, create separate commits for each.
159
+
160
+ ### 9. Push Your Branch
161
+
162
+ When your changes are ready:
163
+
164
+ ```bash
165
+ git push origin <your-branch-name>
166
+ ```
167
+
168
+ ### 10. Create a Pull Request
169
+
170
+ Go to the JruExpress repository on GitHub and create a new Pull Request from your branch into the `main` branch.
171
+
172
+ Your pull request should include:
173
+
174
+ - A clear title that describes the change.
175
+ - A description explaining **what** changed and **why**.
176
+ - What testing you performed.
177
+ - Screenshots or terminal output if applicable.
178
+
179
+ ### 11. Pull Request Checklist
180
+
181
+ Before submitting, confirm the following:
182
+
183
+ - [ ] I created a separate branch for my changes.
184
+ - [ ] I tested my changes locally.
185
+ - [ ] I did not modify unrelated files.
186
+ - [ ] I updated documentation where necessary.
187
+ - [ ] I used clear, descriptive commit messages.
188
+ - [ ] I verified the generated project works correctly.
189
+ - [ ] I have described my changes clearly in the pull request.
190
+
191
+ ### 12. Code Review
192
+
193
+ After submitting a pull request, a maintainer will review it. You may be asked to make changes or improvements. Please address review feedback by pushing additional commits to the same branch. Do not close the pull request and open a new one.
194
+
195
+ Once the pull request is approved, it will be merged into `main`.
196
+
197
+ ## Versioning and Publishing
198
+
199
+ **Do not manually publish the npm package.** Package releases and npm publishing are managed by the project maintainer through the repository's release workflow.
200
+
201
+ If the project uses automated publishing through GitHub Actions, your changes will be included in a future release after the pull request is merged. Submit your work through a Pull Request and the maintainer will handle the release process.
202
+
203
+ ## Reporting Bugs
204
+
205
+ If you find a bug, please open an issue with the following information:
206
+
207
+ - **Description.** A clear explanation of the problem.
208
+ - **Steps to reproduce.** Exact commands or actions that trigger the bug.
209
+ - **Expected behavior.** What you expected to happen.
210
+ - **Actual behavior.** What actually happened.
211
+ - **Node.js version.** Run `node --version` to find this.
212
+ - **npm version.** Run `npm --version` to find this.
213
+ - **Operating system.** (e.g., Windows 11, macOS, Ubuntu 22.04)
214
+ - **JruExpress version.** Check your installed version.
215
+ - **Terminal output.** Paste any relevant error messages or output.
216
+
217
+ The more detail you provide, the easier it is to identify and fix the issue.
218
+
219
+ ## Feature Requests
220
+
221
+ If you have an idea for a new feature or improvement, open an issue with:
222
+
223
+ - **Description.** What you would like to see added.
224
+ - **Use case.** Why this would be useful.
225
+ - **Possible implementation.** If you have ideas on how it could work, share them.
226
+
227
+ Not all feature requests will be implemented, but thoughtful suggestions are always reviewed and considered.
228
+
229
+ ## Code of Conduct
230
+
231
+ Contributors are expected to communicate respectfully and constructively. Be kind in discussions, reviews, and issue comments. Disagreements are natural, but personal attacks, harassment, or dismissive behavior are not acceptable.
232
+
233
+ ## Final Note
234
+
235
+ JruExpress is still at the beginning of its development. Every contribution, no matter how small, helps the project grow and improve. Whether it is a typo fix in the documentation, a bug report, or a new feature, it is valued.
236
+
237
+ Thank you for taking the time to contribute.
package/README.md ADDED
@@ -0,0 +1,250 @@
1
+ # JruExpress
2
+
3
+ > A lightweight Express.js backend scaffolding CLI for quickly creating a clean and practical backend structure.
4
+
5
+ ## Introduction
6
+
7
+ Starting a new Express.js backend project often involves the same repetitive steps: creating folders, setting up `package.json`, installing dependencies, writing boilerplate server code, and configuring scripts. While these tasks are simple individually, they add up every time you begin a new project.
8
+
9
+ JruExpress solves this by generating a complete, ready-to-run Express.js backend project with a single command. It provides a sensible default folder structure, installs the necessary dependencies, and configures your scripts so you can start building immediately.
10
+
11
+ JruExpress is designed to be a starting point, not a rigid framework. The generated project is plain JavaScript with no hidden magic, making it easy to understand, modify, and extend to fit your own preferences.
12
+
13
+ ## Current Status
14
+
15
+ JruExpress is currently in its early stage. The core scaffolding functionality is working and available for use. This is just the beginning. JruExpress is being developed with the goal of becoming a more useful and flexible backend scaffolding tool, with more features, improvements, templates, and developer conveniences planned for the future.
16
+
17
+ ## Features
18
+
19
+ ### Current
20
+
21
+ - Express project scaffolding via a single CLI command
22
+ - Standard backend folder structure (`controllers`, `services`, `models`, `routes`, `middleware`, `config`, `utils`)
23
+ - Automatic npm initialization
24
+ - Automatic Express installation
25
+ - Automatic Nodemon installation (as a dev dependency)
26
+ - Development script (`npm run dev`) using Nodemon with file watching
27
+ - Production/start script (`npm start`) using Node
28
+ - Basic Express server boilerplate with JSON parsing and a health-check route
29
+ - `.gitignore` preconfigured for `node_modules` and `.env`
30
+ - Project README included in the generated structure
31
+
32
+ ### Future Ideas
33
+
34
+ - Multiple project templates (e.g., REST API, GraphQL, microservice)
35
+ - TypeScript support
36
+ - Database connection templates (MongoDB, PostgreSQL, MySQL)
37
+ - Authentication boilerplate
38
+ - Docker and Docker Compose support
39
+ - Environment configuration templates
40
+ - Interactive CLI prompts for selecting options
41
+ - Custom project configuration files
42
+ - Testing setup and boilerplate
43
+ - Improved error handling templates
44
+
45
+ ## Installation / Usage
46
+
47
+ The primary way to use JruExpress is through `npx`:
48
+
49
+ ```bash
50
+ npx jru-express <project-name>
51
+ ```
52
+
53
+ Replace `<project-name>` with whatever you want your project directory to be called. For example:
54
+
55
+ ```bash
56
+ npx jru-express backend
57
+ ```
58
+
59
+ This will create a `backend/` directory in your current location with a fully scaffolded Express.js project.
60
+
61
+ You can name the project anything you like:
62
+
63
+ ```bash
64
+ npx jru-express my-api
65
+ npx jru-express ecommerce-server
66
+ npx jru-express auth-service
67
+ ```
68
+
69
+ ### What happens after running the command
70
+
71
+ 1. A new directory is created with the name you provided.
72
+ 2. The backend folder structure is generated inside it.
73
+ 3. npm is initialized automatically.
74
+ 4. Express is installed as a production dependency.
75
+ 5. Nodemon is installed as a development dependency.
76
+ 6. `npm start` and `npm run dev` scripts are configured in `package.json`.
77
+ 7. A basic Express server is ready to run.
78
+
79
+ ## Generated Structure
80
+
81
+ After running the command, your project will contain the following structure:
82
+
83
+ ```text
84
+ <project-name>/
85
+ ├── src/
86
+ │ ├── config/
87
+ │ ├── controllers/
88
+ │ ├── middleware/
89
+ │ ├── models/
90
+ │ ├── routes/
91
+ │ ├── services/
92
+ │ ├── utils/
93
+ │ └── app.js
94
+
95
+ ├── server.js
96
+ ├── package.json
97
+ ├── .gitignore
98
+ └── README.md
99
+ ```
100
+
101
+ ### Directory purposes
102
+
103
+ | Directory | Purpose |
104
+ |---|---|
105
+ | `src/config/` | Configuration files such as database connections, API keys, and environment-specific settings. |
106
+ | `src/controllers/` | Request handlers that receive incoming requests and return responses. |
107
+ | `src/middleware/` | Custom middleware functions for authentication, validation, error handling, logging, etc. |
108
+ | `src/models/` | Data models and schema definitions for your database or data layer. |
109
+ | `src/routes/` | Route definitions that map HTTP endpoints to controller functions. |
110
+ | `src/services/` | Business logic and reusable service functions separated from controllers. |
111
+ | `src/utils/` | Utility functions, helpers, and shared small modules. |
112
+
113
+ ### File purposes
114
+
115
+ | File | Purpose |
116
+ |---|---|
117
+ | `src/app.js` | Creates and configures the Express application. Exports the `app` instance. |
118
+ | `server.js` | Entry point that imports the app and starts the HTTP server. |
119
+ | `package.json` | Project metadata, dependencies, and scripts. |
120
+ | `.gitignore` | Prevents `node_modules/` and `.env` from being committed to version control. |
121
+ | `README.md` | Basic instructions for the generated project. |
122
+
123
+ ## Running the Generated Project
124
+
125
+ After scaffolding, navigate into your project and start the development server:
126
+
127
+ ```bash
128
+ cd backend
129
+ npm run dev
130
+ ```
131
+
132
+ The server will start on port 3000 by default. You will see output indicating the server is running. Nodemon will automatically restart the server whenever you change a file.
133
+
134
+ To run the project without file watching (production-style):
135
+
136
+ ```bash
137
+ npm start
138
+ ```
139
+
140
+ ### Development vs Production
141
+
142
+ | Command | Tool | File watching | Use case |
143
+ |---|---|---|---|
144
+ | `npm run dev` | Nodemon | Yes | Active development with automatic restarts |
145
+ | `npm start` | Node | No | Running the server in production or preview |
146
+
147
+ The server listens on port 3000 by default. You can change this by setting the `PORT` environment variable.
148
+
149
+ ## Example
150
+
151
+ A complete workflow from creation to running:
152
+
153
+ ```bash
154
+ npx jru-express ecommerce-api
155
+ cd ecommerce-api
156
+ npm run dev
157
+ ```
158
+
159
+ Expected output:
160
+
161
+ ```text
162
+ Server running on port https://localhost:3000
163
+ ```
164
+
165
+ You can then open `http://localhost:3000` in your browser or use a tool like `curl` to verify:
166
+
167
+ ```bash
168
+ curl http://localhost:3000
169
+ ```
170
+
171
+ This will return:
172
+
173
+ ```json
174
+ {
175
+ "message": "JruExpress API is running"
176
+ }
177
+ ```
178
+
179
+ ## Development
180
+
181
+ If you want to work on JruExpress itself (the CLI generator), you can clone the repository and set it up locally:
182
+
183
+ ```bash
184
+ git clone <repository-url>
185
+ cd jru-express
186
+ npm install
187
+ ```
188
+
189
+ To test your changes locally, link the package:
190
+
191
+ ```bash
192
+ npm link
193
+ ```
194
+
195
+ This makes the `jru-express` command available globally using your local copy. You can then run it from any directory:
196
+
197
+ ```bash
198
+ jru-express test-project
199
+ ```
200
+
201
+ When you are done testing, you can unlink:
202
+
203
+ ```bash
204
+ npm uninstall -g jru-express
205
+ ```
206
+
207
+ ## Project Philosophy
208
+
209
+ JruExpress is built around a few straightforward principles:
210
+
211
+ - **Simple scaffolding.** Generate a working project with one command. No complex configuration required.
212
+ - **Minimal configuration.** The generated project uses sensible defaults. You are free to change anything.
213
+ - **Familiar architecture.** The folder structure follows conventions that most Express developers already know.
214
+ - **Easy customization.** Since everything is plain JavaScript with no hidden layers, you can modify any part of the generated project without fighting the tool.
215
+ - **No unnecessary abstraction.** JruExpress generates code you can read, understand, and own.
216
+
217
+ ## Roadmap
218
+
219
+ The following are potential improvements planned or being considered for future versions of JruExpress:
220
+
221
+ - More project templates (REST API, GraphQL, microservice architectures)
222
+ - TypeScript template support
223
+ - Database connection templates (MongoDB, PostgreSQL, MySQL)
224
+ - Authentication boilerplate with JWT or session-based options
225
+ - Docker and Docker Compose configuration templates
226
+ - Environment configuration with `.env` examples
227
+ - Interactive CLI prompts for selecting project options
228
+ - Custom project configuration through a config file
229
+ - Testing setup with boilerplate test files
230
+ - Improved error handling middleware templates
231
+ - Logging configuration templates
232
+ - API documentation setup (e.g., Swagger/OpenAPI)
233
+
234
+ These are future directions and not all of them will necessarily be implemented. They represent areas where JruExpress could grow.
235
+
236
+ ## Contributing
237
+
238
+ Contributions, suggestions, bug reports, and improvements are welcome. Please read the [CONTRIBUTING.md](CONTRIBUTING.md) guidelines before submitting changes.
239
+
240
+ ## License
241
+
242
+ This project is licensed under the MIT License. See the [package.json](package.json) for details.
243
+
244
+ ## Closing
245
+
246
+ JruExpress is at the beginning of its development. It aims to make starting an Express.js project a little faster and a little cleaner. The project will continue to evolve based on feedback and real-world use. If you find it useful, contributions and suggestions are always appreciated.
247
+
248
+ ---
249
+
250
+ Made with ❤️ by Ruturaj
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jru-express",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "My basic Express backend generator",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -20,4 +20,4 @@
20
20
  "dependencies": {
21
21
  "commander": "^14.0.0"
22
22
  }
23
- }
23
+ }
File without changes
File without changes
File without changes
File without changes
File without changes