diff --git a/README.md b/README.md index 23c6e483..8bd90004 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,8 @@ -# AtomCMS — Next.js +# EpicNext-CMS -AtomCMS (originally Laravel) converted to **Next.js 16** (App Router) with **Prisma 7** against the same Arcturus Morningstar MySQL/MariaDB database. -NextAuth for authentication (argon2id/bcrypt + md5→argon2id upgrade), RCON to the emulator, full public site + admin panel. +A modern, high-performance content management system for Habbo hotel emulators, built on **Next.js 16** (App Router) with **Prisma 7**. Designed to integrate seamlessly with the Arcturus Morningstar MySQL/MariaDB database. + +Features full public-facing website, administrative panel, NextAuth authentication (argon2id/bcrypt with MD5-to-argon2id upgrade path), real-time RCON communication with the emulator, and extensive extensibility. --- @@ -12,32 +13,31 @@ NextAuth for authentication (argon2id/bcrypt + md5→argon2id upgrade), RCON to | Node.js | >= 22 | | pnpm | >= 10.33.4 | | MySQL / MariaDB | 8.0+ / 10.6+ | -| Redis | optional (caching / rate limiting) | +| Redis | Optional (caching / rate limiting) | --- ## 1. Database Setup -This CMS **shares** the database with the Arcturus Morningstar emulator. -You need an existing (or empty) database. +EpicNext-CMS shares a database with the Arcturus Morningstar emulator. You may use an existing or empty database. **Create a new database:** ```sql -CREATE DATABASE IF NOT EXISTS atomcms CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; +CREATE DATABASE IF NOT EXISTS epicnext_cms CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; ``` **Use an existing emulator database:** -Point `DATABASE_URL` to your existing database — the CMS reads the emulator tables (`users`, `users_currency`, `bans`, etc.) directly. +Point `DATABASE_URL` to your existing database — the CMS reads emulator tables (`users`, `users_currency`, `bans`, etc.) directly. **Create CMS tables:** -After configuring `.env`, run the migration script (step 5). This only creates CMS-owned tables (`website_*`, `radio_*`, etc.). +After configuring `.env`, run the migration script (step 5). This creates only CMS-owned tables (`website_*`, `radio_*`, etc.), leaving the emulator schema untouched. --- ## 2. Environment Variables -Copy `.env.example` to `.env` and fill in: +Copy `.env.example` to `.env` and configure: ```bash cp .env.example .env @@ -46,13 +46,13 @@ cp .env.example .env ### Required ```dotenv -DATABASE_URL=mysql://user:password@127.0.0.1:3306/atomcms -AUTH_SECRET= # at least 32 chars, random string +DATABASE_URL=mysql://user:password@127.0.0.1:3306/epicnext_cms +AUTH_SECRET= # minimum 32 characters, random HOTEL_NAME=YourHotel APP_URL=http://localhost:3000 ``` -### Database pool (tunable) +### Database Pool (Tunable) ```dotenv DATABASE_POOL_SIZE=40 @@ -60,39 +60,39 @@ DATABASE_IDLE_TIMEOUT_MS=300000 DATABASE_CONNECT_TIMEOUT_MS=10000 ``` -### Password settings +### Password Settings ```dotenv -CONVERT_PASSWORDS=false # set to true to upgrade old md5 hashes to argon2id on login +CONVERT_PASSWORDS=false # enable to upgrade legacy MD5 hashes to argon2id on login PASSWORD_HASH=bcrypt # bcrypt (default) or argon2id ``` -### Laravel APP_KEY (for 2FA) +### Laravel APP_KEY (2FA Migration) -Only needed to read existing **Laravel-encrypted 2FA secrets**: +Required only for reading existing Laravel-encrypted 2FA secrets: ```dotenv APP_KEY=base64:xxxxxxxxxxxxxxxxxxxxxxxxxxxxx== ``` -### RCON (emulator link) +### RCON (Emulator Bridge) -For live credits, badges, motto changes, rank changes, kick/ban: +Enables live credits, badges, motto changes, rank changes, kick/ban: ```dotenv RCON_HOST=127.0.0.1 RCON_PORT=3001 ``` -### Badge upload (emulator directory) +### Badge Upload (Emulator Directory) ```dotenv BADGE_UPLOAD_DIR=/path/to/emulator/assets/c_images/album1584 ``` -### Email (password reset / notifications) +### Email (Password Reset / Notifications) -Two options — **Resend** (recommended, simple) or **SMTP**: +Two options — **Resend** (recommended) or **SMTP**: ```dotenv # Resend (preferred) @@ -115,27 +115,27 @@ GOOGLE_CLIENT_ID= GOOGLE_CLIENT_SECRET= ``` -### PayPal (credit purchases) +### PayPal (Credit Purchases) ```dotenv PAYPAL_CLIENT_ID= PAYPAL_SECRET= -PAYPAL_API=https://api-m.sandbox.paypal.com # sandbox = test, live = https://api-m.paypal.com +PAYPAL_API=https://api-m.sandbox.paypal.com # sandbox for testing; live: https://api-m.paypal.com ``` -### Redis (caching / rate limiting) +### Redis (Caching / Rate Limiting) ```dotenv REDIS_URL=redis://127.0.0.1:6379 ``` -### AI content moderation (Comments / Guestbook) +### AI Content Moderation (Comments / Guestbook) ```dotenv OPENAI_API_KEY=sk-xxxxxxxxxxxxxxxxxxxxxxxx ``` -### Notifications / logging +### Notifications & Logging ```dotenv DISCORD_WEBHOOK_URL=https://discord.com/api/webhooks/... @@ -143,12 +143,12 @@ ALERT_EMAIL=admin@yourhotel.nl LOG_LEVEL=info # debug | info | warn | error ``` -### Emulator JAR backup (jobs worker) +### Emulator JAR Backup (Jobs Worker) ```dotenv EMULATOR_JAR_PATH=/path/to/emulator.jar EMULATOR_BACKUP_DIR=/path/to/backups -EMULATOR_BACKUP_KEEP=7 # number of backups to keep +EMULATOR_BACKUP_KEEP=7 # number of backups to retain ``` --- @@ -167,7 +167,7 @@ pnpm install pnpm prisma:generate ``` -This generates TypeScript types in `src/generated/prisma/`. +Generates TypeScript types in `src/generated/prisma/`. --- @@ -177,9 +177,9 @@ This generates TypeScript types in `src/generated/prisma/`. pnpm db:migrate ``` -This executes the SQL files in `prisma/migrations/` on the database and creates the CMS tables (9 migrations). +Executes SQL files in `prisma/migrations/` against the database, creating all CMS-owned tables. -**Check status:** +**Check migration status:** ```bash pnpm db:migrate:status @@ -189,23 +189,23 @@ pnpm db:migrate:status ## 6. Configure Website Settings -After starting (step 7) and logging in as admin: +After starting the server (step 7) and logging in as an administrator: -1. Go to **Admin → CMS Settings** (`/admin/settings`) -2. At minimum, configure: +1. Navigate to **Admin → CMS Settings** (`/admin/settings`). +2. Configure the following essentials: - `hotel_name` — your hotel name - `habbo_imaging_url` — avatar image URL (default: `https://www.habbo.com/habbo-imaging/avatarimage`) - - `nitro_client_url` — Nitro client URL (see `update-Nitrov3.sh`) + - `nitro_client_url` — Nitro client URL (refer to `update-Nitrov3.sh`) - `logo_url` — path to your logo - `cms_favicon` — favicon URL - - `min_staff_rank` — minimum rank for admin access (default: 7) - - Optionally: theme colors, CAPTCHA, VPN blocking, etc. + - `min_staff_rank` — minimum rank required for admin access (default: 7) + - Optionally: theme colors, CAPTCHA, VPN blocking, and more. --- -## 7. Start the Site +## 7. Start the Server -### Development (hot reload) +### Development (Hot Reload) ```bash pnpm dev @@ -217,13 +217,13 @@ pnpm dev pnpm build && pnpm start ``` -### TypeScript check +### TypeScript Check ```bash pnpm typecheck ``` -### Run tests +### Run Tests ```bash pnpm test @@ -233,25 +233,25 @@ pnpm test ## 8. Jobs Worker (Background Tasks) -Run this as a persistent process (e.g. via systemd / screen / PM2): +Run as a persistent process (e.g., via systemd, screen, or PM2): ```bash pnpm jobs:worker ``` -This executes: -- **Daily at 03:00** — Emulator JAR backup (only if `EMULATOR_JAR_PATH` + `EMULATOR_BACKUP_DIR` are set) -- **Daily at 04:00** — Clean up old login logs (>30 days) and expired password reset tokens (>7 days) +Scheduled tasks: +- **Daily at 03:00** — Emulator JAR backup (when `EMULATOR_JAR_PATH` and `EMULATOR_BACKUP_DIR` are configured) +- **Daily at 04:00** — Cleanup of login logs older than 30 days and expired password reset tokens older than 7 days --- ## 9. First Login -1. Open `http://localhost:3000` in your browser -2. Register an account via `/register` **OR** log in with an existing account -3. To get admin access, your rank must be >= `min_staff_rank` (default 7) +1. Open `http://localhost:3000` in your browser. +2. Register an account via `/register`, or log in with an existing account. +3. To obtain administrator access, your rank must equal or exceed `min_staff_rank` (default: 7). - Set it directly in the database: `UPDATE users SET rank = 7 WHERE username = 'yourname';` -4. Go to `/admin` for the admin panel +4. Access the admin panel at `/admin`. --- @@ -259,37 +259,39 @@ This executes: ### Emulator — RCON -For live actions (credits, badges, rank changes, kick/ban), the Arcturus emulator must be running with RCON enabled on the same `RCON_HOST:RCON_PORT`. +For live actions (credits, badges, rank changes, kick/ban), the Arcturus emulator must be running with RCON enabled and accessible at the configured `RCON_HOST:RCON_PORT`. ### Client — Nitro -The `/client` page loads the Nitro client. Configure the client URL in `website_settings` via **Admin → CMS Settings** (`nitro_client_url`). +The `/client` page loads the Nitro client. Configure the client URL via **Admin → CMS Settings** (`nitro_client_url`). ### Radio -If you use a radio (e.g. Azuracast), configure: +For use with a streaming radio (e.g., Azuracast): + - `radio_now_playing_api_url` - `radio_listeners_api_url` ### CAPTCHA -Supports Cloudflare Turnstile and Google reCAPTCHA. Configure in **Admin → CMS Settings**: +Supports Cloudflare Turnstile and Google reCAPTCHA. Configure via **Admin → CMS Settings**: + - `captcha_provider` — `turnstile` or `recaptcha` - `turnstile_site_key` / `turnstile_secret` - `recaptcha_site_key` / `recaptcha_secret` -### Theme +### Theming -12 preset themes available via **Admin → Theme** (`/admin/theme`), plus fully customizable colors. +12 preset themes are available via **Admin → Theme** (`/admin/theme`), along with fully customizable color schemes. --- -## Database Overview +## Database Architecture | Component | Type | Migrations | |---|---|---| -| Emulator tables (users, items, rooms, etc.) | Existing Arcturus schema | None — CMS reads only | -| CMS tables (website_*, radio_*, etc.) | CMS-owned | `prisma/migrations/*.sql` (9 files) | +| Emulator tables (`users`, `items`, `rooms`, etc.) | Existing Arcturus schema | None — read-only for CMS | +| CMS tables (`website_*`, `radio_*`, etc.) | CMS-owned | `prisma/migrations/*.sql` (9 files) | | Migration tracking | `cms_migrations` table | Auto-created | --- @@ -302,19 +304,25 @@ Supports Cloudflare Turnstile and Google reCAPTCHA. Configure in **Admin → CMS │ └── migrations/ # 9 SQL migrations for CMS tables ├── scripts/ │ ├── apply-migrations.ts # migration runner -│ └── jobs-worker.ts # background tasks (backups, cleanup) +│ └── jobs-worker.ts # background task scheduler ├── src/ -│ ├── app/ # Next.js App Router (pages + API) +│ ├── app/ # Next.js App Router (pages & API routes) │ ├── actions/ # Server Actions -│ ├── components/ # UI components (top-header, navigation, etc.) +│ ├── components/ # UI components (header, navigation, etc.) │ ├── lib/ -│ │ ├── auth/ # NextAuth + password hashes + 2FA +│ │ ├── auth/ # NextAuth with password hashing & 2FA │ │ ├── services/ # RCON, email, currency, PayPal, etc. -│ │ ├── prisma.ts # database connection -│ │ └── redis.ts # Redis client -│ ├── messages/ # i18n (en, nl, de, fr, es, it) -│ └── env.ts # Zod validation for environment variables +│ │ ├── prisma.ts # database connection singleton +│ │ └── redis.ts # Redis client abstraction +│ ├── messages/ # i18n translations (en, nl, de, fr, es, it) +│ └── env.ts # Zod-validated environment schema ├── public/assets/ # images, icons, fonts -├── .env.example # example configuration -└── update-Nitrov3.sh # emulator + Nitro updater (Remco) +├── .env.example # environment template +└── update-Nitrov3.sh # emulator & Nitro updater utility ``` + +--- + +## License + +This project is licensed under the **CC BY-NC-SA 4.0** license. See `LICENSE` for details.