Skip to content

codebyharii/-AI-Powered-Smart-Content-Manager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

11 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš€ SmartContent - AI Powered Content Manager

A modern full-stack application for intelligent content management with AI-powered features.

Java Spring Boot React MySQL License

Full-stack content management system with Spring Boot backend and React frontend, featuring AI-powered summarization, SEO optimization, and intelligent tagging.


πŸ“– Table of Contents


✨ Features

🎯 Core Features

  • User Authentication - JWT-based login/register with role-based access (USER, AUTHOR, ADMIN)
  • Article Management - Create, edit, delete articles with rich text editor
  • AI-Powered Tools - Auto-summarization, tag generation, and SEO scoring
  • Dashboard Analytics - Track content performance with stats and metrics
  • Search & Filter - Search by title, filter by tags and status
  • Dark/Light Mode - Beautiful Google-inspired UI with theme switching
  • Responsive Design - Works perfectly on desktop, tablet, and mobile

πŸ€– AI Features

  • βœ… Automatic content summarization
  • βœ… Intelligent tag generation
  • βœ… SEO score calculator with actionable suggestions
  • βœ… Readability analysis
  • βœ… Keyword density optimization

πŸ” Security

  • βœ… JWT token authentication
  • βœ… BCrypt password encryption
  • βœ… Role-based authorization
  • βœ… Secure API endpoints
  • βœ… CORS configuration

πŸ“Έ Screenshots

Note: Add your screenshots to docs/screenshots/ folder

Landing Page Dashboard
Landing Dashboard
Article Editor Dark Mode
Editor Dark Mode

πŸ› οΈ Tech Stack

Backend

  • Java 17 - Programming language
  • Spring Boot 3.2.2 - Application framework
  • Spring Security - Authentication & authorization
  • Spring Data JPA - Database operations
  • MySQL 8.0 - Database
  • JWT - Token-based authentication
  • Lombok - Reduce boilerplate code
  • MapStruct - Object mapping
  • Swagger/OpenAPI - API documentation
  • Maven - Build tool

Frontend

  • React 18.2 - UI library
  • Vite 5.0 - Build tool & dev server
  • TailwindCSS 3.4 - Styling framework
  • Framer Motion - Animations
  • React Router 6 - Navigation
  • Zustand - State management
  • Axios - HTTP client
  • Lucide React - Icons

πŸš€ Quick Start

Prerequisites

Make sure you have these installed:

Java 17+          # java -version
Maven 3.6+        # mvn -version
MySQL 8.0+        # mysql --version
Node.js 18+       # node -v
npm 9+            # npm -v

Installation in 5 Minutes

# 1. Clone the repository
git clone https://github.com/YOUR_USERNAME/smartcontent.git
cd smartcontent

# 2. Setup Backend
cd smartcontent-backend
mysql -u root -p -e "CREATE DATABASE smart_content_db;"
mysql -u root -p smart_content_db < schema.sql
mvn clean install
mvn spring-boot:run

# 3. Setup Frontend (in new terminal)
cd ../smartcontent-frontend
npm install
cp .env.example .env
npm run dev

# 4. Open browser
http://localhost:3000

That's it! πŸŽ‰


πŸ“¦ Installation

Step 1: Clone Repository

git clone https://github.com/YOUR_USERNAME/smartcontent.git
cd smartcontent

Step 2: Backend Setup

2.1 Create MySQL Database

# Login to MySQL
mysql -u root -p

# Create database
CREATE DATABASE smart_content_db;
exit;

2.2 Import Database Schema

cd smartcontent-backend
mysql -u root -p smart_content_db < schema.sql

2.3 Configure Database Connection

Edit src/main/resources/application.yml:

spring:
  datasource:
    url: jdbc:mysql://localhost:3306/smart_content_db
    username: root
    password: YOUR_MYSQL_PASSWORD  # ← Change this!

2.4 Add CORS Configuration

Create file: src/main/java/com/smartcontent/config/CorsConfig.java

package com.smartcontent.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.cors.CorsConfiguration;
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
import org.springframework.web.filter.CorsFilter;
import java.util.Arrays;

@Configuration
public class CorsConfig {
    @Bean
    public CorsFilter corsFilter() {
        CorsConfiguration config = new CorsConfiguration();
        config.setAllowCredentials(true);
        config.setAllowedOrigins(Arrays.asList("http://localhost:3000"));
        config.setAllowedHeaders(Arrays.asList("*"));
        config.setAllowedMethods(Arrays.asList("GET", "POST", "PUT", "DELETE", "OPTIONS"));
        config.setExposedHeaders(Arrays.asList("Authorization"));
        
        UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
        source.registerCorsConfiguration("/**", config);
        return new CorsFilter(source);
    }
}

