A backend API built with Node.js and Express for an AI-powered paraphrasing platform. The application handles real-time OpenAI streaming responses, user authentication, payment processing, content generation, and admin management.
- RESTful API architecture with CORS support for secure communication between the frontend and backend.
- Structured backend architecture with routes, controllers, and middleware support.
- AI-powered text paraphrasing with real-time streaming responses using Server-Sent Events (SSE), along with smart batch processing to handle large text inputs smoothly and deliver faster streaming output to the frontend.
- Live content generation using OpenAI APIs and AI content detection using ZeroGPT API integration.
- User authentication system including registration, login, forgot password, and password change.
- Secure admin routes protected through custom middleware.
- Stripe payment integration with webhook support for automatic payment verification and user updates.
- Email notification system with node-mailer and handlebars (email templates).
- NodeJs
- ExpressJS
- OpenAI integration
- Stripe Payment Integration
- Node Mailer, Handlebars.
index.js # Entry point
config/connection.js # Database connection
controllers/ # Route handlers
models/ # Database models
routes/ # API routes
templates/views/ # Handlebars templates
public/images/ # Static assets
utils/ # Utility functions (mail, paraphrase, etc.)
- Clone the repository
- Run
npm installto install dependencies - Configure your database in
config/connection.js - Create a .env file in the root directory and add the following:
APP_NAME=YourAppName
APP_URL=http://localhost:3000
DB_HOST=localhost
DB_USER=your_db_user
DB_PASSWORD=your_db_password
DB_NAME=your_db_name
PORT=5000
OPENAI_KEY=""
PROMPT_PREMIUM_MODE = 'Prompt: "Rewrite the below content in ..."';
PROMPT_LIGHTNING_MODE = 'Prompt: "Rewrite the below content with in ..."';
TEMP_LIGHTNING_MODE = 1;
FREQUENCY_LIGHTNING_MODE = 0.3;
PRESENCE_LIGHTNING_MODE = 0.1;
TOP_P_LIGHTNING_MODE = 1;
TEMP_PREMIUM_MODE = 1;
FREQUENCY_PREMIUM_MODE = 0.6;
PRESENCE_PREMIUM_MODE = 0.1;
TOP_P_PREMIUM_MODE = 1;
MAX_TOKENS_PREMIUM_MODE = 5000;
MAX_TOKENS_LIGHTNING_MODE = 8000;
MODEL_LIGHTNING_MODE = gpt-4o-mini;
MODEL_PREMIUM_MODE = gpt-4;
BATCH_CHARACTER = 4000;
ZERO_GPT_API_KEY = your_zerogpt_api_key
SENDGRID_API_KEY = your_sendgrid_api_key
EMAIL_FROM = your_email_address- Start the server:
node index.js - Access API endpoints at
http://localhost:5000/
Check the repo - https://github.com/pabitrabarua123/oneclickhuman-AI-paraphrase