NotesApi is a microservices-based application for managing notes. It consists of two core backend services:
- Auth Service – Handles user authentication using JWT Bearer tokens for secure communication and token validation.
- Notes-api – Manages note creation, retrieval, updating, and deletion.
The application follows a RESTful API architecture and is built using Spring Boot. It integrates with external services using Feign clients and documents APIs using OpenAPI.
Frontend: The frontend is built using React and provides an interactive user interface for managing notes and interacting with the backend services.
Authentication: The application uses JWT Bearer tokens for secure user authentication. After logging in, users receive a JWT token, which must be included in the
Authorizationheader of requests to access protected endpoints.
| Method | URL | Description |
|---|---|---|
POST |
/api/auth/register |
Registers a new user |
POST |
/api/auth/authenticate |
Authenticates a user and returns a JWT token |
GET |
/api/auth/validateToken |
Validates the provided JWT authentication token. |
Note: To authenticate and obtain a token, use the
/api/auth/authenticateendpoint by providing the user's credentials. The received token should be sent in theAuthorizationheader asBearer <token>for subsequent requests.
| Method | URL | Description |
|---|---|---|
GET |
/api/v1/notesGet |
Retrieves a paginated list of notes. |
GET |
/api/v1/notesIdGet |
Retrieves a specific note by its ID. |
DELETE |
/api/v1/notesIdDelete |
Deletes a specific note by its ID. |
PUT |
/api/v1/notes/{id} |
Updates an existing note by its ID. |
POST |
/api/v1/notesPost |
Creates a new note. |
- JDK 21 - The core programming language for building the project.
- Maven 3.x - Tool for managing dependencies, building, and managing projects.
- Docker - Containerization platform for packaging applications and their dependencies.
-
Clone the repository.
-
Build the services:
-
Frontend:
- Navigate to the
frontend/folder. - Run
npm installto install dependencies. - Run
npm run buildto build the frontend.
- Navigate to the
-
Notes API:
- Navigate to the
notes-api/folder. - Run
mvn clean packageto build the service.
- Navigate to the
-
Auth Service:
- Navigate to the
auth-service/folder. - Run
mvn clean packageto build the service.
- Navigate to the
-
-
Run
docker-compose upto start all services.
- Java 21 - Core programming language.
- Spring Boot - Framework used for rapid development of microservices-based applications.
- React - JavaScript library for building interactive user interfaces.
- JWT - JSON Web Token for secure user authentication.
- Postgres - Relational database used to store user and note data.
- Feign - Declarative web service client that simplifies communication between services.
- Docker - Containerization platform for packaging applications and their dependencies.
- OpenAPI - Auto-generates API documentation for better interactivity, comprehension, and testing of API features.
- Maven - Tool for managing dependencies, building, and managing projects.
The project uses OpenAPI contracts to define the APIs for both the Auth Service and Notes-api. The API documentation is auto-generated using OpenAPI annotations in the code.
- The Auth Service exposes endpoints for user registration, authentication, and token validation.
- This service is responsible for issuing JWT tokens, which are used for secure communication between services.
- The Notes-api exposes endpoints for CRUD operations related to notes.
- These endpoints are protected and require authentication via JWT Bearer tokens issued by the Auth Service.
- The Notes-api uses Feign clients to communicate with the Auth Service, leveraging the API contract for authentication and token validation.
- Both services use OpenAPI annotations to automatically generate and expose the API documentation.
- You can explore and test the API directly through the generated documentation.
- User authentication with token-based security.
- CRUD operations for managing notes.
- Paginated retrieval of notes.
- Docker support for containerized deployment.
- Feign integration for seamless communication between microservices.
- OpenAPI documentation for API exploration and testing.