|
1 | | -# React + Vite |
| 1 | +# Bestiary - Digital Animal Encyclopedia |
2 | 2 |
|
3 | | -This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules. |
| 3 | +A modern web application showcasing Earth's most fascinating and unusual creatures, built with React, Vite, and managed through Decap CMS. |
4 | 4 |
|
5 | | -Currently, two official plugins are available: |
| 5 | +## 🚀 Getting Started |
6 | 6 |
|
7 | | -- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Babel](https://babeljs.io/) for Fast Refresh |
8 | | -- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh |
| 7 | +### Prerequisites |
9 | 8 |
|
10 | | -## Expanding the ESLint configuration |
| 9 | +- Node.js 20.19.0+ (use `nvm` to manage versions) |
| 10 | +- npm or yarn package manager |
11 | 11 |
|
12 | | -If you are developing a production application, we recommend using TypeScript with type-aware lint rules enabled. Check out the [TS template](https://github.com/vitejs/vite/tree/main/packages/create-vite/template-react-ts) for information on how to integrate TypeScript and [`typescript-eslint`](https://typescript-eslint.io) in your project. |
| 12 | +### Installation & Development |
| 13 | + |
| 14 | +1. **Clone and install dependencies:** |
| 15 | + |
| 16 | + ```bash |
| 17 | + git clone <repository-url> |
| 18 | + cd bestiary |
| 19 | + npm install |
| 20 | + ``` |
| 21 | + |
| 22 | +2. **Start development server:** |
| 23 | + |
| 24 | + ```bash |
| 25 | + npm run dev |
| 26 | + ``` |
| 27 | + |
| 28 | + Open [http://localhost:5173](http://localhost:5173) in your browser. |
| 29 | + |
| 30 | +3. **Access CMS for content management:** |
| 31 | + ```bash |
| 32 | + npm run serve:public |
| 33 | + ``` |
| 34 | + Then visit [http://localhost:8080/admin](http://localhost:8080/admin) to manage content. |
| 35 | + |
| 36 | +## 📝 Content Management |
| 37 | + |
| 38 | +### Using Decap CMS |
| 39 | + |
| 40 | +This project uses **Decap CMS** for content management, allowing you to: |
| 41 | + |
| 42 | +- ✅ **Add/edit animal categories** - Create new animal classifications |
| 43 | +- ✅ **Add/edit animals** - Add detailed animal profiles with images |
| 44 | +- ✅ **Manage homepage content** - Update site messaging |
| 45 | +- ✅ **Version control** - All changes are tracked in Git |
| 46 | + |
| 47 | +### Content Structure |
| 48 | + |
| 49 | +``` |
| 50 | +src/data/ |
| 51 | +├── categories/ # Animal category definitions |
| 52 | +│ ├── mammals.json |
| 53 | +│ ├── birds.json |
| 54 | +│ └── ... |
| 55 | +└── animals/ # Individual animal profiles |
| 56 | + ├── african-elephant.json |
| 57 | + ├── vampire-squid.json |
| 58 | + └── ... |
| 59 | +``` |
| 60 | + |
| 61 | +### Adding New Content |
| 62 | + |
| 63 | +1. **Via CMS (Recommended):** |
| 64 | + |
| 65 | + - Run `npm run serve:public` |
| 66 | + - Go to `http://localhost:8080/admin` |
| 67 | + - Use the intuitive interface to add/edit content |
| 68 | + |
| 69 | +2. **Via JSON files (Advanced):** |
| 70 | + - Create new JSON files following existing structure |
| 71 | + - Files are automatically discovered by the application |
| 72 | + |
| 73 | +## 🛠 Available Scripts |
| 74 | + |
| 75 | +- `npm run dev` - Start Vite development server |
| 76 | +- `npm run build` - Build for production |
| 77 | +- `npm run preview` - Preview production build locally |
| 78 | +- `npm run serve:public` - Serve public folder for CMS access |
| 79 | +- `npm run lint` - Run ESLint |
| 80 | + |
| 81 | +## 🏗 Tech Stack |
| 82 | + |
| 83 | +- **Frontend:** React 19 + TypeScript |
| 84 | +- **Build Tool:** Vite 7.x |
| 85 | +- **Styling:** Tailwind CSS 4.x |
| 86 | +- **Routing:** React Router DOM |
| 87 | +- **CMS:** Decap CMS (formerly Netlify CMS) |
| 88 | +- **Content:** JSON-based data files |
| 89 | + |
| 90 | +## 📁 Project Structure |
| 91 | + |
| 92 | +``` |
| 93 | +bestiary/ |
| 94 | +├── public/ |
| 95 | +│ └── admin/ # Decap CMS configuration |
| 96 | +├── src/ |
| 97 | +│ ├── components/ # Reusable React components |
| 98 | +│ ├── features/ # Feature-based modules |
| 99 | +│ │ ├── Animal/ # Animal-related logic |
| 100 | +│ │ └── AnimalCategory/ # Category-related logic |
| 101 | +│ ├── data/ # Content JSON files |
| 102 | +│ └── pages/ # Page components |
| 103 | +└── tailwind.config.js # Styling configuration |
| 104 | +``` |
| 105 | + |
| 106 | +## 🎨 Key Features |
| 107 | + |
| 108 | +- **Dynamic Content Loading** - Uses Vite's `import.meta.glob` for automatic content discovery |
| 109 | +- **Type-Safe** - Full TypeScript support with proper interfaces |
| 110 | +- **Responsive Design** - Mobile-first approach with Tailwind CSS |
| 111 | +- **SEO Ready** - Structured data and semantic HTML |
| 112 | +- **Git-based CMS** - All content changes are version controlled |
| 113 | + |
| 114 | +## 🔧 Development Tips |
| 115 | + |
| 116 | +### Adding New Animal Categories |
| 117 | + |
| 118 | +1. Create a new JSON file in `src/data/categories/` |
| 119 | +2. Follow the `AnimalCategory` interface structure |
| 120 | +3. The filename becomes the category slug automatically |
| 121 | + |
| 122 | +### Adding New Animals |
| 123 | + |
| 124 | +1. Create a new JSON file in `src/data/animals/` |
| 125 | +2. Follow the `Animal` interface structure |
| 126 | +3. Reference existing category names exactly |
| 127 | +4. The filename becomes the animal slug automatically |
| 128 | + |
| 129 | +### Path Aliases |
| 130 | + |
| 131 | +Use these convenient imports: |
| 132 | + |
| 133 | +- `~features/*` → `src/features/*` |
| 134 | +- `@/*` → `src/*` |
| 135 | + |
| 136 | +## 📦 Deployment |
| 137 | + |
| 138 | +1. **Build the project:** |
| 139 | + |
| 140 | + ```bash |
| 141 | + npm run build |
| 142 | + ``` |
| 143 | + |
| 144 | +2. **Deploy the `dist/` folder** to your hosting platform |
| 145 | + |
| 146 | +3. **Configure CMS backend** for your hosting provider (Netlify, GitHub, etc.) |
| 147 | + |
| 148 | +--- |
| 149 | + |
| 150 | +_Discover Earth's most extraordinary creatures! 🦅🐙🦎_ |
0 commit comments