- Pros: good practice
- basic
react19next.js15 app router
- project standard
eslintprettier
- styling
- tailwind css
- UI library
shadcn/uiradix/ui
- app state management
zustand
- libs
nuqs
- basic
- Cons:
- api: convex
- authentication: clerk
- library limitations
- tiptap
- liveblocks
- if any of those free services is down, it is hard for me to debug
node -v
npm -v
npx -v
npx create-next-app@15.0.3
# + name: google-docs
# + ts
# + eslint
# + tailwind
# + src
# + app router
# - turbopack
# - import
cd google-docs
code .- setup shadcn/ui
- next15 + react19rc
# read version installed
npx shadcn@latest --version
# install inside nextjs project
npx shadcn@2.1.6 init
# + new york
# + neutral
# + css variable
# + --legacy-peer-deps- install ui components
npx shadcn@2.1.6 add --all
# + --legacy-peer-deps- test ui Button in page
npm install -D prettier prettier-plugin-tailwindcss eslint-config-prettier --legacy-peer-deps- read routing
- page.tsx / layout.tsx
- dynamic
[folderName]/ group(folderName) - Link component
-
editor.tsx
-
- support react19
--legacy-peer-depsflag to remove error
- support react19
npm i @tiptap/react@2.10.2 @tiptap/pm@2.10.2 @tiptap/starter-kit@2.10.2 --legacy-peer-deps- integration
- style the editor and print mode
- custom tiptap extensions style in global css
- extensions and add styles
- heading
- bullet-list
- + task-list
- + table
- + image
- no - ImageResize non official extension
npm i @tiptap/extension-task-list@2.10.2 @tiptap/extension-task-item@2.10.2 --legacy-peer-deps
npm i @tiptap/extension-table@2.10.2 @tiptap/extension-table-row@2.10.2 @tiptap/extension-table-header@2.10.2 @tiptap/extension-table-cell@2.10.2 --legacy-peer-deps
npm i @tiptap/extension-image@2.10.2 --legacy-peer-deps- toolbar.tsx
- zustand
- use-editor-store.ts
- tip-tap history
npm i zustand@5.0.1 --legacy-peer-deps- more Toolbar functions
npm i @tiptap/extension-underline@2.10.2 --legacy-peer-deps- FontFamilyButton
- ui DropdownMenu
- font-family
- with Mark text-style
- select the text to change font family
npm i @tiptap/extension-text-style@2.10.2 @tiptap/extension-font-family@2.10.2 --legacy-peer-deps- HeadingLevelButton
- ui DropdownMenu
- heading
- be consistent with global css h1 - h6
npm i @tiptap/extension-heading@2.10.2 --legacy-peer-deps- TextColorButton
- TextHighlightButton
- Marks Highlight
- configure multicolor
- Marks Highlight
npm i react-color@2.19.3 --legacy-peer-deps
npm i --save-dev @types/react-color@3.0.12 --legacy-peer-deps
npm i @tiptap/extension-color@2.10.2 --legacy-peer-deps
npm i @tiptap/extension-highlight@2.10.2 --legacy-peer-deps- LinkButton
- Link
- configure & global css
npm i @tiptap/extension-link@2.10.2 --legacy-peer-deps- ImageButton
- input file hidden
- AlignButton
- text-align
- configure
- text-align
npm i @tiptap/extension-text-align@2.10.2 --legacy-peer-deps- ListButton
- new extension
- font-size.ts
- FontSizeButton
- line-height.ts
- LineHeightButton
- recommend cursor ai-editor
- ruler.tsx
- Ruler
- more accurate!
- Marker
- Ruler
- public/logo.svg
- navbar.tsx
- document-input.tsx
npm i react-icons@5.3.0 --legacy-peer-deps- bad save functionalities
update project structure:
- root layout.tsx
- font: Inter
- nuqs -> layout.tsx
npm i nuqs@2.2.3 --legacy-peer-deps- page.tsx -> (home)/page.tsx(update css and Navbar)
- (home)/navbar.tsx(SearchInput)
- (home)/search-input.tsx(useSearchParam)
- hooks/use-search-param.ts
- templates-gallery.tsx
- constants/templates.ts
- public/templates/xxx.svg
- login to convex
- new projectName
antonio - script
"convex": "convex dev"
- new projectName
- convex docs
npm install convex@1.17.3 --legacy-peer-deps
npx convex dev
# login to convex?
# an existing project
# 'antonio'
# after add the script to package.json
npm run convex-
context/convex-client-provider.tsx (paste)
-
update root layout.tsx (convex)
-
convex/schema.ts
- defineTable
- index
-
convex/documents.ts
- query
get
- query
-
(home)/page.tsx
- useQuery
- TODO: Next.js + Convex + Clerk Diagram
- Convex + Clerk + Next.js + Clerk
- create application
- follow its framework steps
- install
@clerk/nextjs - add env variables
- src/middleware.ts
- install
- Create a JWT Template
- Clerk dashboard app -> Configure -> JWT templates ->
convex-> save - Do NOT rename the JWT token, it must be called
convex - Copy the Issuer URL
- Clerk dashboard app -> Configure -> JWT templates ->
- Create the auth config
- auth.config.ts
- modify convex-client-provider
- fullscreen-loader.tsx
- navbar + UserIcon
npm install @clerk/nextjs@6.5.1 --legacy-peer-deps-
convex/documents
create- TODO: integration with tanstack
-
templates-gallery.tsx
- useMutation() create doc
-
convex/documents
getwith pagination -
(home)/page.tsx (+DocumentsTable)
- usePaginatedQuery()
-
documents-table.tsx
- ui table
- DocumentRow
- DocumentMenu
- ui dropdown menu
- convex/documents
removeByIdupdateById - rename-dialog
- ui Dialog
- conflicts with dropdown and dialog
modals
- remove-dialog
- ui AlertDialog
- convex/documents
get - (home)page.tsx useSearchParam
-
clerk dashboard -> configure -> organization settings (enable)
-
Clerk dashboard -> Configure -> JWT templates ->
convex- claims add
"organization_id": {{org.id}}
- claims add
-
(home / doc)navbar.tsx OrganizationSwitcher + redirects
-
convex/documents
creategetupdate- add organizationId
-
Toaster
- root layout
- remove-dialog.tsx rename-dialog.tsx template-gallery.tsx
toast
- live block
- dashboard quick start -> text editor -> liveblocks tiptap -> next.js -> follow the steps
- room.tsx, threads.tsx
- update page.tsx editor.tsx, ...
- eslint error fixed
npm install @liveblocks/client@2.12.2 @liveblocks/react@2.12.2 @liveblocks/react-ui@2.12.2 @liveblocks/react-tiptap@2.12.2 --legacy-peer-deps
# error missing deps then
npm i @tiptap/extension-collaboration@2.10.2 @tiptap/extension-collaboration-cursor@2.10.2 y-protocols@1.0.6 --legacy-peer-deps
npx create-liveblocks-app@2.20240816.0 --init --framework react- env liveblocks API key
npm i @liveblocks/node@2.12.2 --legacy-peer-deps- api/liveblocks-auth/route.ts
- convex/documents
getById - global error
- FIXME
- room.tsx
- resolve users mentionSuggestions
[documentId]/actions.ts- avatars.tsx + liveblocks.config.ts
- inbox.tsx -> navbar.tsx
- room.tsx authEndpoint
- convex/documents
getByIds+ actions.ts - global.css liveblocks z-index issue
- liveblocks config storage
- room.tsx initialStorage
- editor.tsx useStorage
- ruler.tsx useMutation
-
document.tsx
-
[documentId]/page.tsx -
loading.tsx
-
navbar.tsx props document, update docTitle
-
DocumentInput props title + id
- use-debounce.ts
- icons status
-
navbar.tsx
- new doc (api.create)
- rename doc
- remove doc
- editor.tsx
- document.tsx
- threads.tsx
- constants/editor.ts