Skip to content

Daniel-Sameh/Momentum-Backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

70 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Momentum Backend

A comprehensive Spring Boot backend system for a career growth platform that connects professionals with mentors and communities.

πŸš€ Features

  • Authentication & Authorization: JWT-based secure authentication system
  • Community Management: Create and join communities
  • Mentorship Platform: Connect with mentors and book sessions
  • Session Booking: Schedule and manage mentorship sessions
  • Google Calendar Integration: Seamless calendar synchronization
  • Social Features: Posts, comments, and likes system
  • File Management: Cloudinary integration for file uploads
  • Notification System: Real-time notifications for users
  • Admin Dashboard: Administrative controls and mentor application management
  • Profile Management: Comprehensive user profile system

πŸ› οΈ Technology Stack

  • Framework: Spring Boot 3.x
  • Security: Spring Security with JWT
  • Database: PostgreSQL (Supabase)
  • File Storage: Cloudinary
  • Email Service: JavaMail
  • Calendar Integration: Google Calendar API
  • Build Tool: Maven
  • Authentication: JWT tokens

πŸ“‹ Prerequisites

  • Java 17 or higher
  • Maven 3.6+
  • PostgreSQL database
  • Cloudinary account
  • Google Calendar API credentials
  • SMTP server for email notifications

βš™οΈ Configuration

Create an application.properties file with the following configurations:

# Database Configuration
spring.datasource.url=jdbc:postgresql://your-supabase-url:5432/your-database
spring.datasource.username=your-username
spring.datasource.password=your-password

# JWT Configuration
jwt.secret=your-jwt-secret-key
jwt.expiration=86400000

# Cloudinary Configuration
cloudinary.cloud-name=your-cloud-name
cloudinary.api-key=your-api-key
cloudinary.api-secret=your-api-secret

# Email Configuration
spring.mail.host=smtp.gmail.com
spring.mail.port=587
spring.mail.username[email protected]
spring.mail.password=your-app-password

# Google Calendar API
google.calendar.credentials.file.path=path/to/credentials.json

πŸš€ Getting Started

  1. Clone the repository

    git clone https://github.com/your-username/momentum-backend.git
    cd momentum-backend
  2. Configure environment variables

    • Copy application.properties.example to application.properties
    • Fill in your configuration values
  3. Install dependencies

    mvn clean install
  4. Run the application

    mvn spring-boot:run

The application will start on http://localhost:8080

πŸ“š API Documentation

Authentication Endpoints

  • POST /api/auth/register - User registration
  • POST /api/auth/login - User login
  • GET /api/auth/verify - Verify user email
  • GET /api/auth/test - Test CORS configuration

Community Endpoints

  • POST /api/community/create - Create new community
  • GET /api/community/{id} - Get community by ID
  • GET /api/community/all - Get all communities
  • GET /api/community/my-communities - Get communities owned by user
  • GET /api/community/joined - Get communities joined by user
  • PUT /api/community/{id} - Update community
  • DELETE /api/community/{id} - Delete community
  • POST /api/community/{id}/join - Join community
  • POST /api/community/{id}/leave - Leave community
  • GET /api/community/search - Search communities

Post Endpoints

  • POST /api/post/regular/create/{id} - Create regular post
  • POST /api/post/project/create/{id} - Create project post
  • PUT /api/post/regular/{id} - Update regular post
  • PUT /api/post/project/{id} - Update project post
  • DELETE /api/post/{id} - Delete post
  • GET /api/post/community/{id} - Get posts by community
  • GET /api/post/my/feed - Get user's feed
  • GET /api/post/{id} - Get post by ID
  • POST /api/post/{id}/like - Like post
  • DELETE /api/post/{id}/like - Unlike post
  • GET /api/post/{id}/likes - Get post likes
  • GET /api/post/{id}/comments - Get post comments
  • GET /api/post/my - Get user's posts

Comment Endpoints

  • POST /api/comments/post/{postId} - Add comment to post
  • PUT /api/comments/{commentId} - Update comment
  • DELETE /api/comments/{commentId} - Delete comment
  • POST /api/comments/{commentId}/like - Like comment
  • DELETE /api/comments/{commentId}/like - Unlike comment
  • GET /api/comments/{commentId}/likes - Get comment likes

Profile Endpoints

  • GET /api/profile/me - Get current user profile
  • PATCH /api/profile/me - Update current user profile
  • POST /api/profile/me/avatar - Upload avatar
  • GET /api/profile/{profileId} - Get user profile by ID
  • GET /api/profile/learners - Get all learners
  • GET /api/profile/mentors - Get all mentors
  • GET /api/profile/top-rated - Get top-rated mentors
  • POST /api/profile/{profileId}/follow - Follow user
  • DELETE /api/profile/{profileId}/unfollow - Unfollow user
  • GET /api/profile/followers - Get followers
  • GET /api/profile/following - Get following

