A secure, end-to-end encrypted journal application built with Spring Boot, MongoDB and features JWT-based authentication.
- JWT-based authentication
- CRUD operations for journal entries
- User management
- MongoDB integration
- RESTful API
- Backend: Spring Boot 2.7.15
- Database: MongoDB
- Authentication: JWT (JSON Web Tokens)
- Security: Spring Security
- Build Tool: Maven
POST /authenticate/login- User loginPOST /authenticate/register- User registration
GET /journal- Get all journal entries for current userPOST /journal- Create new journal entryGET /journal/id/{id}- Get specific journal entryPUT /journal/id/{id}- Update journal entryDELETE /journal/id/{id}- Delete journal entry
GET /user- Get all users (Admin only)PUT /user- Update current userDELETE /user- Delete current user
- Java 17
- Maven 3.6+
- MongoDB (or use MongoDB Atlas)
- Clone the repository:
git clone <repository-url>
cd Journal-App- Update MongoDB connection in
application.properties:
spring.data.mongodb.uri=your-mongodb-uri
spring.data.mongodb.database=journaldb- Build and run:
mvn clean install
mvn spring-boot:runThe application will be available at http://localhost:8080
curl -X POST http://localhost:8080/authenticate/register \
-H "Content-Type: application/json" \
-d '{"username":"testuser","password":"password123"}'curl -X POST http://localhost:8080/authenticate/login \
-H "Content-Type: application/json" \
-d '{"username":"testuser","password":"password123"}'curl -X POST http://localhost:8080/journal \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_JWT_TOKEN" \
-d '{"title":"My Day","content":"Today was a great day!"}'SPRING_DATA_MONGODB_URI- MongoDB connection stringSPRING_DATA_MONGODB_DATABASE- Database nameJWT_SECRET- JWT secret key (optional, uses default if not set)JWT_EXPIRATION- JWT token expiration time in milliseconds
- Password encryption using BCrypt
- JWT-based stateless authentication
- CORS support
- Input validation
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
This project is licensed under the MIT License.