A WordPress plugin that retrieves data from a remote API and displays it through an admin-only Vue.js application with tables, graphs, and settings.
Access /docs folder files to find:
- PRD.md: This project was developed following a Product Requirements Document (PRD) that outlines the features, user stories, and technical specifications
- intro.md: chat history with the project introduction
- AI_chat_history.mp4: video with the complete chat history with AI
The functional plugin zip can be found in the martiniano-plugin/martiniano-plugin.zip to be installed on any wordpress website, or it can be rebuilded following the instructions below.
- π Data Table View - Display paginated data with customizable rows (1-5)
- π Graph Visualization - Interactive line charts using vue-chartjs 3.5.1
- βοΈ Settings Management - Configure date format and notification emails
- π Admin-Only Access - Requires
manage_optionscapability - πΎ Smart Caching - 1-hour server-side caching of external API data
- π¨ Vue 2 SPA - Single-page application with tab navigation
- βΏ Accessible - WCAG 2.1 Level AA compliant
- π i18n Ready - Internationalization support
- Backend: PHP 7.3+, WordPress 5.0+, WordPress REST API
- Frontend: Vue 2.7, Vuex 3.x, Vue Router 3.x, vue-chartjs 3.5.1, Chart.js 2.9.4
- Build: Webpack 5, Babel
- Development: Docker, Docker Compose
- Docker
# Start all services (WordPress, MySQL, Node.js)
docker-compose up -d
# Check service status
docker-compose psThis will:
- Start WordPress on http://localhost:8080
- Start MySQL database
- Build the Vue application automatically
- Visit http://localhost:8080
- Complete WordPress installation:
- Site Title: Your choice
- Username: admin
- Password: (choose a strong password)
- Email: your email
- Click "Install WordPress"
# Build the Vue assets and package the plugin
docker-compose up -d node && docker exec martiniano-node npm install && docker exec martiniano-node npm run zipThis creates martiniano-plugin.zip in the martiniano-plugin directory.
- Log in to WordPress admin (http://localhost:8080/wp-admin)
- Go to Plugins β Add New β Upload Plugin
- Click Choose File and select
martiniano-plugin/martiniano-plugin.zip - Click Install Now
- Click Activate Plugin
- Navigate to Martiniano Plugin in the admin menu
After making code changes, rebuild and reinstall:
# Rebuild Vue assets
docker exec martiniano-node npm run zip
# Reinstall plugin via WordPress admin# Start watch mode
docker exec martiniano-node npm run dev
# Or enter the Node container
docker exec -it martiniano-node sh
npm run dev # Inside containerNote: Watch mode only works if the plugin folder is mounted as a volume. For testing deletion/uninstall, use the manual ZIP installation method.
monster/
βββ docker-compose.yml # Docker services configuration
βββ docs/
β βββ PRD.md # Product Requirements Document
βββ martiniano-plugin/
β βββ martiniano-plugin.php # Main plugin file
β βββ uninstall.php # Uninstall cleanup script
β βββ readme.txt # WordPress.org readme
β βββ includes/ # PHP backend classes
β β βββ class-activation.php # Plugin activation handler
β β βββ class-settings.php # Settings CRUD operations
β β βββ class-rest-controller.php # REST API endpoints
β β βββ helpers.php # Utility functions
β βββ src/ # Vue source files
β β βββ main.js # Vue app entry point
β β βββ App.vue # Root Vue component
β β βββ i18n.js # Vue i18n configuration
β β βββ router/
β β β βββ index.js # Vue Router configuration
β β βββ store/
β β β βββ index.js # Vuex store root
β β β βββ modules/
β β β βββ settings.js # Settings state management
β β β βββ pages.js # Pages data state management
β β βββ views/
β β β βββ TableView.vue # Table tab component
β β β βββ GraphView.vue # Graph tab component
β β β βββ SettingsView.vue # Settings tab component
β β βββ components/
β β β βββ LineChart.vue # Chart.js line chart wrapper
β β βββ services/
β β β βββ api.js # Axios API client
β β βββ locales/
β β βββ en.json # English translations
β β βββ pt_BR.json # Portuguese (Brazil) translations
β βββ dist/ # Built Vue bundles (generated)
β β βββ app.js # Compiled Vue application
β βββ languages/ # WordPress translation files
β β βββ martiniano.pot # Translation template
β β βββ pt_BR/
β β βββ martiniano-pt_BR.po # Portuguese translations
β β βββ martiniano-pt_BR.mo # Compiled translations
β βββ package.json # Node.js dependencies
β βββ webpack.config.js # Webpack build configuration
β βββ .babelrc # Babel transpilation config
β βββ .eslintrc.js # ESLint configuration
β βββ .gitignore # Git ignore rules
β βββ create-zip.sh # Plugin ZIP creation script
βββ README.md # This file
Proxies external API and returns cached or fresh data.
Response:
{
"graph": { ... },
"table": { ... }
}Returns all saved settings.
Response:
{
"rows": 5,
"dateFormat": "human",
"emails": ["admin@example.com"]
}Updates all settings in a single request (bulk update).
Request:
{
"rows": 3,
"dateFormat": "unix",
"emails": ["admin@example.com", "user@example.com"]
}Note: All fields are optional.
Response:
{
"rows": 3,
"dateFormat": "unix",
"emails": ["admin@example.com", "user@example.com"]
}The plugin creates a custom table on activation:
CREATE TABLE wp_martiniano_settings (
id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
setting_key VARCHAR(64) NOT NULL,
setting_value VARCHAR(255) NOT NULL,
updated_at DATETIME NOT NULL,
PRIMARY KEY (id),
UNIQUE KEY setting_key (setting_key)
);- Plugin installs and activates successfully
- Admin menu appears for administrators only
- Table tab displays data with correct columns
- Graph tab renders chart correctly
- Settings tab saves all three settings
- Row count changes reflect in table (1-5)
- Date format toggles between human/unix
- Email list allows add/remove (1-5 emails)
- Validation errors show for invalid inputs
- Tab persistence works across page refresh
- Cache expires after 1 hour
- Translations load correctly (english and portuguese implemented)
# Get pages (requires authentication)
curl -H "X-WP-Nonce: YOUR_NONCE" http://localhost:8080/wp-json/martiniano/v1/pages
# Get settings
curl -H "X-WP-Nonce: YOUR_NONCE" http://localhost:8080/wp-json/martiniano/v1/settings
# Update settings (bulk)
curl -X POST \
-H "Content-Type: application/json" \
-H "X-WP-Nonce: YOUR_NONCE" \
-d '{"rows":3,"dateFormat":"unix","emails":["admin@test.com"]}' \
http://localhost:8080/wp-json/martiniano/v1/settings- Remove
node_modules:docker-compose exec node rm -rf node_modules - Reinstall:
docker-compose exec node npm install
Edit docker-compose.yml and change the WordPress port:
ports:
- "8081:80" # Changed from 8080Built with β€οΈ by Martiniano