Email Relay Server
Node.js SMTP server for transactional emails
Email Relay Server
Because Flutter cannot securely send SMTP emails directly from the client without exposing credentials, BabyShopHub uses a lightweight Node.js Express server to handle transactional emails (e.g., order confirmations, shipping updates).
Architecture
Located in the server/ directory of the repository.
- Framework: Express.js
- Mailer: Nodemailer
- Provider: Zoho Mail (or any standard SMTP provider)
Setup & Running
- Navigate to the
server/directory. - Install dependencies:
npm install - Create a
.envfile: - Run the server:
node index.js
API Endpoints
POST /send-order-confirmation
Payload:
Response:
Returns 200 OK on success, 500 Internal Server Error on failure.
Client Integration
The Flutter app communicates with this relay server using the http package.
Deployment
This server is typically deployed as a serverless function on Vercel or a small container on Render/Heroku. Ensure CORS is configured to only accept requests from your app's domain.