2.5 Build Backend

mvn clean install

Step 3: Frontend Setup

3.1 Install Dependencies

cd smartcontent-frontend
npm install

3.2 Configure Environment

# Create .env file
cp .env.example .env

Edit .env:

VITE_API_BASE_URL=http://localhost:8080/api

βš™οΈ Configuration

Backend Configuration (application.yml)

server:
  port: 8080

spring:
  datasource:
    url: jdbc:mysql://localhost:3306/smart_content_db
    username: root
    password: your_password
    driver-class-name: com.mysql.cj.jdbc.Driver

  jpa:
    hibernate:
      ddl-auto: update
    show-sql: true

app:
  security:
    jwt:
      secret-key: YOUR_SECRET_KEY_HERE  # Change this!
      expiration-ms: 86400000  # 24 hours

Frontend Configuration (.env)

VITE_API_BASE_URL=http://localhost:8080/api

πŸƒ Running the App

Development Mode

Terminal 1 - Start Backend

cd smartcontent-backend
mvn spring-boot:run

βœ… Backend running at: http://localhost:8080
πŸ“š API Docs at: http://localhost:8080/swagger-ui.html

Terminal 2 - Start Frontend

cd smartcontent-frontend
npm run dev

βœ… Frontend running at: http://localhost:3000

Production Mode

Backend

cd smartcontent-backend
mvn clean package
java -jar target/ai-content-manager-1.0.0.jar

Frontend

cd smartcontent-frontend
npm run build
npm run preview

πŸ“‘ API Endpoints

Authentication

Method Endpoint Description Auth
POST /api/auth/register Register new user No
POST /api/auth/login Login user No

Register Example:

curl -X POST http://localhost:8080/api/auth/register \
  -H "Content-Type: application/json" \
  -d '{
    "username": "johndoe",
    "email": "john@example.com",
    "password": "password123",
    "fullName": "John Doe",
    "roles": ["AUTHOR"]
  }'

Articles

Method Endpoint Description Auth
GET /api/articles Get all articles (paginated) No
GET /api/articles/{id} Get article by ID No
POST /api/articles Create new article Required
PUT /api/articles/{id} Update article Required
DELETE /api/articles/{id} Delete article Required
GET /api/articles/search?title={title} Search articles No
GET /api/articles/filter/tags?tags={tags} Filter by tags No
GET /api/articles/my-articles Get user's articles Required

Create Article Example:

curl -X POST http://localhost:8080/api/articles \
  -H "Authorization: Bearer YOUR_JWT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "My First Article",
    "content": "Article content here...",
    "status": "PUBLISHED",
    "tags": ["Technology", "AI"]
  }'

AI Features

Method Endpoint Description Auth
POST /api/ai/summarize Generate summary Required
POST /api/ai/generate-tags Generate tags Required
POST /api/ai/seo-score Calculate SEO score Required

Generate Summary Example:

curl -X POST http://localhost:8080/api/ai/summarize \
  -H "Authorization: Bearer YOUR_JWT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"content": "Your article content..."}'

Swagger Documentation

Full API documentation available at: http://localhost:8080/swagger-ui.html


πŸ“ Project Structure

smartcontent/
β”‚
β”œβ”€β”€ smartcontent-backend/           # Spring Boot Backend
β”‚   β”œβ”€β”€ src/main/java/com/smartcontent/
β”‚   β”‚   β”œβ”€β”€ config/                 # Configuration (Security, CORS, Swagger)
β”‚   β”‚   β”œβ”€β”€ controller/             # REST Controllers
β”‚   β”‚   β”œβ”€β”€ service/                # Business Logic
β”‚   β”‚   β”œβ”€β”€ repository/             # Database Repositories
β”‚   β”‚   β”œβ”€β”€ entity/                 # JPA Entities
β”‚   β”‚   β”œβ”€β”€ dto/                    # Data Transfer Objects
β”‚   β”‚   β”œβ”€β”€ security/               # JWT & Security
β”‚   β”‚   β”œβ”€β”€ exception/              # Exception Handling
β”‚   β”‚   └── util/                   # Utilities
β”‚   β”œβ”€β”€ src/main/resources/
β”‚   β”‚   └── application.yml         # Configuration
β”‚   β”œβ”€β”€ pom.xml                     # Maven Dependencies
β”‚   └── schema.sql                  # Database Schema
β”‚
└── smartcontent-frontend/          # React Frontend
    β”œβ”€β”€ src/
    β”‚   β”œβ”€β”€ components/
    β”‚   β”‚   β”œβ”€β”€ common/             # Reusable Components
    β”‚   β”‚   β”œβ”€β”€ landing/            # Landing Page
    β”‚   β”‚   └── dashboard/          # Dashboard Components
    β”‚   β”œβ”€β”€ pages/                  # Page Components
    β”‚   β”œβ”€β”€ layouts/                # Layout Wrappers
    β”‚   β”œβ”€β”€ store/                  # State Management
    β”‚   β”œβ”€β”€ services/               # API Services
    β”‚   β”œβ”€β”€ hooks/                  # Custom Hooks
    β”‚   └── utils/                  # Utilities
    β”œβ”€β”€ package.json                # Dependencies
    β”œβ”€β”€ tailwind.config.js          # Tailwind Config
    β”œβ”€β”€ vite.config.js              # Vite Config
    └── .env                        # Environment Variables

