A full-stack web application for creating, managing, and sharing notes. Built with React, TypeScript, Node.js, Express, and PostgreSQL.
- π User Authentication - Secure signup and login with JWT tokens
- π Note Management - Create, read, update, and delete notes
- π Search Functionality - Search notes by title or content
- π Note Sharing - Generate shareable links for your notes
- π Dark/Light Mode - Toggle between themes
- πΎ Persistent Storage - PostgreSQL database with Prisma ORM
- π Secure - Password hashing with bcrypt and JWT authentication
- React 18 - UI library
- TypeScript - Type safety
- Vite - Build tool and dev server
- Tailwind CSS - Styling
- Zustand - State management
- React Router - Navigation
- NextUI - UI components
- Axios - HTTP client
- Framer Motion - Animations
- Node.js - Runtime environment
- Express - Web framework
- Prisma - ORM for database management
- PostgreSQL - Database
- JWT - Authentication tokens
- bcrypt - Password hashing
- CORS - Cross-origin resource sharing
notes-web-app/
βββ Backend/
β βββ index.js # Express server and API routes
β βββ package.json # Backend dependencies
β βββ prisma/
β βββ schema.prisma # Database schema
β βββ migrations/ # Database migrations
βββ Frontend/
βββ notes-application/
βββ src/
β βββ App.tsx # Main app component
β βββ Login.tsx # Login page
β βββ Signup.tsx # Signup page
β βββ MainPage.tsx # Main notes page
β βββ Note.tsx # Note component
β βββ AddNote.tsx # Add note component
β βββ store.jsx # Zustand store
βββ package.json # Frontend dependencies
βββ vite.config.ts # Vite configuration
- Node.js (v14 or higher)
- PostgreSQL database
- npm or yarn
git clone <repository-url>
cd notes-web-appcd Backend
npm install- Create a PostgreSQL database
- Create a
.envfile in theBackenddirectory with the following variables:
DATABASE_URL="postgresql://username:password@localhost:5432/database_name"
DIRECT_URL="postgresql://username:password@localhost:5432/database_name"
JWT_SECRET="your-secret-key-here"- Run Prisma migrations:
npx prisma migrate dev- Generate Prisma Client:
npx prisma generatecd Frontend/notes-application
npm installcd Backend
node index.jsThe backend server will run on http://localhost:2000
cd Frontend/notes-application
npm run devThe frontend will run on http://localhost:5173
-
POST /user/create- Create a new user account- Body:
{ name, email, password }
- Body:
-
POST /user/login- Login user- Body:
{ email, password } - Returns: JWT token
- Body:
-
GET /notes- Get all notes for authenticated user- Headers:
Authorization: Bearer <token>
- Headers:
-
POST /note/create- Create a new note- Headers:
Authorization: Bearer <token> - Body:
{ title, content }
- Headers:
-
PUT /notes/:id- Update a note- Headers:
Authorization: Bearer <token> - Body:
{ title, content }
- Headers:
-
DELETE /notes/:id- Delete a note- Headers:
Authorization: Bearer <token>
- Headers:
-
GET /notes/search?query=<search_term>- Search notes- Headers:
Authorization: Bearer <token>
- Headers:
-
GET /notes/:id/share- Generate shareable link for a note- Headers:
Authorization: Bearer <token>
- Headers:
-
GET /notes/shared/:id?token=<share_token>- Access shared note (public)
id- Integer (Primary Key)email- String (Unique)name- String (Optional)password- String (Hashed)
id- Integer (Primary Key)title- Stringcontent- StringcreatedAt- DateTimeuserId- Integer (Foreign Key)
npm run dev- Start development servernpm run build- Build for productionnpm run preview- Preview production buildnpm run lint- Run ESLint
The backend uses Express and Prisma. Make sure to run migrations after schema changes:
npx prisma migrate dev
npx prisma generate- Passwords are hashed using bcrypt before storage
- JWT tokens for authentication
- Token-based authorization for protected routes
- User-specific note access (users can only access their own notes)
- Shareable links expire after 24 hours
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License.
See the LICENSE file for details.
Adham Kiwan