NotionBackend
Backend for notion_clone app using Fastify, Prisma, NeonDB. Leveraging socket.io for real-time features, interactive whiteboard, real-time text-editor.
fastifyneondbnodejspostgresqlprisma-ormsocket-io
1
Stars0
Forks1
WatchersUpdated Sep 4, 2025
README
JavaScript
Notion_Backend
A backend service for a Notion-style clone with real-time collaboration features.
Tech Stack
- Fastify – High-performance web framework for Node.js.
- Prisma – Type-safe ORM for database management.
- NeonDB – Serverless Postgres-compatible database.
- Socket.io – Real-time communication between server and clients.
Features
- Real-time text editing.
- Collaborative whiteboard.
- Persistent data storage with Postgres.
- Optimized API using Fastify.
Installation
-
Clone the repository:
bashgit clone https://github.com/Navidreza80/Notion_Backend.git cd Notion_Backend
-
Install dependencies:
bashnpm install
-
Set up environment variables: Create a
file in the root folder and add the following:.env
envDATABASE_URL="your_neon_db_connection_string" PORT=4000
-
Run Prisma migrations:
bashnpx prisma migrate dev
-
Start the development server:
bashnpm run dev
API Endpoints
Method | Endpoint | Auth | Description |
---|---|---|---|
|
| ✅ | Create a new page |
|
| ✅ | Get all pages of the authenticated user (filtered) |
|
| ✅ | Get all pages (no filtering) |
|
| ✅ | Get a page by its ID |
|
| ✅ | Get all sub-pages of a given parent page |
|
| ✅ | Update a page by its ID |
|
| ✅ | Delete a page by its ID |
Method | Endpoint | Auth | Description |
---|---|---|---|
|
| ✅ | Create a new workspace |
|
| ✅ | Get a workspace by ID |
|
| ✅ | Update a workspace (only if creatorId matches) |
|
| ✅ | Delete a workspace (only if creatorId matches) |
Real-time Events (Socket.io)
- – Join a page room.
join_page
- – Update page content in real-time.
update_content
- – Sync whiteboard changes.
draw_whiteboard
Scripts
- – Start development server with hot-reload.
npm run dev
- – Build the project for production.
npm run build
- – Start production server.
npm start
License
This project is licensed under the MIT License.