|
1 | | -# world-heritage |
| 1 | +# World Heritage API |
| 2 | + |
| 3 | +Backend API for a world heritage study app targeting users preparing for the World Heritage Certification exam. |
| 4 | +Fetches and manages UNESCO World Heritage data, providing APIs for search, listing, and detail retrieval. |
| 5 | + |
| 6 | +Persona |
| 7 | +This API powers a study app for people preparing for the World Heritage Certification Exam. |
| 8 | +Instead of carrying a heavy textbook, users can quickly look up heritage sites — their overview, location, and classification — from their smartphone or PC. The app targets anyone interested in the certification, regardless of age or experience. |
| 9 | +Example User |
| 10 | +Tanaka-san, 28, office worker |
| 11 | +Decided to take the World Heritage Certification Exam (Level 2). During the commute, she wants to quickly look up heritage sites on her phone, but the official textbook is too heavy to carry around. She needs a tool where she can check the location on a map along with the category and year of inscription — all in one place. |
| 12 | + |
| 13 | +## Tech Stack |
| 14 | + |
| 15 | +- PHP / Laravel |
| 16 | +- MySQL |
| 17 | +- Algolia (Full-text search) |
| 18 | +- Koyeb (Production hosting) |
| 19 | + |
| 20 | +## Getting Started |
| 21 | + |
| 22 | +```bash |
| 23 | +cp .env.example .env |
| 24 | +composer install |
| 25 | +php artisan key:generate |
| 26 | +php artisan migrate |
| 27 | +``` |
| 28 | + |
| 29 | +## Building Data in Production |
| 30 | + |
| 31 | +Run the following commands from the Koyeb console. |
| 32 | + |
| 33 | +### Initial / Full rebuild |
| 34 | + |
| 35 | +Dumps data from UNESCO and rebuilds the DB and Algolia index. |
| 36 | + |
| 37 | +```bash |
| 38 | +php artisan app:world-heritage-build --force --dump --jp --pretty |
| 39 | +``` |
| 40 | + |
| 41 | +| Option | Description | |
| 42 | +|---|---| |
| 43 | +| `--force` | Allow execution outside local/testing | |
| 44 | +| `--dump` | Dump JSON from UNESCO | |
| 45 | +| `--jp` | Import Japanese names | |
| 46 | +| `--pretty` | Pretty print JSON output | |
| 47 | + |
| 48 | +### Full rebuild including DB and Algolia (with table reset) |
| 49 | + |
| 50 | +```bash |
| 51 | +php artisan app:world-heritage-build --fresh --jp --pretty --algolia --algolia-truncate --force |
| 52 | +``` |
| 53 | + |
| 54 | +> ⚠️ `--fresh` drops and recreates all tables. All existing data will be lost. |
| 55 | +
|
| 56 | +### Re-import Japanese names only |
| 57 | + |
| 58 | +```bash |
| 59 | +php artisan world-heritage:import-japanese-names --force |
| 60 | +``` |
| 61 | + |
| 62 | +## Testing |
| 63 | + |
| 64 | +```bash |
| 65 | +php artisan test |
| 66 | +``` |
0 commit comments