https://github.com/hoangsonww/collabnote-fullstack-app
โจ CollabNote is a full-stack note-taking app built with a modern NNS tech-stack: NestJS, Next.js, Vite, and Supabase, designed for collaborative note management. It features user authentication, note sharing, responsive design, and API documentation, making it an efficient and modern tool for organizing and sharing notes.
https://github.com/hoangsonww/collabnote-fullstack-app
apollo full-stack fullstack-development graphql nest nestjs nestjs-backend nextjs notes notes-app postgres postgresql react reactjs shadcn shadcn-ui sql supabase typescript vite
Last synced: 22 days ago
JSON representation
โจ CollabNote is a full-stack note-taking app built with a modern NNS tech-stack: NestJS, Next.js, Vite, and Supabase, designed for collaborative note management. It features user authentication, note sharing, responsive design, and API documentation, making it an efficient and modern tool for organizing and sharing notes.
- Host: GitHub
- URL: https://github.com/hoangsonww/collabnote-fullstack-app
- Owner: hoangsonww
- License: mit
- Created: 2025-01-23T13:43:14.000Z (3 months ago)
- Default Branch: master
- Last Pushed: 2025-04-09T15:43:14.000Z (24 days ago)
- Last Synced: 2025-04-09T16:48:10.480Z (24 days ago)
- Topics: apollo, full-stack, fullstack-development, graphql, nest, nestjs, nestjs-backend, nextjs, notes, notes-app, postgres, postgresql, react, reactjs, shadcn, shadcn-ui, sql, supabase, typescript, vite
- Language: TypeScript
- Homepage: https://collabnote-app.vercel.app
- Size: 6.21 MB
- Stars: 22
- Watchers: 19
- Forks: 16
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# CollabNote - A NestJS, Next.js, Vite, and Supabase Fullstack Notetaking App
[](https://nestjs.com/)
[](https://nextjs.org/)
[](https://reactjs.org/)
[](https://vitejs.dev/)
[](https://supabase.io/)
[](https://www.postgresql.org/)
[](https://mui.com/)
[](https://swagger.io/)
[](https://graphql.org/)
[](https://www.typescriptlang.org/)
[](https://www.docker.com/)
[](https://nginx.org/)
[](https://www.jenkins.io/)CollabNote is a collaborative notes platform designed to help you take, share, and manage notes effectively. It features a user-friendly interface, powerful backend APIs, and seamless deployment for both frontend and backend.
## Table of Contents
- [๐ก Features](#-features)
- [๐ Deployment](#-deployment)
- [๐ฏ Tech Stack](#-tech-stack)
- [๐ผ๏ธ UI Overview](#-ui-overview)
- [๐ Project Structure](#-project-structure)
- [๐ ๏ธ Getting Started](#-getting-started)
- [Prerequisites](#prerequisites)
- [Installation](#installation)
- [Running Locally](#running-locally)
- [Using Docker](#using-docker)
- [๐ API Documentation](#-api-documentation)
- [API Endpoints](#api-endpoints)
- [Database Schema](#database-schema)
- [Detailed Guide for Using the `openapi.yaml` File](#detailed-guide-for-using-the-openapiyaml-file)
- [๐ฅ๏ธ GraphQL Integration](#-graphql-integration)
- [๐งฐ Nginx Configuration](#-nginx-configuration)
- [๐ Kubernetes Deployment](#-kubernetes-deployment)
- [๐จ๐ปโ๐ป Continuous Integration and Deployment with Jenkins](#-continuous-integration-and-deployment-with-jenkins)
- [๐งช Testing](#-testing)
- [Backend Tests](#backend-tests)
- [Frontend Tests](#frontend-tests)
- [๐ค Contributing](#-contributing)
- [๐ License](#-license)
- [๐ Acknowledgments](#-acknowledgments)## ๐ก Features
- **Authentication**: Secure user login, registration, and password management.
- **Notes Management**: Create, update, delete, and reorder notes.
- **Sharing**: Share notes with other users seamlessly.
- **Syncing**: Real-time syncing of notes across devices, and across users, thanks to Supabase.
- **Collaboration**: Collaborate with others on notes in real-time.
- **Search**: Search for notes by title or content.
- **User Profiles**: Manage and search user profiles.
- **Profile Settings**: Update user profile information.
- **Dark Mode**: Toggle between light and dark themes.
- **Testing**: Unit and integration tests for backend and frontend.
- **Responsive Design**: Works on all devices and screen sizes.
- **Swagger Documentation**: Comprehensive API documentation.
- **CI/CD Pipeline**: Jenkins pipeline for automated testing and deployment.## ๐ Deployment
The app is deployed on Vercel for the frontend. You can access the live app at [CollabNote](https://collabnote-app.vercel.app/).
Additionally, the backend API is deployed on Render. You can access the API documentation at [CollabNote API](https://collabnote-fullstack-app.onrender.com/).
The backup frontend is also hosted on Netlify, which you can access at [CollabNote Netlify](https://notesapp-nestjs.netlify.app/).
> Note: The backend API may spin down due to inactivity. If you encounter any issues, please try again later. If inactive, the API may take a few seconds to start up, so frontend requests and Swagger may take some time to load initially.
> Important: Supabase may pause the app's database if it exceeds the free tier limits. Thus, if you are unable to log in or register, [let me know](mailto:[email protected]) and I will re-enable it (and it may take a while...)
## ๐ฏ Tech Stack
| Technology | Description |
|-----------------------------------------------|-------------------------------------|
| [NestJS](https://nestjs.com/) | Backend framework for scalable APIs |
| [Next.js](https://nextjs.org/) | React-based framework for SSR |
| [React](https://reactjs.org/) | Frontend library for building UI |
| [Vite](https://vitejs.dev/) | Frontend build tool |
| [Supabase](https://supabase.io/) | Backend-as-a-service for auth & DB |
| [PostgreSQL](https://www.postgresql.org/) | Database for storing app data |
| [TypeScript](https://www.typescriptlang.org/) | Type-safe development |
| [Swagger](https://swagger.io/) | API documentation and testing tool |
| [Docker](https://www.docker.com/) | Containerization for apps |
| [Nginx](https://nginx.org/) | Web server for load balancing |
| [Jenkins](https://www.jenkins.io/) | CI/CD tool for automated testing |
| [Render](https://render.com/) | Cloud platform for hosting apps |
| [Vercel](https://vercel.com/) | Cloud platform for frontend hosting |
| [GraphQL](https://graphql.org/) | Query language for APIs |## ๐ผ๏ธ UI Overview
### Home Page
![]()
### Home Page - Dark Mode
![]()
### Notes Dashboard
![]()
### Notes Dashboard - Dark Mode
![]()
### Add Note Modal
![]()
### Note Details Modal
![]()
### Note Editor
![]()
### Profile Page
![]()
### Profile Page - Dark Mode
![]()
### Login Page
![]()
### Login Page - Dark Mode
![]()
### Register Page
![]()
### Register Page - Dark Mode
![]()
### Reset Password Page
![]()
### Reset Password Page - Dark Mode
![]()
### API Documentation
![]()
## ๐ Project Structure
```
DocuThinker-AI-App/
โโโ backend/
โ โโโ src/
โ โ โโโ auth/
โ โ โ โโโ auth.module.ts # Authentication module
โ โ โ โโโ auth.controller.ts # Authentication controller
โ โ โ โโโ auth.service.ts # Authentication service
โ โ โ โโโ auth.schema.ts # Authentication schema
โ โ โ โโโ auth.resolver.ts # Authentication resolver
โ โ โ โโโ jwt.strategy.ts # JWT authentication strategy
โ โ โโโ dto/
โ โ โ โโโ create-note.input.ts # Create note DTO
โ โ โ โโโ update-note.input.ts # Update note DTO
โ โ โโโ notes/
โ โ โ โโโ notes.schema.ts # Notes schema
โ โ โ โโโ notes.resolver.ts # Notes resolver
โ โ โ โโโ notes.module.ts # Notes module
โ โ โ โโโ notes.controller.ts # Notes controller
โ โ โ โโโ notes.service.ts # Notes service
โ โ โโโ profile/
โ โ โ โโโ profile.schema.ts # Profile schema
โ โ โ โโโ profile.resolver.ts # Profile resolver
โ โ โ โโโ profile.module.ts # Profile module
โ โ โ โโโ profile.controller.ts # Profile controller
โ โ โ โโโ profile.service.ts # Profile service
โ โ โโโ supabase/
โ โ โ โโโ supabase.module.ts # Supabase module
โ โ โ โโโ supabase.service.ts # Supabase service
โ โ โโโ types/
โ โ โ โโโ authenticated-request.ts # Authenticated user type
โ โ โโโ schema.gql # GraphQL schema
โ โ โโโ app.module.ts # Main app module
โ โ โโโ app.test.ts # App test file
โ โ โโโ main.ts # Main entry point for the backend
โ โโโ .env # Environment variables (git-ignored)
โ โโโ build-backend.sh # Shell script to build the backend
โ โโโ Dockerfile # Docker configuration file
โ โโโ docker-compose.yml # Docker Compose file for the backend
โ โโโ package.json # Project dependencies and scripts
โ โโโ package-lock.json # Lock file for dependencies
โ โโโ tsconfig.json # TypeScript configuration file
โ โโโ vercel.json # Vercel configuration file
โ
โโโ frontend/
โ โโโ public/
โ โ โโโ favicon.ico # Favicon for the app
โ โ โโโ (other images...) # Other images used in the app
โ โ โโโ index.html # Main HTML template
โ โ โโโ manifest.json # Manifest for PWA settings
โ โโโ src/
โ โ โโโ assets/ # Static assets like images and fonts
โ โ โ โโโ logo.png # App logo or images
โ โ โโโ components/
โ โ โ โโโ LoadingOverlay.tsx # Loading overlay component
โ โ โ โโโ PasswordField.tsx # Password field component
โ โ โโโ layout/
โ โ โ โโโ ResponsiveDrawer.tsx # Responsive drawer component
โ โ โ โโโ Footer.tsx # Footer component
โ โ โ โโโ Layout.tsx # Main layout component
โ โ โ โโโ Navbar.tsx # Navbar component
โ โ โโโ routes/
โ โ โ โโโ ForgotPasswordPage.tsx # Forgot password page
โ โ โ โโโ HomePage.tsx # Home page
โ โ โ โโโ LoginPage.tsx # Login page
โ โ โ โโโ NoteDetailsPage.tsx # Note details page
โ โ โ โโโ NotesPage.tsx # Notes dashboard page
โ โ โ โโโ ProfilePage.tsx # Profile page
โ โ โ โโโ RegisterPage.tsx # Register page
โ โ โโโ theme/
โ โ โ โโโ index.ts # Theme configuration
โ โ โ โโโ ThemeContext.tsx # Theme context provider
โ โ โ โโโ ThemeProviderWrapper.tsx # Theme provider wrapper
โ โ โโโ App.tsx # Main App component
โ โ โโโ App.test.tsx # App test file
โ โ โโโ App.css # Global CSS 1
โ โ โโโ index.css # Global CSS 2
โ โ โโโ main.tsx # Main entry point for the frontend
โ โ โโโ vite-env.d.ts # Vite environment types
โ โโโ .gitignore # Git ignore file
โ โโโ package.json # Project dependencies and scripts
โ โโโ package-lock.json # Lock file for dependencies
โ โโโ Dockerfile # Docker configuration file
โ โโโ docker-compose.yml # Docker Compose file for the frontend
โ โโโ index.html # Main HTML template
โ โโโ build-frontend.sh # Shell script to build the frontend
โ โโโ vercel.json # Vercel configuration file
โ โโโ vite.config.ts # Vite configuration file
โ โโโ tsconfig.app.json # TypeScript configuration file for the app
โ โโโ tsconfig.node.json # TypeScript configuration file for Node
โ โโโ tsconfig.json # TypeScript configuration file
โ
โโโ kubernetes/ # Kubernetes configuration files
โ โโโ backend-deployment.yaml # Deployment configuration for the backend
โ โโโ backend-service.yaml # Service configuration for the backend
โ โโโ frontend-deployment.yaml # Deployment configuration for the frontend
โ โโโ frontend-service.yaml # Service configuration for the frontend
โ โโโ configmap.yaml # ConfigMap configuration for environment variables
โ
โโโ nginx/
โ โโโ start_nginx.sh # Shell script to start NGINX
โ โโโ nginx.conf # NGINX configuration file for load balancing and caching
โ โโโ docker-compose.yml # Docker Compose file for NGINX
โ โโโ Dockerfile # Docker configuration file for NGINX
โ
โโโ images/ # Images for the README
โโโ .env # Environment variables file for the whole app
โโโ docker-compose.yml # Docker Compose file for containerization
โโโ package.json # Project dependencies and scripts
โโโ package-lock.json # Lock file for dependencies
โโโ vercel.json # Vercel configuration file
โโโ openapi.yaml # OpenAPI specification for API documentation
โโโ jenkins_cicd.sh # Shell script for managing the Jenkins CI/CD pipeline
โโโ .gitignore # Git ignore file
โโโ LICENSE # License file for the project
โโโ README.md # Comprehensive README for the whole app
โโโ (and many more files...) # Additional files and directories not listed here
```## ๐ ๏ธ Getting Started
Follow these steps to set up the project on your local machine.
### Prerequisites
Ensure you have the following installed:
- **Node.js**: v18 or above
- **npm**: v9 or above
- **PostgreSQL**: v15 or above
- **Docker** (Optional)### Installation
1. **Clone the Repository**:
```bash
git clone https://github.com/hoangsonww/CollabNote-Fullstack-App.git
cd CollabNote-Fullstack-App
```2. **Set Up Backend**:
```bash
cd backend
npm install
```3. **Set Up Frontend**:
```bash
cd ../frontend
npm install
```4. **Configure Environment Variables**:
- Create `.env` files in the `backend` and `frontend` directories.
- For **backend** (`backend/.env`):
```env
SUPABASE_URL=your_supabase_url
SUPABASE_SERVICE_KEY=your_supabase_service_key
JWT_SECRET=your_jwt_secret
JWT_EXPIRES_IN=jwt_expiry_time(eg. 1d)
PORT=4000
```
- For **frontend** (`frontend/.env`):
```env
VITE_API_URL=http://localhost:4000
```### Running Locally
1. **Start the Backend**:
```bash
cd backend
npm run start:dev
```2. **Start the Frontend**:
```bash
cd ../frontend
npm run dev
```3. Open your browser:
- **Frontend**: [http://localhost:5172](http://localhost:5172) or your selected Vite port
- **Backend**: [http://localhost:4000](http://localhost:4000)
- **Swagger**: [http://localhost:4000/api](http://localhost:4000/api)### Using Docker
1. **Build and Run Docker Containers**:
```bash
docker-compose up --build
```2. **Access the Services**:
- Backend: [http://localhost:4000](http://localhost:4000)
- Frontend: [http://localhost:3000](http://localhost:3000)## ๐ API Documentation
All APIs are documented in Swagger. Access the documentation at [http://localhost:4000/api](http://localhost:4000/api).
### API Endpoints
| Method | Endpoint | Description |
|--------|----------------------------|-------------------------------------------|
| POST | `/auth/register` | Register a new user |
| POST | `/auth/login` | Login an existing user |
| POST | `/auth/check-email-exists` | Check if an email exists |
| POST | `/auth/reset-password` | Reset a user's password |
| GET | `/notes` | Retrieve user notes |
| POST | `/notes` | Create a new note |
| PATCH | `/notes/{id}` | Update a note |
| DELETE | `/notes/{id}` | Delete a note |
| POST | `/notes/{id}/share` | Share a note with another user |
| POST | `/notes/reorder` | Reorder user notes |
| GET | `/profile/me` | Retrieve the authenticated user's profile |
| GET | `/profile/userId/{id}` | Retrieve a user profile by ID |
| GET | `/profile/search` | Search for a user profile by username |
| PATCH | `/profile/me` | Update the authenticated user's profile |### Database Schema
The database schema consists of the following tables:
![]()
Note the `user_id` foreign key relationship between the `notes` and `users` tables. Additionally, more tables will be added as the app grows in the future!
### Detailed Guide for Using the `openapi.yaml` File
1. **View the API Documentation**
- Open [Swagger Editor](https://editor.swagger.io/).
- Upload the `openapi.yaml` file or paste its content.
- Visualize and interact with the API documentation.2. **Test the API**
- Import `openapi.yaml` into [Postman](https://www.postman.com/):
- Open Postman โ Import โ Select `openapi.yaml`.
- Test the API endpoints directly from Postman.
- Or use [Swagger UI](https://swagger.io/tools/swagger-ui/):
- Provide the file URL or upload it to view and test endpoints.3. **Generate Client Libraries**
- Install OpenAPI Generator:
```bash
npm install @openapitools/openapi-generator-cli -g
```
- Generate a client library:
```bash
openapi-generator-cli generate -i openapi.yaml -g -o ./client
```
- Replace `` with the desired programming language.4. **Generate Server Stubs**
- Generate a server stub:
```bash
openapi-generator-cli generate -i openapi.yaml -g -o ./server
```
- Replace `` with the desired framework.5. **Run a Mock Server**
- Install Prism:
```bash
npm install -g @stoplight/prism-cli
```
- Start the mock server:
```bash
prism mock openapi.yaml
```6. **Validate the OpenAPI File**
- Use [Swagger Validator](https://validator.swagger.io/):
- Upload `openapi.yaml` or paste its content to check for errors.This guide enables you to view, test, and utilize the API.
## **๐ฅ๏ธ GraphQL Integration**
The CollabNote API also supports GraphQL for querying and manipulating data.
To access, navigate to [https://collabnote-fullstack-app.onrender.com/graphql](https://collabnote-fullstack-app.onrender.com/graphql) and use the GraphQL Playground to interact with the API.
Alternatively, you can start a local backend server following the steps above and access the GraphQL Playground at [http://localhost:4000/graphql](http://localhost:4000/graphql).
You should see something like this:
![]()
You can query something like this:
```graphql
query {
getUserNotes(userId: 1, searchQuery: "", tagFilter: "") {
id
title
content
tags
dueDate
color
pinned
sharedWithUserIds
sortOrder
username
}
}
```This query fetches all notes for a user with ID 1. You can modify the query to suit your needs.
Feel free to explore the GraphQL API and test different queries and mutations! Consult the [GraphQL documentation](https://graphql.org/learn/) for more information.
## **๐งฐ Nginx Configuration**
- The `nginx` directory contains an Nginx configuration for reverse proxy and load balancing.
- Use Nginx to route requests to multiple instances of the API.
- Configure SSL termination and caching for improved performance.
- The Nginx configuration looks like this:```nginx
server {
listen 80;
server_name localhost;location / {
proxy_pass http://localhost:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}
```- For more information, refer to the [Nginx documentation](https://nginx.org/en/docs/) and the [Nginx Directory](nginx/README.md).
## **๐ Kubernetes Deployment**
1. Create Kubernetes manifests for the services.
2. Deploy to a cluster:
```bash
kubectl apply -f kubernetes/
```3. Access the application using the service URL.
## **๐จ๐ปโ๐ป Continuous Integration and Deployment with Jenkins**
The CollabNote API also includes a Jenkins pipeline for continuous integration and deployment.
1. **Pipeline Configuration:** The `Jenkinsfile` defines the CI/CD pipeline stages, including code checkout, dependency installation, testing, building, and deployment. Add it to the root of the project.
2. **Job Setup:** Create a pipeline job in Jenkins, point it to the repository, and configure it to use the `Jenkinsfile`.
3. **Automated Testing:** The pipeline runs `npm test` to ensure all tests pass before proceeding to the build or deployment stages.
4. **Environment Variables:** Use Jenkins environment variables to securely manage secrets like API keys and credentials for services such as MongoDB, Redis, or Render.
5. **Deployment:** The pipeline supports deploying the application using Render or directly to a server using SSH and PM2.
6. **Webhooks:** Integrate GitHub/GitLab webhooks to trigger builds automatically on code changes.
7. **Notifications:** Add Slack or email notifications in the pipeline to inform team members about build and deployment statuses.
## ๐งช Testing
We also feature Jest unit and integration tests for both the backend and frontend. Run the tests to ensure the app functions as expected.
### Backend Tests
```bash
cd backend
npm run test
```### Frontend Tests
```bash
cd frontend
npm run test
```## ๐ค Contributing
Contributions are welcome! Please fork the repository and create a pull request.
## ๐ License
This project is licensed under the [MIT License](https://opensource.org/licenses/MIT).
## ๐ Acknowledgments
- **Son Nguyen**: Creator and maintainer of CollabNote.
- **NestJS, Next.js, React, Vite**: The tech stack that powers this project.---
Thank you for visiting CollabNote today! **Happy notetaking!** ๐๐
[๐ Back to Top](#collabnote---a-nestjs-nextjs-vite-and-supabase-fullstack-notetaking-app)