The backend API for my collaborative notes application - a robust NestJS server that powers real-time note editing, user authentication, and hierarchical folder management. Built to handle multiple users collaborating on documents simultaneously with seamless real-time synchronization.
- 🔐 Secure Authentication - Better Auth integration with session management
- 📁 Hierarchical Folders - Nested folder structure with unlimited depth
- 📝 Real-time Collaboration - Live note editing with Socket.io
- 💬 Real-time Messaging - Built-in chat system for collaborators
- 📊 RESTful API - Clean, documented endpoints with Swagger
- 🔒 Security First - Helmet middleware, CORS, input validation
- 🗃️ PostgreSQL Database - Reliable data persistence with connection pooling
- 📋 API Documentation - Auto-generated Swagger docs
- Framework: NestJS (Node.js)
- Language: TypeScript
- Database: PostgreSQL
- Authentication: Better Auth
- Real-time: Socket.io
- Validation: class-validator, class-transformer
- Documentation: Swagger/OpenAPI
- Security: Helmet, CORS
- Testing: Jest
- Node.js (v18 or higher)
- PostgreSQL database
- npm or yarn
-
Clone the repository
git clone https://github.com/kubilayture/collaborative.notes.backend.git cd collaborative.notes.backend -
Install dependencies
npm install
-
Environment Setup
Create a
.envfile in the root directory:# Database Configuration DB_HOST=localhost DB_PORT=5432 DB_USERNAME=your_db_username DB_PASSWORD=your_db_password DB_NAME=collaborative_notes # Authentication BETTER_AUTH_SECRET=your_secret_key_here # Server Configuration PORT=4000 FRONTEND_URL=http://localhost:5173
-
Database Setup
Make sure PostgreSQL is running and create the database:
CREATE DATABASE collaborative_notes;
-
Start the server
# Development with hot reload npm run start:dev # Production build npm run build npm run start:prod
Once the server is running, visit:
- Swagger UI: http://localhost:4000/api
- API Base URL: http://localhost:4000
# Run unit tests
npm run test
# Run tests in watch mode
npm run test:watch
# Run e2e tests
npm run test:e2e
# Generate test coverage
npm run test:covsrc/
├── lib/ # Shared utilities and configurations
│ └── auth.ts # Better Auth configuration
├── modules/ # Feature modules (when added)
├── main.ts # Application entry point
└── app.module.ts # Root module
test/ # E2E tests
npm run start:dev # Start development server with hot reload
npm run build # Build for production
npm run start:prod # Start production server
npm run lint # Run ESLint with auto-fix
npm run format # Run Prettier formatting
npm run test # Run unit tests
npm run test:e2e # Run end-to-end tests- Frontend: Collaborative Notes Web - React frontend application
This project is part of my personal portfolio. Feel free to explore the code!
This is a personal project, but I'm open to suggestions and feedback. Feel free to open an issue or reach out!
Built with ❤️ using NestJS and TypeScript