A complete Kotlin-stack application for taking notes, built to demonstrate modern development practices using Ktor, PostgreSQL, Docker, and Jetpack Compose.
This project is divided into two parts:
- NotyKT Backend: A REST API built with Ktor and PostgreSQL for data storage.
- NotyKT Frontend: An Android application built with Jetpack Compose for the user interface.
- Java Development Kit (JDK) 21
- Docker: Required to run the PostgreSQL database.
- IntelliJ IDEA: For developing the Ktor backend.
- Android Studio: For developing the Jetpack Compose frontend.
The frontend is a native Android application built with Jetpack Compose. It provides a clean and intuitive user interface for interacting with the backend API.
The project is organized under the package com.example.notepkt with the following structure:
The app uses a navigation controller to switch between:
- Login/Sign-up Screen (
LoginScreen.kt,SignupScreen.kt) - Notes List Screen (
NoteScreen.kt) - Create Note Screen (integrated in
NoteScreen.ktor separate)
- Jetpack Compose β Declarative UI toolkit
- Ktor Client β HTTP client for API calls
- Kotlinx Serialization β JSON serialization/deserialization
The backend is a secure and scalable REST API built with Ktor. It handles all data persistence, authentication, and business logic.
| Method | Endpoint | Description |
|---|---|---|
| POST | /signup |
Creates a new user with email and password |
| POST | /login |
Authenticates user and returns JWT |
| GET | /notes |
Retrieves all notes for the user |
| POST | /notes |
Creates a new note |
| PUT | /notes/{id} |
Updates an existing note |
| DELETE | /notes/{id} |
Deletes a specific note |
- PostgreSQL: Runs in Docker, stores users and notes.
- BCrypt: Passwords are securely hashed before storage.
Follow these steps to set up and run the full-stack application on your local machine.
-
Install Docker: If you don't have Docker Desktop, download and install it.
-
Run the PostgreSQL container:
docker run --name nameofcontainer -e POSTGRES_PASSWORD= yourpassword -e TZ=UTC -p 5432:5432 -d postgres
docker exec -it my-postgres psql -U postgres
CREATE DATABASE notep;
\c notep
CREATE TABLE users (
id SERIAL PRIMARY KEY,
google_id VARCHAR(255) UNIQUE NOT NULL,
name VARCHAR(255) NOT NULL,
email VARCHAR(255) NOT NULL
);
CREATE TABLE notes (
id SERIAL PRIMARY KEY,
user_id INT NOT NULL,
title VARCHAR(255) NOT NULL,
content VARCHAR(1024) NOT NULL,
timestamp BIGINT NOT NULL,
FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE
);
# To exit psql, type \q-
Open the backend project in IntelliJ IDEA.
-
Run the
Application.ktfile. -
The console should confirm the server is running at:
http://localhost:8080-
Open the frontend project in Android Studio.
-
Run the app on an emulator or a physical device.
-
The app will launch, allowing users to sign up or log in to access their notes.
This project is open-source and available under the MIT License.
Feel free to fork the repo, submit pull requests, or open issues to improve the project. Whether it's UI polish, backend enhancements, or documentationβevery bit helps!
