iklan

 # NovelYra — Novel Reading Website


PHP 8.2+ native (no framework) + React via CDN (Babel standalone, no build step) + Tailwind CSS via CDN.

Built on the `database.sql` schema you provided. No admin panel (managed externally as you requested).


## 1. Requirements

- PHP 8.2+ with PDO MySQL extension

- MySQL / MariaDB

- Apache with `mod_rewrite` (an `.htaccess` is included in `/public`)


## 2. Setup

1. Import your `database.sql` into a MySQL database.

2. Open `config/config.php` and set your DB credentials (`DB_HOST`, `DB_NAME`, `DB_USER`, `DB_PASS`).

3. Point your web server's **document root to the `/public` folder** (not the project root — this keeps `config/`, `src/`, `templates/` outside the public web path for security).

4. Make sure `storage/` is writable by the web server (used for error logs).

5. Visit your domain — home page, novel pages, chapters, etc. should load immediately once the DB has data.


For local testing only (not production), you can run:

```

php -S localhost:8000 -t public

```


## 3. URL Structure

- `/` — Home

- `/browse` — Browse / filter all novels

- `/{novel-slug}` — Novel detail page (e.g. `/reincarnation-paradise-espanol`)

- `/{novel-slug}/{chapter-slug}` — Chapter reader (e.g. `/reincarnation-paradise-espanol/capitulo-1`)

- `/author/{slug}` — Author page (novels grouped automatically by `author_id`, so multiple novels by the same author name are merged under one author page)

- `/genre/{slug}`, `/tag/{slug}`, `/type/{slug}` — Taxonomy pages (`type` = Web Novel / Light Novel / Published Novel / Fan Fiction)

- `/authors` — A–Z author directory

- `/search?q=...` — Search

- `/login`, `/register`, `/logout`, `/forgot-password`

- `/profile`, `/profile/bookmarks`, `/profile/favorites`, `/profile/history`, `/profile/notifications`, `/profile/settings`

- `/u/{username}` — Public user profile

- `/about`, `/contact`, `/privacy-policy`, `/terms-of-service`, `/dmca`

- `/sitemap.xml`

- `/api/*` — JSON endpoints used by the frontend (bookmark, favorite, like, rate, follow, comment, reading progress, search-suggest)


## 4. Features Implemented

- Novel listing with filters (genre / tag / type / status) and sorting (latest, popular, trending, top rated, A–Z)

- Novel detail page: cover, synopsis, genres/tags, rating (1–10 stars), bookmark, favorite, follow-for-updates, chapter list with sort toggle, related novels, comments

- Chapter reader with:

  - Reading settings panel (font size, font family, line height, content width, light/sepia/dark reading theme) — saved to `localStorage` and to the user's account if logged in

  - **Free Text-to-Speech** using the browser's built-in Web Speech API — reads paragraph by paragraph with live highlighting

  - **Google Translate integration** (free widget) — language switcher in the navbar. TTS reads the *live DOM text*, so if a reader translates the page with Google Translate, the read-aloud voice automatically follows the translated language

  - Auto-saves reading progress per user

  - Prev/Next chapter navigation + chapter quick-jump dropdown

- Author pages — novels are grouped by `author_id`, so the same author's multiple novels appear together automatically

- Genre / Tag / Type browse pages

- Full authentication: register, login (with lockout after failed attempts), remember-me, logout, password change

- User profile: dashboard, bookmarks, favorites, reading history (with progress %), notifications, settings (profile info, password, reading preferences)

- Threaded comments (top-level + replies) with like button, on both novel and chapter pages

- Dark / light mode toggle (persisted, system-aware, flash-free on load)

- Responsive navbar with live search suggestions

- `sitemap.xml` generation from the database

- Static pages: About, Contact, Privacy Policy, Terms of Service, DMCA


## 5. Project Structure

```

public/              <-- web server document root

  index.php          <-- front controller / router

  .htaccess

  assets/

    css/style.css

    js/core.js        (vanilla JS: theme, navbar, search, toggle buttons, ratings)

    js/app.jsx         (React via CDN+Babel: comments widget, reader settings + TTS)

config/config.php     <-- DB credentials & site settings (EDIT THIS)

src/

  Database.php

  Auth.php

  helpers.php

  Models/              (Novel, Chapter, Author, Genre, Tag, Comment, UserInteraction)

  Controllers/          (Home, Novel, Chapter, Author, Taxonomy, Search, Auth, Profile, Api, Sitemap, Page)

templates/             <-- all HTML views (plain PHP templates)

  partials/

  auth/

  profile/

storage/logs/          <-- PHP error log location

```


## 6. Notes

- Chapter content is rendered from the `chapters.content` column. If it's stored as plain text with line breaks, the reader auto-wraps each line into a `<p>` tag; if it already contains `<p>` HTML, it's rendered as-is.

- Comments, ratings, bookmarks, favorites, follows, and reading history all map directly to your existing schema (`comments`, `ratings`, `bookmarks`, `favorites`, `novel_follows`, `author_follows`, `reading_history`, `notifications`, `comment_likes`, `likes`).

- CSRF protection is applied to all state-changing requests (forms + `/api/*` POST endpoints).

- `APP_ENV` in `config/config.php` should stay `'production'` on your live server (set to `'local'` only for debugging, since it disables error display).


Belum ada Komentar untuk " "

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel