A simple demo showcasing Beefree SDK integration with HTML import functionality. This project demonstrates how to import HTML emails into the Beefree editor and apply custom brand styles.
- HTML Import - Import HTML emails into the Beefree builder
- Brand Style Application - Apply consistent branding to imported templates
- Node.js (v16+ recommended)
- npm
- Beefree SDK credentials (API keys)
- Clone and install
git clone https://github.com/your-username/html-importer-spotlight.git
cd html-importer-spotlight
npm install
- Configure environment
Copy the example environment file and add your API keys:
cp .env.example .env
# Edit .env with your Beefree credentials
- Start the development server
npm run dev
- Open in browser
Open http://localhost:3001 in your browser to use the demo
html-importer-spotlight/
├── public/ # Frontend assets
│ ├── index.html # Main application
│ ├── styles.css # Application styles
│ └── sample-email.html # Sample email for import
├── src/ # Backend code
│ ├── api.ts # All API endpoints
│ ├── config.ts # Application configuration
│ ├── index.ts # App entry point
│ ├── server.ts # Express server
│ └── utils.ts # Helper utilities
├── package.json # Dependencies
└── .env.example # Example environment variables
-
Production mode:
# Build the TypeScript files npm run build # Run the compiled JavaScript version npm start
-
Development mode (with auto-reload):
# Run the TypeScript version directly with hot reloading npm run dev
-
Access the application: Open your browser to:
http://localhost:3001
The TypeScript implementation includes comprehensive HTML sanitization to protect against security threats:
- Script Removal: All
<script>
tags are automatically removed - Iframe Removal: All
<iframe>
tags that could load external content are stripped - Event Handler Sanitization: Removes potentially harmful event handlers like
onclick
,onload
, etc. - URL Sanitization: Removes
javascript:
and dangerousdata:
URLs - Size Limits: Enforces maximum content size to prevent DoS attacks
This application uses server-side authentication to protect sensitive API credentials:
- Never commit
.env
files to the repository - All authentication with the BeeFree API happens server-side
- The client only receives the necessary tokens, not the underlying credentials
- Use environment variables for all sensitive information:
BEEFREE_CLIENT_ID
BEEFREE_CLIENT_SECRET
HTML_IMPORTER_API_KEY
CSAPI_API_KEY