https://github.com/ggalina/portfolio-backend
Backend for sending email from portfolio website
https://github.com/ggalina/portfolio-backend
expressjs googleapi joi-validation nodejs
Last synced: about 1 month ago
JSON representation
Backend for sending email from portfolio website
- Host: GitHub
- URL: https://github.com/ggalina/portfolio-backend
- Owner: GGalina
- Created: 2025-10-01T20:13:42.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2026-03-01T18:27:37.000Z (4 months ago)
- Last Synced: 2026-03-01T18:41:30.538Z (4 months ago)
- Topics: expressjs, googleapi, joi-validation, nodejs
- Language: JavaScript
- Homepage: https://portfolio-backend-production-8bf4.up.railway.app
- Size: 44.9 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Email Sender Backend
This Node.js backend allows you to send emails from your portfolio website using the Gmail API with OAuth2 for authentication.
The backend service for this project is deployed and available at: http://portfolio-backend-production-8bf4.up.railway.app
## Prerequisites
- Node.js installed on your machine
- NPM (Node Package Manager) installed
- A Gmail account for sending emails
## Installation
1. Clone this repository to your local machine.
```bash
git clone https://github.com/GGalina/portfolio-backend.git
```
2. Navigate to the project directory.
```bash
cd portfolio-backend
```
3. Install dependencies.
```bash
npm install
```
## Configuration
Create a .env file with your configuration setting
```javascript
GMAIL_ADDRESS_FROM=your-email@gmail.com
GMAIL_ADDRESS_TO=recipient-email@gmail.com
GMAIL_CLIENT_ID=your-google-client-id.apps.googleusercontent.com
GMAIL_CLIENT_SECRET=your-google-client-secret
GMAIL_REFRESH_TOKEN=your-google-refresh-token
ALLOWED_ORIGINS=http://localhost:3000,https://your-frontend-domain.com
PORT=8080
```
## Usage
Start the server.
```bash
npm start
```
The server will be running at http://localhost:3000 by default.
## API Endpoints
### Send Email
- URL: /send-email
- Method: POST
- Headers:
-- Content-Type: application/json
- Body:
```json
{
"name": "John Smith",
"email": "smith@example.com",
"message": "Hi, I want to work with you"
}
```
Make a POST request to /send-email with the necessary details in the request body to send an email.
Example Response:
```json
{
"message": "Email sent successfully"
}
```