**RSPS Guide Builder app with Laravel backend + React frontend**. This will be closer to a **Notion-lite** experience, with drag-and-drop guides, tags, TOC, copy buttons, and HTML export. --- # πŸ“˜ RSPS Guide Builder (Laravel API + React Frontend) --- ## πŸ”Ή Overall Architecture * **Backend: Laravel** * REST or GraphQL API (`/api/guides`, `/api/tags`). * Handles authentication (Laravel Sanctum recommended). * Stores guides in DB as JSON. * Provides **export endpoint** β†’ generates `.html` file with inline CSS/JS. * **Frontend: React (Vite or CRA)** * SPA with React Router. * Uses `react-editor-js` or `tiptap-react` for Notion-style editing. * Components: Editor, Viewer, TOC, GuideList. * Styled with Tailwind (dark + blue theme). --- ## πŸ”Ή Database Design (Laravel) **`guides`** ```sql id BIGINT AUTO_INCREMENT PRIMARY KEY title VARCHAR(255) slug VARCHAR(255) UNIQUE description TEXT NULL content JSON -- Editor.js or TipTap JSON created_at TIMESTAMP updated_at TIMESTAMP ``` **`tags`** ```sql id BIGINT AUTO_INCREMENT PRIMARY KEY name VARCHAR(100) UNIQUE slug VARCHAR(100) UNIQUE ``` **`guide_tag`** ```sql guide_id BIGINT tag_id BIGINT PRIMARY KEY (guide_id, tag_id) ``` --- ## πŸ”Ή Backend API (Laravel) * `GET /api/guides` β†’ List all guides (with tags). * `POST /api/guides` β†’ Create new guide. * `GET /api/guides/{id}` β†’ Fetch guide by ID. * `PUT /api/guides/{id}` β†’ Update guide (title + content JSON). * `DELETE /api/guides/{id}` β†’ Delete guide. * `GET /api/guides/{id}/export` β†’ Returns self-contained `.html`. --- ## πŸ”Ή React Project Structure ``` src/ components/ Editor/GuideEditor.jsx Viewer/GuideViewer.jsx TOC/TOC.jsx GuideList.jsx CodeBlock.jsx TagFilter.jsx pages/ GuideEditorPage.jsx GuideViewerPage.jsx GuideListPage.jsx api/ guides.js tags.js App.jsx index.jsx ``` --- ## πŸ”Ή React Components ### 1. **GuideEditor.jsx** (Notion-style editor) Using `react-editor-js`: ```jsx import React, { useRef } from 'react'; import { createReactEditorJS } from 'react-editor-js'; import Header from '@editorjs/header'; import Code from '@editorjs/code'; import Paragraph from '@editorjs/paragraph'; import Image from '@editorjs/image'; const ReactEditorJS = createReactEditorJS(); const GuideEditor = ({ initialData, onSave }) => { const editorCore = useRef(null); const handleSave = async () => { const savedData = await editorCore.current.save(); onSave(savedData); }; return (
(editorCore.current = instance)} tools={{ header: Header, code: Code, paragraph: Paragraph, image: Image }} />
); }; export default GuideEditor; ``` --- ### 2. **GuideViewer.jsx** (Render guide JSON β†’ HTML) ```jsx import React from 'react'; import Prism from 'prismjs'; import 'prismjs/components/prism-php'; import 'prismjs/themes/prism-tomorrow.css'; const GuideViewer = ({ guide }) => { const blocks = guide.content.blocks; return (

{guide.title}

{guide.description}

{blocks.map((block, i) => { if (block.type === 'header') { return

{block.data.text}

; } if (block.type === 'paragraph') { return

{block.data.text}

; } if (block.type === 'code') { return (
                {block.data.code}
              
); } return null; })}
); }; export default GuideViewer; ``` --- ### 3. **TOC.jsx** (Sidebar with search) ```jsx import React, { useState } from 'react'; const TOC = ({ blocks }) => { const [search, setSearch] = useState(""); return ( ); }; export default TOC; ``` --- ## πŸ”Ή Pages * **GuideListPage** β†’ list guides, filter by tag. * **GuideEditorPage** β†’ load guide + render ``. * **GuideViewerPage** β†’ render `` + `` side by side. --- ## πŸ”Ή Export Flow 1. In React β†’ user clicks **Export** button. 2. Calls backend: `GET /api/guides/{id}/export`. 3. Laravel generates a **Blade view** with inline CSS + JS β†’ downloads `.html`. Example Laravel export controller: ```php public function export(Guide $guide) { $html = view('guides.export', compact('guide'))->render(); $fileName = Str::slug($guide->title).'.html'; return response($html) ->header('Content-Type', 'text/html') ->header('Content-Disposition', "attachment; filename={$fileName}"); } ``` --- ## πŸ”Ή Styling (Dark + Blue) Tailwind config colors: ```js theme: { extend: { colors: { darkbg: "#0d1117", darkpanel: "#161b22", border: "#30363d", text: "#c9d1d9", accent: "#58a6ff", }, }, } ``` --- ## πŸ”Ή Extra Features You Can Add * **Custom Editor.js blocks**: β€œNoteBlock” for tips/warnings. * **Drag-and-drop reorder (React DnD or SortableJS)** inside the editor. * **Tag-based homepage**: Guides grouped by Interfaces / Packets / Systems. * **Versioning**: Save multiple revisions per guide. * **Offline bundle**: Export multiple guides at once as `.zip` of HTML files. --- βœ… This gives you: * React-powered **Notion-like editor** (Editor.js + React). * Laravel backend storing JSON + handling exports. * Polished viewer with **TOC + copy buttons**. * Same **dark + blue theme** across editor, viewer, and exports. ---