add missing base code

This commit is contained in:
Kunthawat Greethong
2026-01-08 22:47:59 +07:00
parent c35fa52117
commit cf00eb8e18
15 changed files with 1703 additions and 0 deletions

75
.github/CODE_OF_CONDUCT.md vendored Normal file
View File

@@ -0,0 +1,75 @@
# Contributor Covenant Code of Conduct
## Our Pledge
We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
## Our Standards
Examples of behavior that contributes to a positive environment for our community include:
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behavior include:
* The use of sexualized language or imagery, and sexual attention or advances of any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email address, without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a professional setting
## Enforcement Responsibilities
Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
## Scope
This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at [INSERT CONTACT METHOD]. All complaints will be reviewed and investigated promptly and fairly.
All community leaders are obligated to respect the privacy and security of the reporter of any incident.
## Enforcement Guidelines
Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
### 1. Correction
**Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
**Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
### 2. Warning
**Community Impact**: A violation through a single incident or series of actions.
**Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
### 3. Temporary Ban
**Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
**Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
### 4. Permanent Ban
**Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
**Consequence**: A permanent ban from any sort of public interaction within the community.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0, available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
[homepage]: https://www.contributor-covenant.org
For answers to common questions about this code of conduct, see the FAQ at https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.

182
.github/CONTRIBUTING.md vendored Normal file
View File

