A full-stack note-taking application built with Node.js, Express, PostgreSQL, and vanilla JavaScript. Features user authentication, CRUD operations for notes, and a modern responsive UI.
This app was generated by Cursor in Agent mode and using Auto for model choice, on August 25, 2025 using the following prompt
Please build me a note taking app in Node.js. Make it allow users to register and to login. Use PostgreSQL (with Docker)
- User Authentication: Secure registration and login system with JWT tokens
- Note Management: Create, read, update, and delete notes
- Responsive Design: Modern UI that works on desktop and mobile devices
- Real-time Updates: Notes are updated in real-time across the interface
- Secure: Password hashing with bcrypt and JWT-based authentication
- Database: PostgreSQL database with proper relationships and constraints
- MCP Servers: Includes Playwright and GitMCP Express docs for easy agentic coding
- Backend: Node.js, Express.js
- Database: PostgreSQL
- Authentication: JWT, bcrypt
- Frontend: Vanilla JavaScript, HTML5, CSS3
- Containerization: Docker & Docker Compose
- Node.js (v14 or higher)
- Docker and Docker Compose
- Git
git clone <your-repo-url>
cd note-taking-app-nodejs
npm install
docker-compose up -d
This will start a PostgreSQL container with the following configuration:
- Database:
note_taking_app
- Username:
postgres
- Password:
postgres
- Port:
5432
# Development mode with auto-reload
npm run dev
# Production mode
npm start
The application will be available at http://localhost:3000
POST /api/register
- User registrationPOST /api/login
- User loginGET /api/profile
- Get user profile (protected)
GET /api/notes
- Get all notes for the authenticated userPOST /api/notes
- Create a new noteGET /api/notes/:id
- Get a specific notePUT /api/notes/:id
- Update a noteDELETE /api/notes/:id
- Delete a note
CREATE TABLE users (
id SERIAL PRIMARY KEY,
username VARCHAR(50) UNIQUE NOT NULL,
email VARCHAR(100) UNIQUE NOT NULL,
password_hash VARCHAR(255) NOT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
CREATE TABLE notes (
id SERIAL PRIMARY KEY,
user_id INTEGER REFERENCES users(id) ON DELETE CASCADE,
title VARCHAR(255) NOT NULL,
content TEXT,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
- Register/Login: Create an account or log in with existing credentials
- Create Notes: Use the form at the top to create new notes
- View Notes: All your notes are displayed in a responsive grid layout
- Edit Notes: Click on any note to open the edit modal
- Delete Notes: Use the delete button in the edit modal to remove notes
The application uses the following default configuration (hardcoded for simplicity):
- Database Host:
localhost
- Database Port:
5432
- Database Name:
note_taking_app
- Database User:
postgres
- Database Password:
postgres
- JWT Secret:
your-super-secret-jwt-key-change-this-in-production
- Server Port:
3000
Note: In production, these values should be moved to environment variables.
- Password Hashing: Passwords are hashed using bcrypt with salt rounds
- JWT Authentication: Secure token-based authentication
- Input Validation: Server-side validation for all inputs
- SQL Injection Protection: Parameterized queries using pg library
- CORS: Cross-origin resource sharing enabled for development
note-taking-app-nodejs/
├── server.js # Main server file
├── package.json # Dependencies and scripts
├── docker-compose.yml # PostgreSQL container setup
├── public/ # Frontend files
│ ├── index.html # Main HTML file
│ ├── styles.css # CSS styles
│ └── app.js # Frontend JavaScript
└── README.md # This file
npm start
- Start the production servernpm run dev
- Start the development server with nodemon
-
Database Connection Error
- Ensure Docker is running
- Check if PostgreSQL container is up:
docker ps
- Verify port 5432 is not in use by another service
-
Port Already in Use
- Change the port in
server.js
or kill the process using port 3000
- Change the port in
-
Dependencies Installation Issues
- Clear npm cache:
npm cache clean --force
- Delete node_modules and package-lock.json, then run
npm install
- Clear npm cache:
# View running containers
docker ps
# View logs
docker-compose logs postgres
# Stop containers
docker-compose down
# Remove containers and volumes
docker-compose down -v
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
You can scan for the security of MCP servers with mcp-scan
uvx mcp-scan .cursor/mcp.json
This project is licensed under the MIT License.
- Rich text editor for notes
- Note categories and tags
- Search functionality
- File attachments
- Note sharing
- Dark mode theme
- Mobile app
- API rate limiting
- User roles and permissions