🚒 Deployment

Backend Deployment

Option 1: Docker

# Build Docker image
cd smartcontent-backend
docker build -t smartcontent-backend .
docker run -p 8080:8080 smartcontent-backend

Dockerfile:

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

Option 2: Heroku

cd smartcontent-backend
heroku create smartcontent-api
git push heroku main

Frontend Deployment

Option 1: Vercel (Recommended)

cd smartcontent-frontend
npm i -g vercel
vercel

Option 2: Netlify

npm run build
# Upload dist/ folder to Netlify

Option 3: Docker

FROM node:18-alpine
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
RUN npm run build
EXPOSE 3000
CMD ["npm", "run", "preview"]

πŸ› Troubleshooting

Common Issues

1. CORS Error

Problem: Access to fetch... has been blocked by CORS policy

Solution: Make sure you added CorsConfig.java to backend and restarted the server.

2. Database Connection Failed

Problem: Connection refused or Unknown database

Solution:

# Check MySQL is running
sudo systemctl status mysql  # Linux
net start MySQL80           # Windows

# Create database if missing
mysql -u root -p -e "CREATE DATABASE smart_content_db;"

3. Port Already in Use

Problem: Port 8080 is already in use

Solution:

# Windows
netstat -ano | findstr :8080
taskkill /PID <PID> /F

# Linux/Mac
lsof -ti:8080 | xargs kill -9

4. Frontend Not Connecting to Backend

Problem: Network errors in browser console

Solution:

# Check .env file exists and is correct
cat smartcontent-frontend/.env

# Should show:
VITE_API_BASE_URL=http://localhost:8080/api

# Restart frontend
npm run dev

5. JWT Token Issues

Problem: 401 Unauthorized errors

Solution:

  • Token expires after 24 hours - login again
  • Check token is being sent in Authorization header
  • Make sure you're logged in

Testing Backend

# Test backend is running
curl http://localhost:8080/api/auth/login

# Expected: 400 or 401 (NOT 404)

Testing Frontend

# Test frontend is running
curl http://localhost:3000

# Should return HTML

πŸ§ͺ Testing

Run Backend Tests

cd smartcontent-backend
mvn test

Run Frontend Tests

cd smartcontent-frontend
npm test

🎨 Customization

Change Theme Colors

Edit smartcontent-frontend/tailwind.config.js:

colors: {
  google: {
    blue: '#4285F4',   // Change to your color
    red: '#EA4335',
    yellow: '#FBBC05',
    green: '#34A853',
  }
}

Disable Dark Mode

Edit smartcontent-frontend/index.html:

<!-- Change from: -->
<html lang="en" class="dark">

<!-- To: -->
<html lang="en">

🀝 Contributing

Contributions are welcome! Here's how:

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

Code Style

  • Backend: Follow Java conventions
  • Frontend: Use ESLint
  • Write meaningful commit messages
  • Add tests for new features

πŸ“ License

This project is licensed under the MIT License.

MIT License

Copyright (c) 2024 Your Name

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction...

πŸ‘¨β€πŸ’» Author

Your Name


πŸ™ Acknowledgments

  • Spring Boot team for the amazing framework
  • React community for excellent libraries
  • Google for design inspiration
  • All contributors

πŸ—ΊοΈ Roadmap

  • Integrate real AI API (OpenAI)
  • Add image upload
  • Email notifications
  • Social sharing
  • Mobile app
  • Real-time collaboration
  • Advanced analytics
  • Multi-language support

πŸ“ž Support

Found a bug or have questions?


⭐ Star This Project

If you found this helpful, please give it a ⭐ on GitHub!


Made with ❀️ using Spring Boot and React

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors