|
1 | | -# SmartQuery |
| 1 | +# SmartQuery MVP |
| 2 | + |
| 3 | +A natural language CSV querying application built with Next.js and FastAPI. |
| 4 | + |
| 5 | +## Architecture |
| 6 | + |
| 7 | +SmartQuery is built as a monorepo with the following structure: |
| 8 | + |
| 9 | +- **Frontend**: Next.js 14 with TypeScript, Tailwind CSS, and daisyUI |
| 10 | +- **Backend**: FastAPI with Python for natural language processing |
| 11 | +- **Database**: PostgreSQL for metadata storage |
| 12 | +- **Storage**: File storage for CSV uploads |
| 13 | +- **AI**: OpenAI integration for natural language to SQL conversion |
| 14 | + |
| 15 | +## Development Setup |
| 16 | + |
| 17 | +### Prerequisites |
| 18 | + |
| 19 | +- Node.js 18+ and npm |
| 20 | +- Python 3.9+ |
| 21 | +- Git |
| 22 | + |
| 23 | +### Getting Started |
| 24 | + |
| 25 | +1. Clone the repository: |
| 26 | +```bash |
| 27 | +git clone <repository-url> |
| 28 | +cd SmartQuery |
| 29 | +``` |
| 30 | + |
| 31 | +2. Install dependencies: |
| 32 | +```bash |
| 33 | +# Frontend |
| 34 | +cd frontend |
| 35 | +npm install |
| 36 | + |
| 37 | +# Backend |
| 38 | +cd ../backend |
| 39 | +pip install -r requirements.txt |
| 40 | +``` |
| 41 | + |
| 42 | +3. Set up environment variables: |
| 43 | +```bash |
| 44 | +# Frontend |
| 45 | +cp frontend/.env.example frontend/.env.local |
| 46 | + |
| 47 | +# Backend |
| 48 | +cp backend/.env.example backend/.env |
| 49 | +``` |
| 50 | + |
| 51 | +4. Start development servers: |
| 52 | +```bash |
| 53 | +# Frontend (from frontend directory) |
| 54 | +npm run dev |
| 55 | + |
| 56 | +# Backend (from backend directory) |
| 57 | +uvicorn main:app --reload |
| 58 | +``` |
| 59 | + |
| 60 | +## CI/CD Pipeline |
| 61 | + |
| 62 | +This project uses GitHub Actions for continuous integration and deployment: |
| 63 | + |
| 64 | +### Workflow Features |
| 65 | + |
| 66 | +- **Frontend CI**: ESLint, TypeScript checking, testing, and building |
| 67 | +- **Backend CI**: Black formatting, isort, flake8 linting, and pytest |
| 68 | +- **Integration Tests**: Full-stack testing with PostgreSQL |
| 69 | +- **Security Scanning**: Trivy vulnerability scanning and dependency audits |
| 70 | +- **Multi-version Testing**: Node.js 18.x/20.x and Python 3.9/3.10/3.11 |
| 71 | +- **Automated Deployment**: Deploys to staging on main branch |
| 72 | + |
| 73 | +### Running Tests Locally |
| 74 | + |
| 75 | +```bash |
| 76 | +# Frontend tests |
| 77 | +cd frontend |
| 78 | +npm run test |
| 79 | +npm run lint |
| 80 | +npm run type-check |
| 81 | + |
| 82 | +# Backend tests |
| 83 | +cd backend |
| 84 | +pytest tests/ |
| 85 | +black --check . |
| 86 | +isort --check-only . |
| 87 | +flake8 . |
| 88 | +``` |
| 89 | + |
| 90 | +## Project Status |
| 91 | + |
| 92 | +✅ **Task 1**: Monorepo structure initialized |
| 93 | +✅ **Task 2**: Environment configuration setup |
| 94 | +✅ **Task 3**: API contract specifications defined |
| 95 | +✅ **Task 4**: CI/CD pipeline implemented |
| 96 | + |
| 97 | +## Contributing |
| 98 | + |
| 99 | +1. Create a feature branch |
| 100 | +2. Make your changes |
| 101 | +3. Ensure all tests pass locally |
| 102 | +4. Create a pull request |
| 103 | +5. Wait for CI/CD pipeline to pass |
| 104 | +6. Request review |
| 105 | + |
| 106 | +The CI/CD pipeline will automatically run on all pull requests and validate code quality, run tests, and perform security checks. |
0 commit comments