cat > README.md << 'EOF'
A comprehensive and scalable AI-powered blog generation platform built with a modern web architecture. This project allows users to schedule and automatically generate blog posts using OpenAI's GPT model, combining the power of Django on the backend and Next.js on the frontend. Real-time updates, scheduled tasks, and an intuitive user interface make it a production-ready solution for automated content creation.
- Django: A high-level Python web framework used to build the core of the backend, handle routing, models, and authentication.
- Django REST Framework (DRF): Simplifies the creation of RESTful APIs, enabling the frontend to interact with backend data seamlessly.
- SimpleJWT: Implements secure user authentication and authorization using JSON Web Tokens.
- Celery: Handles background tasks asynchronously, especially for scheduling AI-generated blogs.
- Celery Beat: Adds periodic task scheduling capabilities, used to check and generate blogs at scheduled times.
- Redis: Acts as the message broker for Celery and can be used for caching and speeding up performance.
- Django Channels: Enables asynchronous support in Django, powering WebSockets for real-time blog updates.
- django-celery-beat: Integrated with the Django admin panel for managing periodic tasks via the UI.
- OpenAI Python SDK: Connects to the GPT model for AI-generated blog content.
- Next.js: Combines server-side rendering with the power of React to create a fast, SEO-friendly UI.
- React: Component-based JavaScript library for building responsive and interactive UIs.
- Axios: Used to make HTTP requests from the frontend to the backend APIs.
- Material UI (MUI): Delivers pre-built, accessible components that follow Google's Material Design.
- Tailwind CSS (optional): Can be used for utility-first styling and rapid UI development.
- next/navigation: Enables dynamic routing and client-side transitions in Next.js.
- Celery Worker: Continuously runs in the background, listening for tasks such as blog generation and executing them outside the request-response cycle.
- Redis Server: Acts as a fast, in-memory broker that queues tasks for Celery.
- Docker (optional): For containerizing and deploying the app seamlessly across environments.
- PostgreSQL/MySQL: Backend SQL database used for storing user data, blog metadata, and scheduling info.
- Register and log in users securely using JWT tokens.
- Protect sensitive endpoints and WebSocket connections using JWT.
- Generate long-form blog articles using OpenAI's GPT API.
- Users can select a category and length, or write a custom prompt.
- AI-generated blogs are automatically saved and associated with the user.
- Schedule blog posts for future generation using Celery Beat.
- Automatically triggers blog creation at the specified time.
- Scheduled tasks are managed in the admin dashboard or via API.
- Get notified in real-time when your blog is generated.
- Uses Django Channels and WebSocket endpoints to broadcast messages.
- Built-in Django Admin to manage users, scheduled stories, and AI logs.
- Control and monitor task executions using django-celery-beat UI.
- RESTful API endpoints for:
- User registration and login
- Scheduling blog posts
- Fetching user-generated blogs
- WebSocket authentication
- Can be extended to integrate with other AI providers or data sources.
```plaintext Client (Next.js/React) | |-- Axios Requests v Backend (Django + DRF) | |-- Auth (SimpleJWT) |-- API for scheduling/blog management |-- OpenAI API integration | |-- Celery (async tasks) | | | --> Redis (task broker) | --> OpenAI for blog generation | |-- Channels (WebSockets) | --> Real-time notifications | Database (PostgreSQL/MySQL) | --> Stores users, blog posts, schedules ```
- Manual API testing can be done using:
- REST Client (VSCode extension)
- Postman
- Thunder Client
- WebSocket endpoints can be tested using:
- Postman WebSocket feature
- `wscat` command-line tool
```bash
git clone https://github.com/your-username/ai-blog-platform.git cd ai-blog-platform
cd backend python -m venv venv source venv/bin/activate pip install -r requirements.txt python manage.py migrate python manage.py runserver
redis-server
celery -A config worker --loglevel=info celery -A config beat --loglevel=info
cd ../frontend npm install npm run dev ```
- Fork the repo.
- Create your feature branch: `git checkout -b feature/blog-scheduler`.
- Commit your changes: `git commit -am 'Add new blog scheduling feature'`.
- Push to the branch: `git push origin feature/blog-scheduler`.
- Open a pull request 🚀
This project is licensed under the MIT License. See `LICENSE` for more information.
Emmanuel Makau
Backend Developer Intern & Full-stack Enthusiast
📧 [email protected]
🔗 GitHub — replace with your GitHub profile
EOF