- AI-Powered Market Simulation and Analysis: Generate concise summaries with customizable formats and lengths
- User Authentication: Secure authentication
- Subscription Management: Tiered subscription plans with Paystack payment integration
- Credit System: Token-based usage tracking for API calls
- Responsive Design: Works seamlessly across desktop and mobile devices
The project is structured as a monorepo with separate frontend and backend directories:
marketinsight/
├── frontend/ # Next.js 14 application
├── backend/ # FastAPI service
└── README.md # This file
The frontend is built with Next.js 14 using the App Router, TypeScript, and TailwindCSS. It provides:
- Clean, intuitive dashboard interface
- Responsive design for all device sizes
- Copy and format controls for output customization
- Subscription plan management
The backend is powered by FastAPI and provides:
- RESTful API endpoints for all functionality
- PostgreSQL database integration
- Google AI (Gemini) integration for AI processing
- Paystack subscription handling
- Background tasks for subscription management
- Python 3.8+
- Node.js 18.0+
- PostgreSQL
- Paystack account
- Google AI (Gemini) API key
Navigate to the backend directory:
cd backendCreate and activate a virtual environment:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
Install dependencies:
pip install -r requirements.txt
Create a
.envfile based on the example:DATABASE_URL=postgresql+asyncpg://user:password@localhost:5432/db_name DATABASE_URL_MIGRATION=postgresql://user:password@localhost:5432/db_name GOOGLE_API_KEY=your_google_api_key CORS_ORIGINS=http://localhost:3000,https://your-frontend-domain.com PAYSTACK_BACKEND_URL=https://api.paystack.co PAYSTACK_SECRET_KEY=your_paystack_secret_key
Run database migrations:
alembic upgrade head
Start the backend server:
uvicorn app.main:app --reload --workers 1 --host 0.0.0.0 --port 8080
Navigate to the frontend directory:
cd frontendInstall dependencies:
npm install # or yarn installCreate a
.env.localfile:
NEXT_PUBLIC_API_BASE_URL= NEXT_PUBLIC_PAYSTACK_PLAN_PROFESSIONAL= NEXT_PUBLIC_PAYSTACK_PLAN_ENTERPRISE= NEXT_PUBLIC_PAYSTACK_PLAN_PROFESSIONAL_PRICE= NEXT_PUBLIC_PAYSTACK_PLAN_ENTERPRISE_PRICE= NEXT_PUBLIC_PAYSTACK_PUBLIC_KEY=
4. Start the development server:
```bash
npm run dev
# or yarn dev
- Open http://localhost:3000 in your browser.
MarketInsight offers two subscription tiers:
- Professional Plan: 250 credits per month
- Enterprise Plan: 520 credits per year (20% savings)
- Backend API: http://localhost:8080/docs (when running locally)
- Detailed documentation for both frontend and backend can be found in their respective directories
uvicorn app.main:app --workers 4 --host 0.0.0.0 --port 8080The frontend is configured for deployment on Vercel:
- Push your code to a Git repository
- Import the project into Vercel
- Configure environment variables
- Deploy