A powerful web scraping and data extraction platform that uses AI to transform web content into structured data formats like CSV, Excel, and JSON.
- Multi-Source Data Extraction: Extract data from URLs, text files, and web content
- AI-Powered Question Answering: Ask specific questions about content using OpenAI
- Flexible Output Formats: Export data as CSV, Excel, or JSON
- User Authentication: Secure user management with NextAuth.js
- Project Management: Organize and manage your data extraction projects
- Real-time Processing: Asynchronous job processing with status tracking
- Modern UI: Built with Next.js 15, React 19, and Tailwind CSS
This project consists of two main components:
- Framework: Next.js 15 with React 19
- Styling: Tailwind CSS with Radix UI components
- Authentication: NextAuth.js
- Database: Prisma with PostgreSQL
- Forms: React Hook Form with Zod validation
- State Management: React hooks and context
- Framework: FastAPI (Python)
- AI Integration: OpenAI GPT models via LangChain
- Web Scraping: HTTPX for async requests
- Data Processing: Custom cleaning and extraction methods
- Job Management: In-memory job queue with status tracking
- Node.js 18+ and npm
- Python 3.11+
- PostgreSQL database
- OpenAI API key
git clone https://github.com/Cyro292/formatlyAi.git
cd formatlyAicd formatlyai
npm installCreate environment variables:
cp .env.example .env.localConfigure your .env.local:
# Database
DATABASE_URL="postgresql://username:password@localhost:5432/formatlyai"
# NextAuth
NEXTAUTH_URL="http://localhost:3000"
NEXTAUTH_SECRET="your-secret-key"
# Backend API
NEXT_PUBLIC_BACKEND_URL="http://localhost:8000"
# OpenAI (optional, can be set in backend)
OPENAI_API_KEY="your-openai-api-key"cd formatlyaibackend
pip install -r requirements.txtCreate environment variables:
cp .env.example .envConfigure your .env:
# OpenAI
OPENAI_API_KEY="your-openai-api-key"
OPENAI_MODEL="gpt-4"
# Server Configuration
HOST="0.0.0.0"
PORT=8000
DEBUG=True
# Scraping Configuration
MAX_URLS=50
GLOBAL_CONCURRENCY=5
TIMEOUT_SECS=30
POLITENESS_DELAY=1
USER_AGENT="FormatlyAI Bot 1.0"cd formatlyai
npx prisma migrate dev
npx prisma generatecd formatlyaibackend
uvicorn app.main:app --reload --host 0.0.0.0 --port 8000cd formatlyai
npm run devThe application will be available at:
- Frontend: http://localhost:3000
- Backend API: http://localhost:8000
- API Documentation: http://localhost:8000/docs
- Navigate to the Formatly page
- Enter project name and description
- Choose your data source (URLs, text, or files)
URL Sources:
- Individual URLs: Add URLs one by one
- Bulk URLs: Paste multiple URLs separated by newlines
- File upload: Upload a text file containing URLs
Add questions to extract specific information:
- Question title (e.g., "What is the main topic?")
- Answer type (text, email, phone, number, date, etc.)
- Additional instructions (optional)
Select your preferred output format:
- CSV (recommended for spreadsheets)
- Excel (for complex data)
- JSON (for APIs and integrations)
Click "Start Processing" to:
- Scrape the web content
- Extract answers using AI
- Generate structured data
- Download your results
POST /jobs/links- Create a URL processing jobGET /jobs/{job_id}- Get job statusGET /jobs/{job_id}/result- Get job results
# Create a job
curl -X POST "http://localhost:8000/jobs/links" \
-H "Content-Type: application/json" \
-d '{
"raw_text": "https://example.com",
"payload": {
"transformQuestions": [
{
"title": "What is the main topic?",
"type": "text",
"description": "Extract the main subject"
}
]
}
}'
# Check job status
curl "http://localhost:8000/jobs/{job_id}"
# Get results
curl "http://localhost:8000/jobs/{job_id}/result"formatlyAi/
βββ formatlyai/ # Next.js Frontend
β βββ src/
β β βββ app/ # App Router pages
β β β βββ formatly/ # Main application
β β β βββ api/ # API routes
β β β βββ auth/ # Authentication
β β βββ components/ # Reusable components
β β βββ lib/ # Utilities and services
β βββ prisma/ # Database schema
β βββ package.json
βββ formatlyaibackend/ # FastAPI Backend
β βββ app/
β β βββ api/ # API routes
β β βββ core/ # Configuration
β β βββ models/ # Data models
β β βββ services/ # Business logic
β β βββ storage/ # Data storage
β βββ requirements.txt
βββ README.md
- Environment Variables: Sensitive data stored in
.envfiles - Authentication: Secure user sessions with NextAuth.js
- Input Validation: Zod schemas for data validation
- Rate Limiting: Built-in request throttling
- CORS Protection: Configured for secure cross-origin requests
# Frontend tests
cd formatlyai
npm test
# Backend tests
cd formatlyaibackend
pytest# Frontend linting
cd formatlyai
npm run lint
# Backend formatting
cd formatlyaibackend
black .
isort .- Connect your GitHub repository to Vercel
- Set environment variables in Vercel dashboard
- Deploy automatically on push to main branch
- Create a new project on Railway or Heroku
- Connect your repository
- Set environment variables
- Deploy the
formatlyaibackenddirectory
- Create a PostgreSQL database
- Update
DATABASE_URLin your environment variables - Run migrations:
npx prisma migrate deploy
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Commit your changes:
git commit -m 'Add amazing feature' - Push to the branch:
git push origin feature/amazing-feature - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Email: xxxxxx
- OpenAI for providing the AI capabilities
- Next.js team for the amazing framework
- FastAPI team for the excellent Python web framework
- All contributors and users of this project
Made with β€οΈ by Cyro