NoteMatic is an application that can be used to record important notes that can be accessed anytime and anywhere.
NoteMatic is a RESTful API application designed to facilitate the recording of important notes that can be accessed anytime and anywhere. Developed with technologies such as Node.js, NestJS, and Prisma ORM. NoteMatic offers an efficient, secure, and reliable note-taking solution. With this NoteMatic application, users can create, read, update, delete and search notes through an intuitive and easy-to-use API interface.
- Version : v1.0.0
- Developer : Rumah Kodingku
- Released On : June 16, 2024
- Status : Stable Release
- Contact : rumahkodingku45@gmail.com
- Description
- System Requirements
- Tech Stack
- Security
- Installation
- Setup Environment Variable
- Project Structure
- Running the App
- API Endpoints
- Usage Examples
- Authorization
- API Documentation
- Node.js v14 or later
- MySQL 5.7 or later
- npm (Node Package Manager)
- NestJS
- Prisma ORM
- MySQL
- TypeScript
- Authentication
- Encryption and Hasing
- Authorization
- Cors
- Rate Limiting
- Helmet
# Navigate to project repository
$ cd NoteMatic
# Install all dependencies
$ npm install# Change name file
$ cp .env.example .env
# Environment
PORT=YOUR PORT APP
DATABASE_URL=YOUR URL PRISMA MYSQL
JWT_SECRET=YOUR JWT SECRETNoteMatic/
|-- dist/ # Distribution file
|-- node_modules/ # Node.js modules
|-- prisma/ # Prisma
| |-- migrations/
| |-- schema.prisma
|-- src/
| |-- common/ # Common database, decorator, error, guard, middleware, strategy, validation
| | |-- database/
| | |-- decorator/
| | |-- error/
| | |-- guard/
| | |-- middleware/
| | |-- strategy/
| | |-- validation/
| | |-- common.module.ts # Module common
| |-- model/ # Model features
| | |-- auth.model.ts
| | |-- notes.model.ts
| | |-- users.model.ts
| | |-- web.model.ts
| |-- modules/ # Main application modules
| | |-- auth/ # Authentication module
| | | |-- auth.controller.ts
| | | |-- auth.module.ts
| | | |-- auth.service.ts
| | | |-- auth.validation.ts
| | |-- notes/ # Notes module
| | | |-- notes.controller.ts
| | | |-- notes.module.ts
| | | |-- notes.service.ts
| | | |-- notes.validation.ts
| | |-- users/ # Users module
| | | |-- users.controller.ts
| | | |-- users.module.ts
| | | |-- users.service.ts
| | | |-- users.validation.ts
| |-- app.module.ts # Root module for the application
| |-- main.ts # Entry point for the application
|-- .env # Environment variables
|-- .eslintrc.js # Eslint file
|-- .gitignore # Git ignore file
|-- .prettier # Prettier formater file
|-- nest-cli.json # NestJS configuration
|-- package-lock.json # Exact version dependencies
|-- package.json # Node.js project metadata
|-- README.md # Project README file
|-- tsconfig.build.json # TypeScript build configuration
|-- tsconfig.json # TypeScript configuration
# development
$ npm run start
# watch mode
$ npm run start:dev
# production mode
$ npm run start:prod| Summary | Endpoint | Method | Authorization |
|---|---|---|---|
| Register | /api/auth/register | POST | - |
| Login | /api/auth/login | POST | - |
| Logout | /api/auth/logout | DELETE | Bearer Token |
| Summary | Endpoint | Method | Authorization |
|---|---|---|---|
| Get Data User | /api/users | GET | Bearer Token |
| Update Password | /api/users/update-password | PUT | Bearer Token |
| Summary | Endpoint | Method | Authorization | Params | Query |
|---|---|---|---|---|---|
| Create Note | /api/note | POST | Bearer Token | - | - |
| Get Note By userId | /api/note/all | GET | Bearer Token | - | - |
| Get Note By Id | /api/note/:{noteId} | GET | Bearer Token | noteId | - |
| Update Note | /api/note/:{noteId} | PATCH | Bearer Token | noteId | - |
| Delete Note | /api/note/:{noteId} | DELETE | Bearer Token | noteId | - |
| Search Note | /api/note | GET | Bearer Token | - | title |
# Register
curl -X POST http://{your_url}/api/auth/register -H "Content-Type: application/json" -d '{"username":"test","password":"password"}'
# Get Note By Id
curl -X GET http://{your_url}/api/note/1 -H "Authorization: Bearer {token}"
Use the following steps to get an authorization token:
- Register or log in using the /api/auth/register or /api/auth/login endpoints.
- Use the token received in the response to authorize further requests.
- http://{your_url}/documentation
