mailer-advance 5.0.0 โ†’ 6.0.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 (2) hide show
  1. package/README.md +28 -23
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # ๐Ÿš€ mailer-advance v5.0
1
+ # ๐Ÿš€ mailer-advance v6.0
2
2
 
3
3
  [![npm version](https://img.shields.io/npm/v/mailer-advance.svg?style=flat-square)](https://www.npmjs.com/package/mailer-advance)
4
4
  [![license](https://img.shields.io/npm/l/mailer-advance.svg?style=flat-square)](https://www.npmjs.com/package/mailer-advance)
@@ -8,13 +8,13 @@
8
8
 
9
9
  ---
10
10
 
11
- ## โœจ v5.0 Highlights
11
+ ## โœจ v6.0 Highlights
12
12
 
13
- - โšก **Smart Connection**: No need to pass URIs manually. `connect()` now automatically falls back to `process.env.DB_URI`.
14
- - ๐Ÿ—„๏ธ **Multi-DB Persistence**: Store configurations in MongoDB, Postgres, or MySQL.
15
- - ๐Ÿ”„ **Zero-Restart Swapping**: Switch SMTP credentials at runtime via the Dashboard.
13
+ - โšก **Smart Connection**: `connect()` automatically falls back to `process.env.DB_URI`.
14
+ - ๐Ÿ“– **Interactive Swagger UI**: Explore and test all APIs at `/api-docs`.
15
+ - ๐Ÿ—„๏ธ **Multi-DB Persistence**: Support for MongoDB, Postgres, and MySQL.
16
+ - ๐Ÿ”„ **Hot-Swapping**: Switch SMTP credentials at runtime via the Dashboard.
16
17
  - ๐Ÿ›ก๏ธ **Production Ready**: Full STARTTLS support and descriptive error guards.
17
- - ๐Ÿ“– **Swagger UI**: API docs auto-served at `/api-docs`.
18
18
 
19
19
  ---
20
20
 
@@ -42,18 +42,34 @@ app.use(express.json());
42
42
 
43
43
  // 1. Initialize Persistence (Smart Fallback to process.env.DB_URI)
44
44
  const repository = DatabaseFactory.createRepository(process.env.DB_TYPE || 'mongodb');
45
- await repository.connect(); // โœจ Automagically uses DB_URI from .env
45
+ await repository.connect();
46
46
  dbService.setRepository(repository);
47
47
 
48
48
  // 2. Mount API Routes
49
49
  app.use('/api/mail', contactRoutes);
50
50
  app.use('/api/config', configRoutes);
51
51
 
52
- app.listen(3000, () => console.log('๐Ÿš€ Engine active at http://localhost:3000'));
52
+ app.listen(3000, () => {
53
+ console.log('๐Ÿš€ Engine active at http://localhost:3000');
54
+ console.log('๐Ÿ“– API Docs: http://localhost:3000/api-docs');
55
+ });
53
56
  ```
54
57
 
55
58
  ---
56
59
 
60
+ ## ๐Ÿ“š Interactive API Documentation (Swagger)
61
+
62
+ V6.0.0 introduces a fully integrated **Swagger UI** for easier development and testing. Once your server is running, navigate to:
63
+
64
+ ๐Ÿ‘‰ **`http://localhost:3000/api-docs`**
65
+
66
+ From there, you can:
67
+ - ๐Ÿ” **Explore**: See all available endpoints and their data structures.
68
+ - ๐Ÿงช **Test**: Send live requests to your mailer engine directly from the browser.
69
+ - ๐Ÿ“œ **Spec**: Download the OpenApi spec for use in other tools.
70
+
71
+ ---
72
+
57
73
  ## โš™๏ธ Environment Configuration (.env)
58
74
 
59
75
  | Variable | Requirement | Description |
@@ -64,13 +80,12 @@ app.listen(3000, () => console.log('๐Ÿš€ Engine active at http://localhost:3000'
64
80
  | `MAIL_PORT` | Optional | Default SMTP Port (Default: `587`). |
65
81
 
66
82
  ### ๐Ÿ’ก The .env Setup Guide
67
- For the engine to function correctly as a library, ensure your project's `.env` contains:
68
83
  ```env
69
84
  # Database
70
85
  DB_TYPE=mongodb
71
86
  DB_URI=mongodb://127.0.0.1:27017/my_mailer_db
72
87
 
73
- # Fallback SMTP (Initial Setup)
88
+ # Fallback SMTP
74
89
  MAIL_HOST=smtp.your-provider.com
75
90
  MAIL_PORT=587
76
91
  MAIL_USER=admin@example.com
@@ -81,19 +96,9 @@ MAIL_PASS=your-secure-password
81
96
 
82
97
  ## ๐Ÿ”’ Security & Best Practices
83
98
 
84
- - **App Privacy**: Always wrap the mailer routes/UI with your own authentication middleware in production.
85
- - **TLS validation**: Ensure `rejectUnauthorized` is `true` for production SMTP connections.
86
- - **Secrets**: Encrypt your `.env` files using tools like [Dotenvx](https://dotenvx.com).
87
-
88
- ---
89
-
90
- ## ๐Ÿ›  Troubleshooting
91
-
92
- ### `Error: Database connection URI is required`
93
- This occurs if `process.env.DB_URI` is undefined.
94
- 1. Ensure your `.env` file exists in the root of your project.
95
- 2. Verify you are using `dotenv.config()` BEFORE initializing the mailer.
96
- 3. Check the variable name is exactly `DB_URI`.
99
+ - **App Privacy**: Always wrap the mailer routes/UI with your own authentication middleware.
100
+ - **TLS validation**: Ensure `rejectUnauthorized` is `true` for production SMTP.
101
+ - **Secrets**: Encrypt your `.env` files using [Dotenvx](https://dotenvx.com).
97
102
 
98
103
  ---
99
104
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mailer-advance",
3
- "version": "5.0.0",
3
+ "version": "6.0.0",
4
4
  "description": "Advanced Node.js email service with dynamic SMTP configuration, multi-database support (MongoDB/SQL), and a built-in UI.",
5
5
  "main": "index.js",
6
6
  "type": "module",