A modern full-stack Ecwid plugin built with Node.js, Express, React, SQLite, and Tailwind CSS. This plugin provides OAuth authentication and store management for your Ecwid store.
- ๐ OAuth Authentication - Secure OAuth 2.0 flow with Ecwid
- ๐ช Store Management - Connect and manage your Ecwid store
- ๐ฑ Responsive Design - Mobile-first design with Tailwind CSS
- ๐ Secure API - Rate limiting and secure token management
- ๐พ Local Database - SQLite for store data and OAuth states
- Backend: Node.js + Express.js
- Frontend: React 18 + Vite
- Database: SQLite3
- Styling: Tailwind CSS
- Authentication: OAuth 2.0
- API Integration: Ecwid REST API
- Development: Hot reload, ESLint, TypeScript support
Before you begin, ensure you have the following installed:
- Node.js (version 18 or higher)
- npm (comes with Node.js)
- An Ecwid account with a store
- Access to Ecwid Developer Portal
-
Clone the repository
git clone <your-repo-url> cd ecwid-plugin
-
Install dependencies
npm install
-
Set up environment variables
cp env.example .env
Edit
.envwith your credentials:PORT=3001 NODE_ENV=development ECWID_CLIENT_ID=your_client_id_here ECWID_CLIENT_SECRET=your_client_secret_here ECWID_STORE_ID=your_store_id_here JWT_SECRET=your_jwt_secret_here
-
Initialize the database
npm run db:migrate
-
Start the development servers
npm run dev
This will start:
- Backend server at
http://localhost:3001 - Frontend development server at
http://localhost:5173
- Backend server at
ecwid-plugin/
โโโ client/ # React frontend
โ โโโ src/
โ โ โโโ components/ # Reusable React components
โ โ โโโ pages/ # Page components
โ โ โโโ hooks/ # Custom React hooks
โ โ โโโ services/ # API service functions
โ โ โโโ utils/ # Utility functions
โ โโโ public/ # Static assets
โโโ server/ # Express backend
โ โโโ config/ # Database and app configuration
โ โโโ middleware/ # Express middleware
โ โโโ models/ # Database models
โ โโโ routes/ # API routes
โ โโโ scripts/ # Database scripts
โโโ data/ # SQLite database files
โโโ dist/ # Built frontend files
โโโ package.json # Dependencies and scripts
โโโ vite.config.js # Vite configuration
โโโ tailwind.config.js # Tailwind CSS configuration
โโโ README.md # This file
Create a .env file in the root directory:
# Server Configuration
PORT=3001
NODE_ENV=development
# Ecwid Configuration
ECWID_CLIENT_ID=your_client_id_here
ECWID_CLIENT_SECRET=your_client_secret_here
ECWID_STORE_ID=your_store_id_here
# Database Configuration
DB_PATH=./data/ecwid_plugin.db
# CORS Configuration
ALLOWED_ORIGINS=http://localhost:3000,http://localhost:5173- Go to your Ecwid Admin Panel
- Navigate to "My Apps" section
- Create a new application
- Copy the Client ID and Client Secret
- Note your Store ID from the URL or settings
GET /api/ecwid/store/:storeId- Get store informationPOST /api/ecwid/store- Create or update store configuration
GET /api/oauth/status/:storeId- Check OAuth authentication statusGET /api/oauth/auth/:storeId- Initiate OAuth flowGET /api/oauth/callback- Handle OAuth callback
OAuthButton- OAuth authentication buttonStoreSetup- Store setup and configurationSettings- Plugin configuration and OAuth status
useEcwid- Ecwid API integration hook- Custom hooks for data fetching and state management
The project uses Tailwind CSS with custom components and utilities:
.btn- Button base styles.btn-primary,.btn-secondary, etc. - Button variants.card- Card container styles.form-input- Form input styles.badge- Badge styles with variants
- Primary: Blue (
#3b82f6) - Ecwid: Cyan (
#0ea5e9) - Success: Green
- Warning: Yellow
- Danger: Red
npm run devnpm run build
npm startnpm run sync:all # Sync all stores data- OAuth Authentication - Secure API access
- Rate Limiting - Prevent API abuse
- CORS Protection - Configured for specific origins
- Helmet.js - Security headers
- Input Validation - Request validation middleware
- SQL Injection Protection - Parameterized queries
- Real-time Tracking - Live event monitoring
- Event Types - Page views, cart updates, purchases
- Customer Behavior - User journey tracking
- Performance Metrics - Store performance insights
- Custom Events - Track custom business events
npm run dev # Start development servers
npm run server:dev # Start backend only
npm run client:dev # Start frontend only
npm run build # Build for production
npm run start # Start production server
npm run lint # Run ESLint
npm run lint:fix # Fix ESLint errors- Backend: Add routes in
server/routes/ - Frontend: Add components in
client/src/components/ - Database: Update models in
server/config/database.js - Styling: Use Tailwind classes or add custom CSS
The SQLite database includes tables for:
stores- Store configuration and credentialsproducts- Product data and metadataorders- Order information and statuscustomers- Customer data and insightsanalytics- Event tracking and analyticsplugin_settings- Plugin configuration
-
Port already in use
# Change port in .env file PORT=3002 -
Database connection errors
# Ensure data directory exists mkdir data npm run db:migrate -
Ecwid API errors
- Verify your Client ID and Secret
- Check store ID is correct
- Ensure API permissions are granted
-
Build errors
# Clear node_modules and reinstall rm -rf node_modules package-lock.json npm install
Enable debug logging:
localStorage.setItem('ecwid-plugin-debug', 'true');- Fork the repository
- Create a feature branch:
git checkout -b feature-name - Make your changes
- Run tests:
npm run lint - Commit your changes:
git commit -m 'Add feature' - Push to the branch:
git push origin feature-name - Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
For support and questions:
- Ecwid Developer Documentation
- Ecwid API Reference
- Ecwid Community Forum
- React Documentation
- Express.js Documentation
- Initial release with full-stack architecture
- React frontend with Tailwind CSS
- Express.js backend with SQLite
- Complete Ecwid API integration
- Real-time analytics dashboard
- Product and order management
- Responsive design
- Security features and authentication