This is the backend of the pick-notes Android App. It is built using Ktor Client and JWT for secure authentication & authorization. The API enables users to create, update, delete, and manage their notes. It is designed to be simple, secure, and easy to integrate with front-end applications such as web or mobile apps.
Base URL:
https://pick-notes-api-1e9ac8fd48ce.herokuapp.com
-
Register a new user
POST /users/register
Request Body:
{ "username": "your_username", "email": "your_email", "password": "your_password" }
Response Body:
{ "success": true, "data": { "token": "eyJhb....." }, "message": "User successfully registered" }
-
Login user
POST /users/login
Request Body:
{ "email": "your_email", "password": "your_password" }
Response Body:
{ "success": true, "data": { "token": "eyJhb.....token" }, "message": "User successfully logged in" }
Set the Bearer token
in the header before sending any POST request to the /notes
end-point.
-
Get All Notes
GET /notes
{ "success": true, "data": [ { "id": 1, "userId": 1, "title": "First Updated Note", "description": "This is my very first note.", "createdAt": 1727859582222, "updatedAt": 1727860286634 }, { "id": 2, "userId": 1, "title": "Second Note", "description": "This is my second note.", "createdAt": 1727867248390, "updatedAt": 1727867248390 } ], "message": "All notes retrieved successfully" }
-
Create Note
POST /notes/create
Request Body:{ "title": "First Title", "description": "This is my first note." }
Response Body:
{ "success": true, "data": { "id": 1, "userId": 1, "title": "First Note", "description": "This is my first note.", "createdAt": 1727867248390, "updatedAt": 1727867248390 }, "message": "Note created successfully" }
-
Update Note
PUT /notes/update
Request Body:
{ "id": 1, "title": "First Modified Note", "description": "This is my first modified note." }
Response Body:
{ "success": true, "data": { "id": 1, "userId": 1, "title": "First Updated Note", "description": "This is my first modified note.", "createdAt": 1727867248390, "updatedAt": 1727868535957 }, "message": "Note updation successful" }
-
Delete Note
DELETE /notes/delete/{id}
Response Body:
{ "success": true, "data": { "id": 1, "userId": 1, "title": "First Modified Note", "description": "This is my first modified note." }, "message": "Note deletion successful" }
To set up and run the Pick Notes API locally, follow these steps:
- IntelliJ IDEA installed.
- PostgreSQL installed and running.
- PgAdmin installed (optional).
git clone https://github.com/rohit9625/pick-notes-api.git
cd pick-notes-api
-
Open project in IntelliJ IDEA
-
Setup Database from Postgresql CLI or PgAdmin by running:
CREATE DATABASE db-name;
-
Setup environment variables from Run/Debug Configurations option.
DATABASE_URL=postgres://username:password@host:port/db-name, HASH_KEY=your_hash_key JWT_SECRET=your_secret
-
Don't change the structure of the URL. Only replace username, password, host, port, and db-name with your own.
-
You can project by clicking Run button on IntelliJ IDEA
-
To build the project using Gradle
./gradlew build
-
Then run the API locally
./gradlew run
Contributions are welcome! If you'd like to contribute to this project, please fork the repository, create a new branch, and submit a pull request. For major changes, please open an issue first to discuss what you would like to change.
For any questions, issues, or suggestions, feel free to reach out to me:
- GitHub: rohit9625
- Email: [email protected]