Mentor Search Endpoints

  • GET /api/mentors/search - Search mentors with filters

Booking Endpoints

  • POST /api/bookings/{mentorId} - Create booking with mentor
  • GET /api/bookings/mentor - Get mentor's bookings
  • GET /api/bookings/learner - Get learner's bookings
  • DELETE /api/bookings/cancel/{bookingId} - Cancel booking
  • POST /api/bookings/{bookingId}/rate - Rate completed session
  • GET /api/bookings/status/{bookingId} - Get booking status

Availability Endpoints

  • POST /api/availability/add - Add mentor availability
  • GET /api/availability/{mentorId} - Get mentor availability
  • PUT /api/availability/{availabilityId}/cancel - Cancel availability

Mentor Application Endpoints

  • GET /api/application/status - Get application status
  • POST /api/application/{appId}/approve - Approve application (admin)
  • POST /api/application/{appId}/reject - Reject application (admin)
  • GET /api/application - Get applications by status (admin)
  • GET /api/application/{appId} - Get application by ID

Notification Endpoints

  • GET /api/notifications - Get user notifications (paginated)
  • GET /api/notifications/unread - Get unread notifications
  • GET /api/notifications/unread/count - Get unread count
  • PUT /api/notifications/{id}/read - Mark notification as read
  • PUT /api/notifications/read-all - Mark all notifications as read

Location Endpoints

  • GET /api/countries - Get all countries
  • POST /api/countries - Add country
  • PUT /api/countries/{id} - Update country
  • DELETE /api/countries/{id} - Delete country
  • GET /api/cities/{countryName} - Get cities by country
  • POST /api/cities - Add city
  • PUT /api/cities/{id} - Update city
  • DELETE /api/cities/{id} - Delete city

Reference Data Endpoints

  • GET /api/job-titles - Get all job titles
  • POST /api/job-titles - Add job title
  • PUT /api/job-titles/{id} - Update job title
  • DELETE /api/job-titles/{id} - Delete job title
  • GET /api/tags - Get all tags
  • POST /api/tags - Create tag
  • PUT /api/tags/{id} - Update tag
  • DELETE /api/tags/{id} - Delete tag
  • GET /api/universities - Get all universities
  • POST /api/universities - Add university
  • PUT /api/universities/{id} - Update university
  • DELETE /api/universities/{id} - Delete university

Statistics Endpoints

  • GET /api/statistics - Get platform statistics

πŸ—οΈ Project Structure

src/
β”œβ”€β”€ main/
β”‚   β”œβ”€β”€ java/
β”‚   β”‚   └── com/momentum/
β”‚   β”‚       β”œβ”€β”€ config/          # Configuration classes
β”‚   β”‚       β”œβ”€β”€ controller/      # REST controllers
β”‚   β”‚       β”œβ”€β”€ dto/            # Data Transfer Objects
β”‚   β”‚       β”œβ”€β”€ entity/         # JPA entities
β”‚   β”‚       β”œβ”€β”€ repository/     # Data repositories
β”‚   β”‚       β”œβ”€β”€ service/        # Business logic
β”‚   β”‚       └── security/       # Security configuration
β”‚   └── resources/
β”‚       β”œβ”€β”€ application.properties
β”‚       └── static/
└── test/                       # Test files

πŸ”§ Development

Running Tests

mvn test

Building for Production

mvn clean package

Code Style

  • Follow Java naming conventions
  • Use meaningful variable and method names
  • Add appropriate comments for complex logic
  • Maintain consistent indentation

πŸš€ Deployment

Docker Deployment

FROM openjdk:17-jdk-slim
COPY target/momentum-backend-*.jar app.jar
EXPOSE 8080
ENTRYPOINT ["java", "-jar", "/app.jar"]

Environment Variables for Production

export DATABASE_URL=your-production-db-url
export JWT_SECRET=your-production-jwt-secret
export CLOUDINARY_URL=your-cloudinary-url

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

πŸ‘₯ Team Members

  • Daniel Sameh - Team Leader & Scrum Master

    • Authentication system
    • Community management
    • Posts and social features
    • Session booking system
  • Mohamed Mahmoud - Backend Developer

    • Notification system
    • Profile management
    • Mentor application system
  • Toqa Ashraf - Full-Stack Developer

    • Admin functionality
    • Mentor application management
    • User Statistics
    • Frontend integration
  • Raghad Ahmad - Testing & QA Engineer

    • Testing and quality assurance
    • Bug tracking and resolution

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •