A robust REST API backend built with Express.js, TypeScript, and Prisma ORM featuring authentication and note management.
- 🔐 JWT-based Authentication
- 📝 CRUD operations for Notes
- 🔍 Search functionality
- 📄 Pagination support
- ⚡ Rate limiting
- 🔒 Password validation and security
- 🎯 Input validation
- 🚫 Error handling middleware
- 📦 PostgreSQL database with Prisma ORM
- Node.js
- Express.js
- TypeScript
- Prisma ORM
- PostgreSQL
- JSON Web Tokens
- bcrypt.js
- express-validator
- express-rate-limit
1- Clone the repository:
git clone https://github.com/KhaledSaeed18/Express-Notes-App-with-TypeScript-Prisma-PostgreSQL.git
cd Express-Notes-App-with-TypeScript-Prisma-PostgreSQL
2- Install dependencies:
npm install
3- Create a .env file in the root directory:
PORT=<port-number>
API_VERSION=v1
BASE_URL=/api
DATABASE_URL=postgresql://<username>:<password>@localhost:5432/<database-name>
JWT_SECRET=your-jwt-secret-key
JWT_REFRESH_SECRET=your-jwt-refresh-secret-key
4- Set up the database:
npx prisma migrate dev # Apply the migrations
npx prisma generate # Generate the Prisma Client
5- Run the application:
npm run dev
6- Production Build:
npm run build
npm start
http://localhost:3000/api/v1
-
Authentication:
POST /api/v1/auth/signup
- Register a new userPOST /api/v1/auth/signin
- Login userPOST /api/v1/auth/refresh-token
- Refresh access token
-
Notes:
POST /api/v1/note/create-note
- Create a new noteGET /api/v1/note/get-notes
- Get all notes (paginated)GET /api/v1/note/get-note/:id
- Get a specific noteGET /api/v1/note/search-notes
- Search notes (paginated)PUT /api/v1/note/update-note/:id
- Update a noteDELETE /api/v1/note/delete-note/:id
- Delete a note