|
| 1 | +# Re:Earth Visualizer Plugin with Backend Demo |
| 2 | + |
| 3 | +This is a full-stack demo project showcasing a Re:Earth Visualizer plugin with a backend server integration. The project demonstrates street photography visualization with CMS integration. |
| 4 | + |
| 5 | +## Project Structure |
| 6 | + |
| 7 | +This repository contains three main components: |
| 8 | + |
| 9 | +- **`/plugin`** - Re:Earth Visualizer plugin frontend (React + TypeScript) |
| 10 | +- **`/server`** - Backend API server (Node.js + TypeScript, Vercel deployment) |
| 11 | +- **Root** - Main project configuration and coordination |
| 12 | + |
| 13 | +## Architecture Overview |
| 14 | + |
| 15 | +The project demonstrates a complete workflow: |
| 16 | + |
| 17 | +1. **Plugin Frontend** creates interactive visualizations in Re:Earth |
| 18 | +2. **Backend Server** manages data persistence and CMS integration |
| 19 | +3. **Integration** between plugin and server via REST API |
| 20 | + |
| 21 | +## Key Features |
| 22 | + |
| 23 | +- Street photography visualization plugin for Re:Earth Visualizer |
| 24 | +- CMS integration for data management |
| 25 | +- Image upload and processing capabilities |
| 26 | +- **Security features** - Rate limiting and honeypot protection |
| 27 | +- TypeScript throughout the stack |
| 28 | +- Modern tooling (Vite, Vercel, ShadCN/UI) |
| 29 | + |
| 30 | +## Quick Start |
| 31 | + |
| 32 | +### Prerequisites |
| 33 | + |
| 34 | +- Node.js >= 20.11.0 |
| 35 | +- Yarn package manager |
| 36 | + |
| 37 | +### 1. Setup Backend Server |
| 38 | + |
| 39 | +```bash |
| 40 | +cd server |
| 41 | +yarn install |
| 42 | +cp .env.example .env |
| 43 | +# Configure environment variables in .env |
| 44 | +yarn dev:local |
| 45 | +``` |
| 46 | + |
| 47 | +### 2. Setup Plugin Frontend |
| 48 | + |
| 49 | +```bash |
| 50 | +cd plugin |
| 51 | +yarn install |
| 52 | +yarn dev-build |
| 53 | +``` |
| 54 | + |
| 55 | +### 3. Integration with Re:Earth Visualizer |
| 56 | + |
| 57 | +1. Run Re:Earth Visualizer locally |
| 58 | +2. Set environment variable: `REEARTH_WEB_DEV_PLUGIN_URLS='["http://localhost:5005"]'` |
| 59 | +3. Use development buttons in Re:Earth editor to install and reload the plugin |
| 60 | + |
| 61 | +## Development Workflow |
| 62 | + |
| 63 | +Each component can be developed independently: |
| 64 | + |
| 65 | +```bash |
| 66 | +# Plugin development |
| 67 | +cd plugin && yarn dev-build |
| 68 | + |
| 69 | +# Server development |
| 70 | +cd server && yarn dev:local |
| 71 | +``` |
| 72 | + |
| 73 | +## Tech Stack |
| 74 | + |
| 75 | +### Frontend Plugin |
| 76 | + |
| 77 | +- React 19.1.0 + TypeScript 5.7.2 |
| 78 | +- Vite 6.0.3 for build tooling |
| 79 | +- TailwindCSS 4.1.10 + ShadCN/UI |
| 80 | +- Re:Earth Core API integration |
| 81 | + |
| 82 | +### Backend Server |
| 83 | + |
| 84 | +- Node.js 22.x + TypeScript 5.9.3 |
| 85 | +- Vercel serverless functions |
| 86 | +- Re:Earth CMS integration |
| 87 | +- Rate limiting and honeypot security features |
| 88 | +- Comprehensive test coverage with Vitest |
| 89 | + |
| 90 | +## API Endpoints |
| 91 | + |
| 92 | +- `GET /api/photographs` - Retrieve street photographs |
| 93 | +- `POST /api/photographs` - Create new photograph entry |
| 94 | +- `POST /api/assets/upload` - Upload image files |
| 95 | + |
| 96 | +## Testing |
| 97 | + |
| 98 | +```bash |
| 99 | +# Server tests |
| 100 | +cd server && yarn test |
| 101 | + |
| 102 | +# Plugin linting and type checking |
| 103 | +cd plugin && yarn lint && yarn type |
| 104 | +``` |
| 105 | + |
| 106 | +## Deployment |
| 107 | + |
| 108 | +### Backend (Vercel) |
| 109 | + |
| 110 | +1. Connect repository to Vercel |
| 111 | +2. Configure environment variables |
| 112 | +3. Deploy automatically on push |
| 113 | + |
| 114 | +### Plugin |
| 115 | + |
| 116 | +1. Build with `cd plugin && yarn build` |
| 117 | +2. Upload generated zip file from `plugin/package/` |
| 118 | +3. Install in Re:Earth Visualizer |
| 119 | + |
| 120 | +## Documentation |
| 121 | + |
| 122 | +For detailed instructions, see the README files in each subdirectory: |
| 123 | + |
| 124 | +- [Plugin README](./plugin/README.md) - Frontend development guide |
| 125 | +- [Server README](./server/README.md) - Backend API documentation |
| 126 | + |
| 127 | +## License |
| 128 | + |
| 129 | +This project is licensed under the MIT License - see individual component licenses for details. |
0 commit comments