An open API service indexing awesome lists of open source software.

https://github.com/eritech98/portfolio-backend-service

A backend service built with Node.js and Express to power the portfolio website, handling form submissions, managing portfolio data, and integrating with an email service.
https://github.com/eritech98/portfolio-backend-service

express-js gmail-smtp nodejs nodemailer

Last synced: 4 months ago
JSON representation

A backend service built with Node.js and Express to power the portfolio website, handling form submissions, managing portfolio data, and integrating with an email service.

Awesome Lists containing this project

README

          

# ๐Ÿ“ฌ Node.js Email Backend Service

A simple backend service built with **Express** and **Nodemailer** to send emails. Designed to be lightweight, environment-configurable, and easily deployable (e.g., on Railway).

---

## ๐Ÿš€ Features

- Built with Node.js and Express
- Handles CORS and JSON requests
- Sends emails using Gmail SMTP via Nodemailer
- `.env` support for secure config

---

## ๐Ÿ“ Project Structure

```
backend/
โ”œโ”€โ”€ index.js # Main server file
โ”œโ”€โ”€ .env # Environment variables (not committed)
โ”œโ”€โ”€ package.json # NPM scripts and dependencies
โ””โ”€โ”€ README.md # You're reading this
```

---

## โš™๏ธ Environment Variables

Create a `.env` file in the root directory:

```env
EMAIL_HOST=smtp.gmail.com
EMAIL_PORT=587
EMAIL_USER=your_email@gmail.com
EMAIL_PASS=your_email_app_password
PORT=3000
```

> โš ๏ธ Do not commit this file! Add `.env` to your `.gitignore`.

---

## ๐Ÿ’ป Installation & Running Locally

1. **Clone the repository:**

```bash
git clone https://github.com/your-username/your-repo-name.git
cd backend
```

2. **Install dependencies:**

```bash
npm install
```

3. **Start the server:**

```bash
npm start
```

> Or use `npm run dev` if you're developing with live reload.

---

## ๐Ÿ“ซ Sending an Email

Make a `POST` request to:

```
POST http://localhost:3000/send
```

### Request body (JSON):

```json
{
"to": "recipient@example.com",
"subject": "Test Email",
"text": "Hello from Erick's email backend!"
}
```
---

## ๐Ÿงพ Scripts

| Command | Description |
| ------------- | ------------------------------- |
| `npm start` | Start the server |
| `npm run dev` | Run with nodemon (live reload) |
| `npm run test`| Placeholder test script |

---
This a sample of what to expect when the route is hit.Please note it uses gmail smtp service.
![](https://github.com/eritech98/Portfolio-Backend-Service/blob/main/React.PNG?raw=true)

## ๐Ÿ‘ค Author

Made with โค๏ธ by **Erick Olando**

---