@@ -0,0 +1,182 @@
# Contributing to ALwrity
Thank you for your interest in contributing to ALwrity! 🚀 We welcome contributions from the community and appreciate your help in making this AI-powered digital marketing platform even better.
## 🤝 How to Contribute
### 1. **Report Issues**
- Use our [GitHub Issues](https://github.com/AJaySi/ALwrity/issues) to report bugs or request features
- Check existing issues before creating new ones
- Provide clear descriptions and steps to reproduce bugs
### 2. **Submit Pull Requests**
- Fork the repository
- Create a feature branch: `git checkout -b feature/amazing-feature`
- Make your changes and test thoroughly
- Submit a pull request with a clear description
### 3. **Code Contributions**
- Follow our coding standards (see below)
- Add tests for new functionality
- Update documentation as needed
- Ensure all tests pass before submitting
## 🛠️ Development Setup
### Prerequisites
- **Python 3.10+** (Backend: FastAPI, SQLAlchemy, AI integrations)
- **Node.js 18+** (Frontend: React, TypeScript, Material-UI)
- **Git** (Version control)
- **API Keys** (Gemini, OpenAI, Anthropic, etc.)
### Quick Start
```bash
# Clone the repository
git clone https://github.com/AJaySi/ALwrity.git
cd ALwrity
# Backend setup
cd backend
pip install -r requirements.txt
cp env_template.txt .env # Configure your API keys
python start_alwrity_backend.py
# Frontend setup (in a new terminal)
cd frontend
npm install
cp env_template.txt .env # Configure your environment
npm start
```
### Environment Configuration
1. **Backend**: Copy `backend/env_template.txt` to `backend/.env`
2. **Frontend**: Copy `frontend/env_template.txt` to `frontend/.env`
3. **API Keys**: Add your AI service API keys to the respective `.env` files
## 📝 Coding Standards
### Python (Backend)
- **Style**: Follow PEP 8 guidelines, use Black formatter
- **Type Hints**: Use type hints for all function parameters and return values
- **Documentation**: Add comprehensive docstrings using Google style
- **Error Handling**: Use proper exception handling with meaningful error messages
- **Logging**: Use structured logging with appropriate levels
- **API Design**: Follow RESTful principles, use FastAPI best practices
- **Database**: Use SQLAlchemy ORM, implement proper migrations
### TypeScript/React (Frontend)
- **TypeScript**: Strict mode enabled, no `any` types
- **Components**: Functional components with hooks, proper prop typing
- **State Management**: Use React hooks, consider context for global state
- **Styling**: Material-UI components, consistent theming
- **Error Boundaries**: Implement error boundaries for better UX
- **Performance**: Use React.memo, useMemo, useCallback where appropriate
- **Testing**: Jest + React Testing Library for unit tests
### ALwrity-Specific Guidelines
- **AI Integration**: Always handle API rate limits and errors gracefully
- **Content Generation**: Implement proper validation and sanitization
- **SEO Features**: Follow SEO best practices in generated content
- **User Experience**: Maintain consistent UI/UX across all features
- **Security**: Validate all inputs, implement proper authentication
## 🧪 Testing
### Backend Testing
```bash
cd backend
python -m pytest test/
```
### Frontend Testing
```bash
cd frontend
npm test
```
## 📋 Pull Request Guidelines
### Before Submitting
- [ ] Code follows project style guidelines
- [ ] Self-review completed
- [ ] Tests added/updated and passing
- [ ] Documentation updated
- [ ] No merge conflicts
### PR Description Template
```markdown
## Description
Brief description of changes
## Type of Change
- [ ] Bug fix
- [ ] New feature
- [ ] Breaking change
- [ ] Documentation update
## Testing
- [ ] Backend tests pass
- [ ] Frontend tests pass
- [ ] Manual testing completed
## Screenshots (if applicable)
Add screenshots to help explain your changes
```
## 🏷️ Issue Labels
We use the following labels to categorize issues:
- `bug`: Something isn't working
- `enhancement`: New feature or request
- `documentation`: Improvements or additions to documentation
- `good first issue`: Good for newcomers
- `help wanted`: Extra attention is needed
- `priority: high`: High priority issues
- `priority: low`: Low priority issues
## 💬 Community Guidelines
- Be respectful and inclusive
- Help others learn and grow
- Provide constructive feedback
- Follow the [Code of Conduct](CODE_OF_CONDUCT.md)
## 🎯 Areas for Contribution
### High Priority
- **Bug Fixes**: Critical issues affecting core functionality
- **Performance**: API response times, database optimization
- **Documentation**: API docs, user guides, setup instructions
- **Test Coverage**: Unit tests, integration tests, E2E tests
- **Security**: Vulnerability fixes, security improvements
### Feature Areas
- **AI Content Generation**: Blog posts, social media content, SEO optimization
- **SEO Dashboard**: Google Search Console integration, analytics
- **Social Media**: LinkedIn, Facebook, Instagram content creation
- **Content Planning**: Calendar management, content strategy
- **User Experience**: Onboarding flow, dashboard improvements
- **Analytics**: Usage tracking, performance metrics
- **Integrations**: Third-party API integrations, webhooks
### Good First Issues
Look for issues labeled with `good first issue` - these are perfect for newcomers:
- Documentation improvements
- UI/UX enhancements
- Test additions
- Bug fixes with clear reproduction steps
- Feature requests with detailed specifications
## 📞 Getting Help
- Join our [Discussions](https://github.com/AJaySi/ALwrity/discussions)
- Check existing [Issues](https://github.com/AJaySi/ALwrity/issues)
- Review [Documentation](https://github.com/AJaySi/ALwrity/wiki)
## 🙏 Recognition
Contributors will be recognized in our README and release notes. Thank you for helping make ALwrity better for everyone!
---
**Happy Contributing!** 🎉

286
.github/INSTALLATION.md vendored Normal file
View File

@@ -0,0 +1,286 @@
# ALwrity Quick Start Guide
Complete setup guide for running ALwrity locally after cloning from GitHub.
## 🎯 **Prerequisites**
Before you begin, ensure you have:
- **Node.js** 16+ and npm installed ([Download](https://nodejs.org/))
- **Python** 3.8+ installed ([Download](https://www.python.org/downloads/))
- **Git** installed ([Download](https://git-scm.com/downloads))
- **Clerk Account** ([Sign up](https://clerk.com/))
- **API Keys** (Gemini, CopilotKit, etc.)
## 🚀 **Quick Setup (Automated)**
### **Option A: Windows**
```powershell
# 1. Clone the repository
git clone https://github.com/AJaySi/ALwrity.git
cd ALwrity
# 2. Run automated setup
.\setup_alwrity.bat
```
### **Option B: macOS/Linux**
```bash
# 1. Clone the repository
git clone https://github.com/AJaySi/ALwrity.git
cd ALwrity
# 2. Make script executable and run
chmod +x setup_alwrity.sh
./setup_alwrity.sh
```
## 📝 **Manual Setup (Step-by-Step)**
### **Step 1: Clone Repository**
```bash
git clone https://github.com/AJaySi/ALwrity.git
cd ALwrity
```
### **Step 2: Backend Setup**
```bash
# Navigate to backend
cd backend
# Create virtual environment
python -m venv .venv
# Activate virtual environment
# Windows:
.venv\Scripts\activate
# macOS/Linux:
source .venv/bin/activate
# Install dependencies
pip install -r requirements.txt
# Create .env file
cp env_template.txt .env
# Edit .env and add your API keys:
# - CLERK_SECRET_KEY
# - CLERK_PUBLISHABLE_KEY
# - GEMINI_API_KEY (optional, can be provided in UI)
# Initialize database
python scripts/create_subscription_tables.py
python scripts/cleanup_alpha_plans.py
# Return to root
cd ..
```
### **Step 3: Frontend Setup**
```bash
# Navigate to frontend
cd frontend
# Clean install (important!)
rm -rf node_modules package-lock.json # macOS/Linux
# OR for Windows PowerShell:
# Remove-Item -Recurse -Force node_modules, package-lock.json -ErrorAction SilentlyContinue
# Install dependencies (THIS IS CRITICAL - DO NOT SKIP!)
npm install
# Create .env file
cp env_template.txt .env
# Edit .env and add:
# REACT_APP_CLERK_PUBLISHABLE_KEY=<your-clerk-publishable-key>
# REACT_APP_API_BASE_URL=http://localhost:8000
# Build the project (validates everything compiles)
npm run build
# Return to root
cd ..
```
### **Step 4: Start the Application**
**Terminal 1 - Backend:**
```bash
cd backend
python app.py
```
**Terminal 2 - Frontend:**
```bash
cd frontend
npm start
```
### **Step 5: Access the Application**
- **Frontend UI**: http://localhost:3000
- **Backend API Docs**: http://localhost:8000/api/docs
- **Health Check**: http://localhost:8000/health
## 🐛 **Troubleshooting Common Issues**
### **Issue 1: "CopilotSidebar is not exported" Error**
**Cause**: Did not run `npm install` in frontend directory
**Fix:**
```bash
cd frontend
rm -rf node_modules package-lock.json
npm install
npm run build
npm start
```
### **Issue 2: "Module not found" (Python)**
**Cause**: Did not install Python dependencies or activate virtual environment
**Fix:**
```bash
cd backend
source .venv/bin/activate # or .venv\Scripts\activate on Windows
pip install -r requirements.txt
```
### **Issue 3: "CORS Error" in Browser**
**Cause**: Backend not running or frontend connecting to wrong URL
**Fix:**
1. Ensure backend is running on `http://localhost:8000`
2. Check `frontend/.env` has `REACT_APP_API_BASE_URL=http://localhost:8000`
3. Restart both frontend and backend
### **Issue 4: "Clerk Publishable Key Missing"**
**Cause**: Frontend `.env` file not configured
**Fix:**
```bash
cd frontend
# Edit .env file and add:
# REACT_APP_CLERK_PUBLISHABLE_KEY=pk_test_xxx...
```
### **Issue 5: "Database Error" or "Subscription Plans Not Found"**
**Cause**: Database tables not created
**Fix:**
```bash
cd backend
python scripts/create_subscription_tables.py
python scripts/cleanup_alpha_plans.py
```
### **Issue 6: "Port Already in Use"**
**Backend (8000):**
```bash
# Find and kill process using port 8000
# Windows:
netstat -ano | findstr :8000
taskkill /PID <process_id> /F
# macOS/Linux:
lsof -ti:8000 | xargs kill -9
```
**Frontend (3000):**
```bash
# Find and kill process using port 3000
# Windows:
netstat -ano | findstr :3000
taskkill /PID <process_id> /F
# macOS/Linux:
lsof -ti:3000 | xargs kill -9
```
## ✅ **Verification Checklist**
After setup, verify:
- [ ] Backend health check returns 200 OK: `curl http://localhost:8000/health`
- [ ] Frontend loads without errors
- [ ] Can sign in with Clerk authentication
- [ ] Pricing page loads with 4 subscription tiers (Free, Basic, Pro, Enterprise)
- [ ] Can navigate to onboarding after selecting a plan
## 📚 **Environment Variables Required**
### **Backend (.env)**
```bash
# Required for authentication
CLERK_SECRET_KEY=sk_test_xxx...
CLERK_PUBLISHABLE_KEY=pk_test_xxx...
# Optional (can be provided via UI in Step 1 of onboarding)
GEMINI_API_KEY=AIzaSy...
EXA_API_KEY=xxx...
COPILOTKIT_API_KEY=xxx...
# Development settings
DISABLE_AUTH=false
DEPLOY_ENV=local
```
### **Frontend (.env)**
```bash
# Required
REACT_APP_CLERK_PUBLISHABLE_KEY=pk_test_xxx...
# Optional
REACT_APP_API_BASE_URL=http://localhost:8000
REACT_APP_COPILOTKIT_API_KEY=xxx...
```
## 🎯 **First-Time User Flow**
After setup:
1. **Start both servers** (backend + frontend)
2. **Navigate to** http://localhost:3000
3. **Sign in** with Clerk
4. **Select subscription plan** (Free or Basic for alpha testing)
5. **Complete onboarding** (6 steps):
- Step 1: API Keys
- Step 2: Website Analysis
- Step 3: Competitor Research
- Step 4: Persona Generation
- Step 5: Research Preferences
- Step 6: Final Review
6. **Access dashboard** with all features unlocked
## 🆘 **Getting Help**
If you encounter issues:
1. **Check logs**: Both terminal windows show detailed error messages
2. **GitHub Issues**: https://github.com/AJaySi/ALwrity/issues
3. **Documentation**: See `docs/` directory for detailed guides
4. **Common Issues**: See `docs/GITHUB_ISSUE_291_FIX.md` for CopilotSidebar error
## 📖 **Additional Documentation**
- **Onboarding System**: `docs/API_KEY_MANAGEMENT_ARCHITECTURE.md`
- **Subscription System**: `docs/Billing_Subscription/SUBSCRIPTION_IMPLEMENTATION_SUMMARY.md`
- **Deployment Guide**: `DEPLOY_ENV_REFERENCE.md`
- **API Key Management**: `docs/API_KEY_INJECTION_EXPLAINED.md`
---
**Need help? Open an issue on GitHub: https://github.com/AJaySi/ALwrity/issues**

65
.github/ISSUE_TEMPLATE/bug_report.md vendored Normal file
View File

@@ -0,0 +1,65 @@
---
name: Bug Report
about: Create a report to help us improve ALwrity
title: '[BUG] '
labels: ['bug', 'needs-triage']
assignees: ''
---
## 🐛 Bug Description
A clear and concise description of what the bug is.
## 🔄 Steps to Reproduce
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
## ✅ Expected Behavior
A clear and concise description of what you expected to happen.
## ❌ Actual Behavior
A clear and concise description of what actually happened.
## 📸 Screenshots
If applicable, add screenshots to help explain your problem.
## 🖥️ Environment
**Desktop (please complete the following information):**
- OS: [e.g. Windows 10, macOS 12.0, Ubuntu 20.04]
- Browser: [e.g. Chrome 91, Firefox 89, Safari 14]
- ALwrity Version: [e.g. v1.2.3]
**Mobile (please complete the following information):**
- Device: [e.g. iPhone 12, Samsung Galaxy S21]
- OS: [e.g. iOS 14.6, Android 11]
- Browser: [e.g. Safari, Chrome Mobile]
## 📋 Additional Context
Add any other context about the problem here.
## 🔍 Error Logs
If applicable, paste any error logs or console output here:
```
Paste error logs here
```
## 🏷️ Component/Feature
Which component or feature is affected?
- [ ] Blog Writer
- [ ] SEO Dashboard
- [ ] Content Planning
- [ ] Facebook Writer
- [ ] LinkedIn Writer
- [ ] Onboarding
- [ ] Authentication
- [ ] API
- [ ] Other: _______________
## 🎯 Priority
- [ ] Critical (blocks core functionality)
- [ ] High (major impact on user experience)
- [ ] Medium (minor impact)
- [ ] Low (cosmetic issue)

11
.github/ISSUE_TEMPLATE/config.yml vendored Normal file
View File

@@ -0,0 +1,11 @@
blank_issues_enabled: false
contact_links:
- name: GitHub Community Support
url: https://github.com/AJaySi/ALwrity/discussions
about: Please ask and answer questions here.
- name: ALwrity Documentation
url: https://github.com/AJaySi/ALwrity/wiki
about: Check our documentation for setup guides and tutorials.
- name: Security Vulnerability
url: https://github.com/AJaySi/ALwrity/security/advisories/new
about: Report security vulnerabilities privately.

View File

@@ -0,0 +1,67 @@
---
name: Feature Request
about: Suggest an idea for ALwrity
title: '[FEATURE] '
labels: ['enhancement', 'needs-triage']
assignees: ''
---
## 🚀 Feature Description
A clear and concise description of the feature you'd like to see implemented.
## 💡 Motivation
Why is this feature important? What problem does it solve?
## 📝 Detailed Description
Provide a detailed description of how this feature should work.
## 🎯 Use Cases
Describe specific use cases for this feature:
1. Use case 1
2. Use case 2
3. Use case 3
## 🎨 Mockups/Designs
If applicable, add mockups, wireframes, or design concepts.
## 🔧 Technical Considerations
Any technical considerations or implementation notes:
- [ ] Requires backend changes
- [ ] Requires frontend changes
- [ ] Requires database changes
- [ ] Requires third-party integration
- [ ] Other: _______________
## 🏷️ Component/Feature Area
Which component or feature area does this relate to?
- [ ] Blog Writer
- [ ] SEO Dashboard
- [ ] Content Planning
- [ ] Facebook Writer
- [ ] LinkedIn Writer
- [ ] Onboarding
- [ ] Authentication
- [ ] API
- [ ] UI/UX
- [ ] Performance
- [ ] Other: _______________
## 🎯 Priority
- [ ] Critical (essential for core functionality)
- [ ] High (significant value add)
- [ ] Medium (nice to have)
- [ ] Low (future consideration)
## 🔄 Alternatives Considered
Describe any alternative solutions or features you've considered.
## 📚 Additional Context
Add any other context, research, or references about the feature request here.
## 🤝 Contribution
Are you willing to contribute to implementing this feature?
- [ ] Yes, I can help implement this
- [ ] Yes, I can help with testing
- [ ] Yes, I can help with documentation
- [ ] No, but I can provide feedback
- [ ] No, just suggesting the idea

56
.github/ISSUE_TEMPLATE/question.yml vendored Normal file
View File

@@ -0,0 +1,56 @@
name: Question
description: Ask a question about ALwrity
title: "[QUESTION] "
labels: ["question", "needs-triage"]
body:
- type: markdown
attributes:
value: |
Thanks for your question! Please provide as much detail as possible to help us help you.
- type: textarea
id: question
attributes:
label: What's your question?
description: Please describe your question in detail
placeholder: What would you like to know about ALwrity?
validations:
required: true
- type: textarea
id: context
attributes:
label: Additional context
description: Any additional context, screenshots, or information that might help
placeholder: Add any relevant context here...
- type: dropdown
id: component
attributes:
label: Which component/feature is this about?
description: Select the most relevant component
options:
- Blog Writer
- SEO Dashboard
- Content Planning
- Facebook Writer
- LinkedIn Writer
- Onboarding
- Authentication
- API
- Installation/Setup
- Other
validations:
required: true
- type: dropdown
id: priority
attributes:
label: Priority
description: How urgent is this question?
options:
- Low (general question)
- Medium (affecting workflow)
- High (blocking progress)
validations:
required: true

163
.github/README.md vendored Normal file
View File

@@ -0,0 +1,163 @@
<div align="center">
# 🚀 ALwrity — AI-Powered Digital Marketing Platform
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/)
[![FastAPI](https://img.shields.io/badge/FastAPI-0.115+-green.svg)](https://fastapi.tiangolo.com/)
[![React](https://img.shields.io/badge/React-18+-blue.svg)](https://react.dev/)
[![Stars](https://img.shields.io/github/stars/AJaySi/AI-Writer?style=social)](https://github.com/AJaySi/AI-Writer/stargazers)
**Create, optimize, and publish highquality content across platforms — in minutes, not months.**
[🌐 Live Demo](https://www.alwrity.com) • [📚 Docs Site](https://ajaysi.github.io/ALwrity/) • [📖 Wiki](https://github.com/AJaySi/AI-Writer/wiki) • [💬 Discussions](https://github.com/AJaySi/AI-Writer/discussions) • [🐛 Issues](https://github.com/AJaySi/AI-Writer/issues)
</div>
<p align="center">
<a href="https://ajaysi.github.io/ALwrity/"><img src="https://raw.githubusercontent.com/AJaySi/AI-Writer/main/docs-site/docs/assests/hero-1.jpg" alt="ALwrity dashboard overview" width="30%"/></a>
<a href="https://ajaysi.github.io/ALwrity/features/blog-writer/overview/"><img src="https://raw.githubusercontent.com/AJaySi/AI-Writer/main/docs-site/docs/assests/hero-2.png" alt="Story Writer workflow" width="30%"/></a>
<a href="https://ajaysi.github.io/ALwrity/features/seo-dashboard/overview/"><img src="https://raw.githubusercontent.com/AJaySi/AI-Writer/main/docs-site/docs/assests/hero-3.png" alt="SEO dashboard insights" width="30%"/></a>
</p>
---
### Why ALwrity
- **AI-first outcomes**: Strategy-to-publishing in one flow — strategy, research, creation, QA, and distribution.
- **Grounded & reliable**: Google grounding, Exa/Tavily research, citation management.
- **Secure & scalable**: JWT auth, OAuth2, rate limiting, monitoring, subscription/usage tracking.
- **Built for solopreneurs**: Enterprise-grade capabilities with a fast, friendly UI.
---
### Why it matters for creators & marketers
- **Reduce complexity of AI tools**: Guided flows (research → outline → write → optimize → publish) remove prompt engineering and tool-juggling.
- **Save time, ship consistently**: Phase navigation and checklists keep you moving, ensuring on-time publishing across platforms.
- **Trust the content**: Google grounding, retrieval (web/semantic/neural), and citations mean fewer rewrites and safer publishing.
- **Stay on-brand and compliant**: Personas, tone controls, and rate limits help maintain voice and prevent platform penalties.
- **Catch issues early**: Scheduler “tasks needing intervention,” alerts, and logs highlight problems before your audience sees them.
---
### Whats functional now
- **AI Blog Writer (Phases)**: Research → Outline → Content → SEO → Publish, with guarded navigation and local persistence (`frontend/src/hooks/usePhaseNavigation.ts`).
- **SEO Dashboard**: Analysis, metadata, and Google Search Console insights (see docs under `docs-site/docs/features/seo-dashboard`).
- **Story Writer**: Setup (premise) → Outline → Writing → Export with phase navigation and reset (`frontend/src/hooks/useStoryWriterPhaseNavigation.ts`).
- **LinkedIn (Factual, GoogleGrounded)**: Real Google grounding + citations + quality metrics for posts/articles/carousels/scripts (see `frontend/docs/linkedin_factual_google_grounded_url_content.md`).
- **Persona System**: Core personas and platform adaptations via APIs (`backend/api/persona.py`).
- **Facebook Persona Service**: Gemini structured JSON for Facebookspecific persona optimization (`backend/services/persona/facebook/facebook_persona_service.py`).
- **Personalization & Brand Voice**: Validation and configuration of writing style, tone, structure (`backend/services/component_logic/personalization_logic.py`).
See details in the Wiki: [Docs Home](https://github.com/AJaySi/AI-Writer/wiki)
---
### Quick Start
1) Clone & install
```bash
git clone https://github.com/AJaySi/AI-Writer.git
cd AI-Writer/backend && pip install -r requirements.txt
cd ../frontend && npm install
```
2) Run locally
```bash
# Backend
cd backend && python start_alwrity_backend.py
# Frontend
cd frontend && npm start
```
3) Open and create
- Frontend: http://localhost:3000
- API docs (local): http://localhost:8000/api/docs
- Complete onboarding → generate content → publish
---
### Integrations & Security
- **Integrations**: Google Search Console (SEO Dashboard), LinkedIn (factual/grounded content).
- **AI Models**: OpenAI, Google Gemini/Imagen, Hugging Face, Anthropic, Mistral.
- **Security**: JWT auth, OAuth2, rate limiting, monitoring/logging.
- **Reliability**: Grounding + retrieval and citation tracking for factual generation.
---
### Tech Stack
| Area | Technologies |
| --- | --- |
| Backend | FastAPI, Python 3.10+, SQLAlchemy |
| Frontend | React 18+, TypeScript, MaterialUI, CopilotKit |
| AI/Research | OpenAI, Gemini/Imagen, Hugging Face, Anthropic, Mistral; Exa, Tavily, Serper (auto provider selection: Gemini default, HF fallback) |
| Data | SQLite (PostgreSQLready) |
| Integrations | Google Search Console, LinkedIn |
| Ops | Loguru monitoring, rate limiting, JWT/OAuth2 |
---
### LLM Providers: Gemini & Hugging Face
- **Autoselection**: The backend autoselects the provider based on `GPT_PROVIDER` and available keys.
- Default: Gemini (if `GEMINI_API_KEY` present)
- Fallback: Hugging Face (if `HF_TOKEN` present)
- **Configure**:
- `GEMINI_API_KEY=...` (text + structured JSON; image via Imagen)
- `HF_TOKEN=...` (text via Inference API; image via supported HF models)
- Optional: `GPT_PROVIDER=gemini` or `GPT_PROVIDER=hf_response_api`
- **Text generation**:
- Gemini: optimized for structured outputs and fast general generation
- HF: broad model access via the Inference Providers
- **Image generation**:
- Gemini/Imagen and Hugging Face providers are supported with a unified interface
For module details, see `backend/services/llm_providers/README.md`.
---
### Documentation
- Docs Site (MkDocs): https://ajaysi.github.io/ALwrity/
- Blog Writer (phases and UI): `docs-site/docs/features/blog-writer/overview.md`
- SEO Dashboard overview: `docs-site/docs/features/seo-dashboard/overview.md`
- SEO Dashboard GSC integration: `docs-site/docs/features/seo-dashboard/gsc-integration.md`
- LinkedIn factual, Google-grounded content: `frontend/docs/linkedin_factual_google_grounded_url_content.md`
- Persona Development (docs-site): `docs-site/docs/features/content-strategy/personas.md`
For additional pages, browse the `docs-site/docs/` folder.
---
### Personas (Brief)
ALwrity generates a core writing persona from onboarding data, then adapts it per platform (e.g., Facebook, LinkedIn). Personas guide tone, structure, and content preferences across tools.
- Core Persona & API: `backend/api/persona.py`
- Facebook Persona Service (Gemini structured JSON): `backend/services/persona/facebook/facebook_persona_service.py`
- Personalization/Brand Voice logic: `backend/services/component_logic/personalization_logic.py`
- Docs (GitHub paths):
- Personas (docs-site): https://github.com/AJaySi/AI-Writer/blob/main/docs-site/docs/features/content-strategy/personas.md
- LinkedIn Grounded Content plan: https://github.com/AJaySi/AI-Writer/blob/main/frontend/docs/linkedin_factual_google_grounded_url_content.md
At a glance:
- Data → Persona: Onboarding + website analysis → core persona
- Platform adaptations: Platform-specific JSON with validations/optimizations
- Usage: Informs tone, content length, structure, and platform best practices
---
### Community
- **Docs & Wiki**: https://github.com/AJaySi/AI-Writer/wiki
- **Discussions**: https://github.com/AJaySi/AI-Writer/discussions
- **Issues**: https://github.com/AJaySi/AI-Writer/issues
- **Website**: https://www.alwrity.com
---
### License
MIT — see [LICENSE](../LICENSE).
<div align="center">
Made with ❤️ by the ALwrity team
</div>

113
.github/SECURITY.md vendored Normal file
View File

@@ -0,0 +1,113 @@
# Security Policy
## 🔒 Supported Versions
We release patches for security vulnerabilities in the following versions:
| Version | Supported |
| ------- | ------------------ |
| 1.0.x | :white_check_mark: |
| < 1.0 | :x: |
## 🚨 Reporting a Vulnerability
We take security seriously. If you discover a security vulnerability within ALwrity, please follow these steps:
### 1. **DO NOT** create a public GitHub issue
Security vulnerabilities should be reported privately to prevent exploitation.
### 2. **Email us directly**
Send an email to: [security@alwrity.com](mailto:security@alwrity.com)
**Include the following information:**
- Description of the vulnerability
- Steps to reproduce the issue
- Potential impact assessment
- Suggested fix (if any)
- Your contact information
### 3. **Response Timeline**
- **Initial Response**: Within 48 hours
- **Status Update**: Within 7 days
- **Resolution**: Within 30 days (depending on complexity)
### 4. **What to Expect**
- We will acknowledge receipt of your report
- We will investigate and validate the vulnerability
- We will provide regular updates on our progress
- We will coordinate the disclosure timeline with you
- We will credit you in our security advisories (unless you prefer to remain anonymous)
## 🛡️ Security Best Practices
### For Users
- Keep your ALwrity installation updated
- Use strong, unique passwords
- Enable two-factor authentication where available
- Regularly review your API keys and access permissions
- Report suspicious activity immediately
### For Developers
- Follow secure coding practices
- Validate all user inputs
- Use parameterized queries to prevent SQL injection
- Implement proper authentication and authorization
- Keep dependencies updated
- Use HTTPS in production
- Implement rate limiting
- Log security-relevant events
## 🔐 Security Features
ALwrity implements the following security measures:
- **Authentication**: Secure user authentication with JWT tokens and Clerk integration
- **Authorization**: Role-based access control and subscription-based access
- **Input Validation**: Comprehensive input sanitization for all user inputs
- **API Security**: Rate limiting, request validation, and API key management
- **Data Encryption**: Sensitive data encryption at rest and in transit
- **CORS Protection**: Proper cross-origin resource sharing configuration
- **Security Headers**: Implementation of security headers and CSP policies
- **Dependency Scanning**: Regular dependency vulnerability scanning
- **AI Service Security**: Secure API key management for AI services
- **Content Sanitization**: Proper sanitization of AI-generated content
- **Database Security**: SQL injection prevention with SQLAlchemy ORM
- **File Upload Security**: Secure file handling and validation
## 🚫 Out of Scope
The following are considered out of scope for our security program:
- Social engineering attacks
- Physical attacks
- Attacks requiring physical access to the server
- Attacks requiring access to the local network
- Denial of service attacks
- Spam or social engineering issues
- Issues in third-party applications or services
## 🏆 Hall of Fame
We maintain a security hall of fame to recognize researchers who help improve ALwrity's security:
- [Your name could be here!]
## 📞 Contact
For security-related questions or concerns:
- **Email**: [security@alwrity.com](mailto:security@alwrity.com)
- **GitHub**: Create a private security advisory
- **Response Time**: 24-48 hours
## 📜 Legal
By reporting a security vulnerability, you agree to:
- Allow us reasonable time to investigate and mitigate the issue
- Not publicly disclose the vulnerability until we have had a chance to address it
- Make a good faith effort to avoid privacy violations, destruction of data, and interruption or degradation of our services
## 🔄 Policy Updates
This security policy may be updated from time to time. We will notify users of any significant changes through our standard communication channels.
**Last Updated**: September 2024

140
.github/SUPPORT.md vendored Normal file
View File

@@ -0,0 +1,140 @@
# Support
## 🆘 Getting Help
We're here to help you get the most out of ALwrity! Here are the best ways to get support:
### 📚 Documentation
- **[Main Documentation](https://github.com/AJaySi/ALwrity/wiki)** - Comprehensive guides and tutorials
- **[API Documentation](https://github.com/AJaySi/ALwrity/wiki/API-Documentation)** - Complete API reference
- **[Setup Guide](https://github.com/AJaySi/ALwrity/wiki/Setup-Guide)** - Installation and configuration
- **[User Guide](https://github.com/AJaySi/ALwrity/wiki/User-Guide)** - How to use ALwrity features
- **[GSC Integration Guide](GSC_INTEGRATION_README.md)** - Google Search Console setup
- **[Alpha Subscription Guide](backend/ALPHA_SUBSCRIPTION_IMPLEMENTATION_PLAN.md)** - Subscription system
### 💬 Community Support
- **[GitHub Discussions](https://github.com/AJaySi/ALwrity/discussions)** - Ask questions and share ideas
- **[GitHub Issues](https://github.com/AJaySi/ALwrity/issues)** - Report bugs and request features
- **[Discord Community](https://discord.gg/alwrity)** - Real-time chat and support (coming soon)
### 🐛 Bug Reports
If you encounter a bug:
1. Check existing [issues](https://github.com/AJaySi/ALwrity/issues) first
2. Use our [bug report template](https://github.com/AJaySi/ALwrity/issues/new?template=bug_report.md)
3. Include detailed steps to reproduce the issue
4. Provide error logs and screenshots when possible
### ✨ Feature Requests
Have an idea for a new feature?
1. Check existing [feature requests](https://github.com/AJaySi/ALwrity/issues?q=is%3Aissue+is%3Aopen+label%3Aenhancement)
2. Use our [feature request template](https://github.com/AJaySi/ALwrity/issues/new?template=feature_request.md)
3. Provide detailed use cases and mockups if possible
## 🚀 Quick Start
### Installation
```bash
# Clone the repository
git clone https://github.com/AJaySi/ALwrity.git
cd ALwrity
# Backend setup
cd backend
pip install -r requirements.txt
python start_alwrity_backend.py
# Frontend setup (in a new terminal)
cd frontend
npm install
npm start
```
### Common Issues
#### Backend Won't Start
- Check Python version (3.10+ required)
- Verify all dependencies are installed: `pip install -r requirements.txt`
- Check if port 8000 is available
- Review error logs in the terminal
#### Frontend Build Errors
- Check Node.js version (18+ required)
- Clear node_modules and reinstall: `rm -rf node_modules && npm install`
- Check for TypeScript errors: `npm run type-check`
#### API Connection Issues
- Verify backend is running on http://localhost:8000
- Check CORS settings in backend configuration
- Ensure API keys are properly configured
## 🔧 Troubleshooting
### Performance Issues
- **System Resources**: Check CPU, RAM usage during content generation
- **Database**: Review query performance, check for slow queries
- **API Rate Limits**: Monitor AI service rate limits (Gemini, OpenAI, etc.)
- **Browser**: Clear cache, cookies, and local storage
- **Network**: Check internet connectivity and API endpoint accessibility
### Authentication Problems
- **API Keys**: Verify all AI service API keys are correct and active
- **Environment Variables**: Check `.env` files are properly configured
- **Token Expiration**: Refresh authentication tokens if expired
- **Browser Storage**: Clear browser storage and try again
- **CORS Issues**: Check backend CORS configuration
### Content Generation Issues
- **AI Service Keys**: Verify Gemini, OpenAI, Anthropic API keys
- **Rate Limits**: Check if you've exceeded API rate limits
- **Content Quality**: Review prompt engineering and content validation
- **Error Logs**: Check backend logs for detailed error messages
- **API Credits**: Ensure sufficient credits for AI services
### ALwrity-Specific Issues
- **Onboarding**: Check if all required steps are completed
- **SEO Analysis**: Verify Google Search Console integration
- **Subscription Limits**: Check if you've exceeded usage limits
- **Database**: Ensure database is properly initialized
- **File Permissions**: Check file permissions for uploads and cache
## 📞 Contact Information
### Primary Support
- **GitHub Issues**: [Create an issue](https://github.com/AJaySi/ALwrity/issues/new)
- **GitHub Discussions**: [Join the discussion](https://github.com/AJaySi/ALwrity/discussions)
- **Email**: [support@alwrity.com](mailto:support@alwrity.com)
### Development Team
- **Lead Developer**: [@AJaySi](https://github.com/AJaySi)
- **Contributors**: [@uniqueumesh](https://github.com/uniqueumesh), [@DikshaDisciplines](https://github.com/DikshaDisciplines)
## 🕒 Response Times
- **Critical Issues**: 24 hours
- **Bug Reports**: 2-3 business days
- **Feature Requests**: 1 week
- **General Questions**: 3-5 business days
## 📖 Additional Resources
### Learning Materials
- **[Video Tutorials](https://youtube.com/alwrity)** - Step-by-step video guides
- **[Blog Posts](https://blog.alwrity.com)** - Tips, tricks, and best practices
- **[Case Studies](https://github.com/AJaySi/ALwrity/wiki/Case-Studies)** - Real-world usage examples
### Community
- **[Contributing Guide](CONTRIBUTING.md)** - How to contribute to ALwrity
- **[Code of Conduct](CODE_OF_CONDUCT.md)** - Community guidelines
- **[Roadmap](https://github.com/AJaySi/ALwrity/wiki/Roadmap)** - Upcoming features and improvements
## 🎯 Pro Tips
1. **Join our community** - Get help faster and share your experiences
2. **Search before asking** - Many questions have already been answered
3. **Provide context** - Include relevant details when asking for help
4. **Be patient** - We're a small team working hard to help everyone
5. **Contribute back** - Help others by sharing your solutions
---
**We're here to help you succeed with ALwrity!** 🚀

171
.github/TROUBLESHOOTING.md vendored Normal file
View File

@@ -0,0 +1,171 @@
# Fix for GitHub Issue #291: CopilotSidebar Import Error
## 🐛 **Issue**
User encounters error: `'CopilotSidebar' is not exported from '@copilotkit/react-ui'`
## 🔍 **Root Cause**
The user **did not run `npm install`** after cloning/pulling the repository, causing missing or outdated CopilotKit dependencies.
## ✅ **Solution**
### **Step 1: Clean Install Dependencies**
```bash
cd frontend
rm -rf node_modules package-lock.json
npm install
```
**For Windows PowerShell:**
```powershell
cd frontend
Remove-Item -Recurse -Force node_modules, package-lock.json -ErrorAction SilentlyContinue
npm install
```
### **Step 2: Verify CopilotKit Installation**
Check that the following packages are installed:
```bash
npm list @copilotkit/react-core @copilotkit/react-ui @copilotkit/shared
```
Expected output:
```
@copilotkit/react-core@1.10.3
@copilotkit/react-ui@1.10.3
@copilotkit/shared@1.10.3
```
### **Step 3: Build the Frontend**
```bash
npm run build
```
### **Step 4: Start Development Server**
```bash
npm start
```
## 📋 **Complete Setup Instructions for New Users**
### **Frontend Setup:**
```bash
# Navigate to frontend directory
cd frontend
# Install dependencies
npm install
# Create .env file from template
cp env_template.txt .env
# Add your environment variables to .env:
# REACT_APP_CLERK_PUBLISHABLE_KEY=<your-clerk-key>
# REACT_APP_COPILOTKIT_API_KEY=<your-copilotkit-key>
# Build the project
npm run build
# Start development server
npm start
```
### **Backend Setup:**
```bash
# Navigate to backend directory
cd backend
# Create virtual environment
python -m venv .venv
# Activate virtual environment
# Windows:
.venv\Scripts\activate
# macOS/Linux:
source .venv/bin/activate
# Install dependencies
pip install -r requirements.txt
# Create .env file from template
cp env_template.txt .env
# Add your environment variables to .env
# Initialize database tables
python scripts/create_subscription_tables.py
# Start backend server
python app.py
```
## 🎯 **Why This Happens**
1. **Missing `node_modules`**: Package dependencies not installed
2. **Outdated packages**: Old version of CopilotKit that doesn't export `CopilotSidebar`
3. **Skipped installation**: Running `npm start` before `npm install`
## ✅ **Verification**
After following the steps above, you should see:
- ✅ No import errors for `CopilotSidebar`
- ✅ Frontend compiles successfully
- ✅ Development server starts on `http://localhost:3000`
- ✅ Backend API accessible on `http://localhost:8000`
## 📚 **Reference**
- [CopilotKit UI Components Documentation](https://docs.copilotkit.ai/crewai-crews/custom-look-and-feel/built-in-ui-components)
- CopilotKit exports: `CopilotChat`, `CopilotSidebar`, `CopilotPopup` from `@copilotkit/react-ui`
## 🚨 **Common Mistakes to Avoid**
1. ❌ Running `npm start` without `npm install` first
2. ❌ Using outdated `package-lock.json`
3. ❌ Missing environment variables in `.env` files
4. ❌ Not running database migration scripts for backend
## 💡 **Pro Tip**
Always run these commands after pulling new code:
```bash
# Frontend
cd frontend && npm install && npm run build
# Backend
cd backend && pip install -r requirements.txt
```
---
## 🐛 **Issue: "Failed to process subscription" (500 Error)**
**Symptoms:**
- User selects Free or Basic plan on Pricing page
- Clicks "Subscribe to [Plan]"
- Gets error: "Failed to process subscription"
- Backend logs: `name 'UsageStatus' is not defined`
**Root Cause:**
Missing `UsageStatus` import in `backend/api/subscription_api.py`
**Fix:**
✅ Already fixed in latest version. Update to latest code:
```bash
git pull origin main
cd backend
python app.py # Restart backend
```
**Verify Fix:**
Check that `backend/api/subscription_api.py` line 18 includes:
```python
from models.subscription_models import (
..., UsageStatus # <-- This should be present
)
```

99
.github/pull_request_template.md vendored Normal file
View File

@@ -0,0 +1,99 @@
# Pull Request
## 📝 Description
Brief description of changes made in this PR.
## 🔄 Type of Change
- [ ] 🐛 Bug fix (non-breaking change which fixes an issue)
- [ ] ✨ New feature (non-breaking change which adds functionality)
- [ ] 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] 📚 Documentation update
- [ ] 🎨 Style/UI changes
- [ ] ♻️ Code refactoring
- [ ] ⚡ Performance improvements
- [ ] 🧪 Test additions/updates
## 🎯 Related Issues
Closes #(issue number)
Fixes #(issue number)
Related to #(issue number)
## 🧪 Testing
- [ ] Backend tests pass
- [ ] Frontend tests pass
- [ ] Manual testing completed
- [ ] Cross-browser testing (if applicable)
- [ ] Mobile testing (if applicable)
## 📸 Screenshots (if applicable)
Add screenshots to help explain your changes.
### Before
<!-- Add before screenshots here -->
### After
<!-- Add after screenshots here -->
## 🏷️ Component/Feature
Which component or feature is affected?
- [ ] Blog Writer
- [ ] SEO Dashboard
- [ ] Content Planning
- [ ] Facebook Writer
- [ ] LinkedIn Writer
- [ ] Onboarding
- [ ] Authentication
- [ ] API
- [ ] Database
- [ ] GSC Integration
- [ ] Subscription System
- [ ] Monitoring/Billing
- [ ] Documentation
- [ ] Other: _______________
## 📋 Checklist
- [ ] My code follows the project's style guidelines
- [ ] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] Any dependent changes have been merged and published
### ALwrity-Specific Checklist
- [ ] API endpoints follow RESTful conventions
- [ ] AI service integrations handle rate limits and errors gracefully
- [ ] Content generation includes proper validation and sanitization
- [ ] Database migrations are included if schema changes are made
- [ ] Environment variables are documented in env_template.txt
- [ ] Security considerations have been addressed
- [ ] Performance impact has been considered
- [ ] User experience is consistent with existing features
## 🔍 Code Quality
- [ ] Code is properly formatted
- [ ] No console.log statements left in production code
- [ ] Error handling is implemented where needed
- [ ] Performance considerations have been addressed
- [ ] Security considerations have been addressed
## 📚 Documentation
- [ ] README updated (if needed)
- [ ] API documentation updated (if needed)
- [ ] Code comments added for complex logic
- [ ] Changelog updated (if applicable)
## 🚀 Deployment Notes
Any special deployment considerations or environment variables needed.
## 🔗 Additional Context
Add any other context about the pull request here.
## 👥 Reviewers
Tag specific reviewers if needed:
@AJaySi @uniqueumesh @DikshaDisciplines
---
**Thank you for contributing to ALwrity!** 🎉

103
.github/setup_alwrity.bat vendored Normal file
View File

@@ -0,0 +1,103 @@
@echo off
REM ALwrity Complete Setup Script for Windows
REM This script sets up both frontend and backend for local development
echo ================================
echo 🚀 ALwrity Setup Script (Windows)
echo ================================
echo.
REM Check if we're in the project root
if not exist "frontend\" (
echo ❌ Error: frontend directory not found
echo Please navigate to the AI-Writer directory and try again.
exit /b 1
)
if not exist "backend\" (
echo ❌ Error: backend directory not found
echo Please navigate to the AI-Writer directory and try again.
exit /b 1
)
echo 📋 Step 1: Setting up Backend
echo --------------------------------
REM Setup Backend
cd backend
echo Creating Python virtual environment...
python -m venv .venv
echo Activating virtual environment...
call .venv\Scripts\activate.bat
echo Installing Python dependencies...
pip install -r requirements.txt
REM Create .env file if it doesn't exist
if not exist ".env" (
echo Creating .env file from template...
copy env_template.txt .env
echo ⚠️ Please update backend\.env with your API keys
)
echo Creating subscription tables...
python scripts\create_subscription_tables.py 2>nul || echo ⚠️ Subscription tables may already exist
echo Updating subscription plans...
python scripts\cleanup_alpha_plans.py 2>nul || echo ⚠️ Plans may already be updated
cd ..
echo ✅ Backend setup complete!
echo.
echo 📋 Step 2: Setting up Frontend
echo --------------------------------
REM Setup Frontend
cd frontend
REM Clean install
if exist "node_modules\" (
echo Cleaning old node_modules...
rmdir /s /q node_modules 2>nul
del package-lock.json 2>nul
)
echo Installing Node.js dependencies (this may take a few minutes)...
call npm install
REM Create .env file if it doesn't exist
if not exist ".env" (
echo Creating .env file from template...
copy env_template.txt .env
echo ⚠️ Please update frontend\.env with your environment variables
)
echo Building frontend...
call npm run build
cd ..
echo.
echo ================================
echo 🎉 ALwrity Setup Complete!
echo ================================
echo.
echo Next steps:
echo 1. Update backend\.env with your API keys (Clerk, Gemini, etc.)
echo 2. Update frontend\.env with your Clerk publishable key
echo.
echo To start the application:
echo Backend: cd backend ^&^& python app.py
echo Frontend: cd frontend ^&^& npm start
echo.
echo Access points:
echo Frontend: http://localhost:3000
echo Backend API: http://localhost:8000/api/docs
echo.
echo Happy coding! 🚀
pause

105
.github/setup_alwrity.sh vendored Normal file
View File

@@ -0,0 +1,105 @@
#!/bin/bash
# ALwrity Complete Setup Script
# This script sets up both frontend and backend for local development
set -e # Exit on error
echo "🚀 ALwrity Setup Script"
echo "================================"
echo ""
# Color codes for output
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
RED='\033[0;31m'
NC='\033[0m' # No Color
# Check if we're in the project root
if [ ! -d "frontend" ] || [ ! -d "backend" ]; then
echo -e "${RED}❌ Error: This script must be run from the project root directory${NC}"
echo "Please navigate to the AI-Writer directory and try again."
exit 1
fi
echo -e "${YELLOW}📋 Step 1: Setting up Backend${NC}"
echo "--------------------------------"
# Setup Backend
cd backend
echo "Creating Python virtual environment..."
python -m venv .venv || python3 -m venv .venv
echo "Activating virtual environment..."
source .venv/bin/activate || source .venv/Scripts/activate
echo "Installing Python dependencies..."
pip install -r requirements.txt
# Create .env file if it doesn't exist
if [ ! -f ".env" ]; then
echo "Creating .env file from template..."
cp env_template.txt .env
echo -e "${YELLOW}⚠️ Please update backend/.env with your API keys${NC}"
fi
echo "Creating subscription tables..."
python scripts/create_subscription_tables.py || echo -e "${YELLOW}⚠️ Subscription tables may already exist${NC}"
echo "Updating subscription plans..."
python scripts/cleanup_alpha_plans.py || echo -e "${YELLOW}⚠️ Plans may already be updated${NC}"
cd ..
echo -e "${GREEN}✅ Backend setup complete!${NC}"
echo ""
echo -e "${YELLOW}📋 Step 2: Setting up Frontend${NC}"
echo "--------------------------------"
# Setup Frontend
cd frontend
# Clean install
if [ -d "node_modules" ]; then
echo "Cleaning old node_modules..."
rm -rf node_modules package-lock.json
fi
echo "Installing Node.js dependencies (this may take a few minutes)..."
npm install
# Create .env file if it doesn't exist
if [ ! -f ".env" ]; then
echo "Creating .env file from template..."
cp env_template.txt .env
echo -e "${YELLOW}⚠️ Please update frontend/.env with your environment variables${NC}"
fi
echo "Building frontend..."
npm run build
cd ..
echo -e "${GREEN}✅ Frontend setup complete!${NC}"
echo ""
echo "================================"
echo -e "${GREEN}🎉 ALwrity Setup Complete!${NC}"
echo "================================"
echo ""
echo "Next steps:"
echo "1. Update backend/.env with your API keys (Clerk, Gemini, etc.)"
echo "2. Update frontend/.env with your Clerk publishable key"
echo ""
echo "To start the application:"
echo " Backend: cd backend && python app.py"
echo " Frontend: cd frontend && npm start"
echo ""
echo "Access points:"
echo " Frontend: http://localhost:3000"
echo " Backend API: http://localhost:8000/api/docs"
echo ""
echo -e "${GREEN}Happy coding! 🚀${NC}"

67
.github/workflows/docs.yml vendored Normal file
View File

@@ -0,0 +1,67 @@
name: Deploy Documentation
on:
push:
branches: [main]
paths: ['docs/**', 'docs-site/**', 'mkdocs.yml']
pull_request:
branches: [main]
paths: ['docs/**', 'docs-site/**', 'mkdocs.yml']
permissions:
contents: read
pages: write
id-token: write
actions: read
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install mkdocs mkdocs-material
- name: Setup Pages
uses: actions/configure-pages@v4
with:
enablement: true
- name: Build documentation
run: |
cd docs-site
mkdocs build --site-dir ../site
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: site
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
if: github.ref == 'refs/heads/main'
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}