A full-stack SaaS application that generates engaging LinkedIn posts using AI. Built with Spring Boot (Java) backend, Next.js 15 frontend, PostgreSQL database, and Google Gemini Pro API for AI integration.
- User Authentication: Email/password login with JWT security
- AI Content Generation: Generate 3 LinkedIn-style posts with different tones
- Post Management: Copy, save, and regenerate posts
- History Tracking: View and manage all saved posts
- Responsive Design: Clean, minimal UI that works on all devices
- Professional: Formal and business-focused content
- Casual: Friendly and conversational tone
- Storytelling: Narrative and engaging approach
- Framework: Spring Boot 3.2.0 (Java 17)
- Database: PostgreSQL
- Security: JWT Authentication, Spring Security
- AI Integration: Google Gemini Pro API
- Build Tool: Maven
- Framework: Next.js 15 with TypeScript
- Styling: Tailwind CSS
- State Management: React Query (TanStack Query)
- Icons: Lucide React
- HTTP Client: Axios
-- Users table
users (
id BIGSERIAL PRIMARY KEY,
name VARCHAR(255) NOT NULL,
email VARCHAR(255) UNIQUE NOT NULL,
password_hash VARCHAR(255) NOT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
-- Posts table
posts (
id BIGSERIAL PRIMARY KEY,
user_id BIGINT REFERENCES users(id),
topic VARCHAR(255) NOT NULL,
tone VARCHAR(50) NOT NULL,
content TEXT NOT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);linkedin-content-generator/
βββ backend/ # Spring Boot API
β βββ src/main/java/com/linkedincontent/contentgenerator/
β β βββ LinkedInContentGeneratorApplication.java
β β βββ config/
β β β βββ SecurityConfig.java
β β βββ controller/
β β β βββ AuthController.java
β β β βββ PostController.java
β β βββ dto/
β β β βββ AuthResponse.java
β β β βββ LoginRequest.java
β β β βββ RegisterRequest.java
β β β βββ GeneratePostRequest.java
β β β βββ GeneratePostResponse.java
β β β βββ SavePostRequest.java
β β βββ model/
β β β βββ User.java
β β β βββ Post.java
β β βββ repository/
β β β βββ UserRepository.java
β β β βββ PostRepository.java
β β βββ security/
β β β βββ UserPrincipal.java
β β β βββ CustomUserDetailsService.java
β β β βββ JwtAuthenticationFilter.java
β β βββ service/
β β β βββ AuthService.java
β β β βββ PostService.java
β β β βββ GeminiService.java
β β βββ util/
β β βββ JwtUtil.java
β βββ src/main/resources/
β β βββ application.properties
β βββ Dockerfile
β βββ docker-compose.yml
β βββ pom.xml
βββ frontend/ # Next.js Application
βββ src/
β βββ app/
β β βββ dashboard/
β β β βββ page.tsx
β β βββ history/
β β β βββ page.tsx
β β βββ login/
β β β βββ page.tsx
β β βββ register/
β β β βββ page.tsx
β β βββ layout.tsx
β β βββ page.tsx
β β βββ globals.css
β βββ components/
β β βββ Navbar.tsx
β β βββ PostCard.tsx
β βββ contexts/
β β βββ AuthContext.tsx
β βββ lib/
β β βββ api.ts
β β βββ api-types.ts
β βββ providers/
β βββ ReactQueryProvider.tsx
βββ .env.local
βββ next.config.js
βββ package.json
βββ tailwind.config.js
- Java 17+
- Node.js 18+
- PostgreSQL 15+
- Maven 3.8+
- Google Gemini Pro API Key
-
Clone the repository
git clone <repository-url> cd linkedin-content-generator/backend
-
Set up PostgreSQL Database
# Create database createdb linkedin_content_db # Or use Docker docker run --name postgres-db -e POSTGRES_DB=linkedin_content_db -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=password -p 5432:5432 -d postgres:15
-
Configure Environment Variables
Update
src/main/resources/application.properties:# Database Configuration spring.datasource.url=jdbc:postgresql://localhost:5432/linkedin_content_db spring.datasource.username=postgres spring.datasource.password=your_password # JWT Configuration jwt.secret=your_jwt_secret_key_here_make_it_long_and_secure jwt.expiration=86400000 # Gemini Pro API Configuration gemini.api.key=your_gemini_api_key_here
-
Get Google Gemini Pro API Key
- Go to Google AI Studio
- Create a new API key
- Add it to your
application.properties
-
Run the Backend
./mvnw spring-boot:run
The API will be available at
http://localhost:8080
-
Navigate to frontend directory
cd ../frontend -
Install dependencies
npm install
-
Configure Environment Variables
Create
.env.local:NEXT_PUBLIC_API_URL=http://localhost:8080/api
-
Run the Frontend
npm run dev
The application will be available at
http://localhost:3000
- Build and run with Docker Compose
cd backend # Build the application ./mvnw clean package -DskipTests # Run with Docker Compose docker-compose up -d
-
Build for production
cd frontend npm run build -
Deploy to Vercel
npm install -g vercel vercel --prod
POST /api/auth/register- User registrationPOST /api/auth/login- User login
POST /api/generate-post- Generate LinkedIn postsPOST /api/posts/save- Save a postGET /api/posts/history- Get user's saved posts
GET /api/health- API health status
# Server Configuration
server.port=8080
# Database
spring.datasource.url=jdbc:postgresql://localhost:5432/linkedin_content_db
spring.datasource.username=postgres
spring.datasource.password=password
# JPA/Hibernate
spring.jpa.hibernate.ddl-auto=update
spring.jpa.show-sql=true
# JWT
jwt.secret=your_jwt_secret_key
jwt.expiration=86400000
# Gemini Pro API
gemini.api.key=your_gemini_api_key
gemini.api.url=https://generativelanguage.googleapis.com/v1beta/models/gemini-pro:generateContent
# CORS
cors.allowed.origins=http://localhost:3000NEXT_PUBLIC_API_URL=http://localhost:8080/api-
Render
- Connect your GitHub repository
- Set environment variables
- Deploy automatically
-
AWS/GCP
- Use Docker image
- Configure environment variables
- Set up PostgreSQL instance
-
Heroku
# Add Heroku PostgreSQL addon heroku addons:create heroku-postgresql:hobby-dev # Deploy git push heroku main
-
Vercel (Recommended)
vercel --prod
-
Netlify
- Connect GitHub repository
- Build command:
npm run build - Publish directory:
.next
-
Supabase (Recommended)
- Easy PostgreSQL hosting
- Built-in dashboard
- Generous free tier
-
AWS RDS
- Production-ready PostgreSQL
- Automatic backups
- Scalable
-
Google Cloud SQL
- Managed PostgreSQL
- Integration with GCP services
cd backend
./mvnw testcd frontend
npm test- Sign Up: Create a new account or login
- Generate Posts: Enter a topic and select tone
- Review Results: Get 3 AI-generated LinkedIn posts
- Copy & Save: Copy posts to clipboard or save for later
- View History: Access all your saved posts anytime
- JWT-based authentication
- Password hashing with BCrypt
- CORS protection
- Input validation
- SQL injection prevention
- XSS protection
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
If you encounter any issues:
- Check the troubleshooting section below
- Search existing GitHub issues
- Create a new issue with detailed information
-
Database Connection Error
- Ensure PostgreSQL is running
- Check connection string and credentials
- Verify database exists
-
Gemini API Error
- Verify API key is correct
- Check API quota and billing
- Ensure proper internet connectivity
-
JWT Token Issues
- Check JWT secret configuration
- Verify token expiration settings
- Clear browser localStorage if needed
-
CORS Errors
- Verify CORS configuration in backend
- Check frontend API URL configuration
- Ensure both services are running
- Backend: Change
server.portinapplication.properties - Frontend: Use
npm run dev -- -p 3001for different port
- Post scheduling
- Multiple social platforms (Twitter, Facebook)
- Content templates
- Team collaboration
- Analytics dashboard
- Custom AI prompts
- Export to PDF/Word
- Dark mode
- Mobile app
- Unit and integration tests
- Performance optimization
- Caching layer (Redis)
- Rate limiting
- Monitoring and logging
- CI/CD pipeline
- Load balancing
- Database optimization