Backend service for Threadly - a blogging platform for Devs & Tech enthusiasts. Handles authentication, posts, follows, search, and trending feeds.
- Java + Spring Boot
- Spring Security + OAuth2
- PostgreSQL (Neon)
- Redis (caching / sessions)
- JPA / Hibernate
- Cloudinary (image storage)
- Swagger (Api endpoints)
src/
┣ controller/ # REST endpoints
┣ service/ # Business logic
┣ repository/ # JPA repositories
┣ dto/ # Request/Response DTOs
┣ model/ # Entity classes
┣ config/ # Security, OAuth, CORS configs
┗ util/ # Helper utilities
Create a .env (or set in deployment dashboard):
# Database
SPRING_DATASOURCE_URL=your_postgres_url
SPRING_DATASOURCE_USERNAME=your_username
SPRING_DATASOURCE_PASSWORD=your_password
# Redis
REDIS_URI=your_redis_uri
# OAuth
GOOGLE_CLIENT_ID=your_google_client_id
GOOGLE_CLIENT_SECRET=your_google_client_secret
OAUTH_REDIRECT_URL=http://localhost:3000/oauth/callback
# JWT
JWT_SECRET=your_jwt_secret
# Cloudinary
CLOUDINARY_CLOUD_NAME=your_cloud_name
CLOUDINARY_API_KEY=your_api_key
CLOUDINARY_API_SECRET=your_api_secret# Clone repo
git clone https://github.com/manojkumar260706/Threadly-Backend.git
cd threadly-backend
# Build & run
./mvnw spring-boot:runServer runs on:
http://localhost:8080
Swagger to view endpoints:
http://localhost:8080/swagger-ui.html
- User clicks Login with Google
- OAuth success → backend generates JWT
- Frontend receives token & stores it
- All protected routes require:
Authorization: Bearer <token>
GET /oauth2/authorization/google
GET /login/oauth2/code/google
POST /api/posts
GET /api/posts/{id}
DELETE /api/posts/{id}
GET /api/posts/trending
GET /api/search?query=java
POST /api/users/{id}/follow
GET /api/users/{id}/followers
GET /api/users/{id}/following
./mvnw test- Set all env variables in hosting dashboard
- Update OAuth redirect URL after frontend deployment
- Ensure PostgreSQL + Redis are accessible
- Use HTTPS in production
- Notifications system 🔔
- Advanced search ranking
- Post recommendations ML model 🤖
- Rate limiting & caching optimizations