InstaGraph 🌐 Next.js and FastAPI
InstaGraph is a creative fusion of modern web technologies, inspired by Yohei Nakajima's original project. This project uses Next.js for its speedy frontend and FastAPI for a robust backend, creating an efficient and scalable application.
Project Background
The developer, having a history with Python, especially Django, decided to leverage the newer, faster tools available today. Next.js, supported by Tailwind CSS and other libraries like Shadcn, accelerates frontend development. The emergence of large language models (LLMs) has made streaming and server-sent endpoints essential for AI-driven products, and FastAPI is ideally suited to build such backends because of its speed and simplicity.
Key Technologies
- Next.js: A React-based framework that offers enhanced performance and routing capabilities, facilitating the creation of fast, user-friendly web interfaces.
- FastAPI: A high-speed web framework for Python used to construct efficient RESTful APIs, ideal for backend development.
- Shadcn and React Flow: These are supplementary tools aiding in seamless design and interface flow.
Getting Started
Installation Steps
To set up the InstaGraph development environment, the process is straightforward:
- Clone the Repository: Download the project code.
git clone https://github.com/waseemhnyc/instagraph-nextjs-fastapi.git
- Navigate to Project Directory: Change to the project's directory.
cd instagraph-nextjs-fastapi
- Install Frontend Packages: Use Yarn to install necessary dependencies.
yarn
- Setup Environment Variables: Define your API key.
OPENAI_API_KEY=your-api-key-here
- Start Frontend: Run the Next.js application in development mode.
yarn run dev
With the frontend operational, it's time to set up the backend:
- Switch to API Directory and Setup Python Environment:
cd api/ python3 -m venv venv source venv/bin/activate
- Install Backend Libraries: Ensure Python dependencies are in place.
pip install -r requirements.txt
- Set API Key for Backend: Create configuration for backend.
cp .env.example .env
- Run Backend Server: Launch the FastAPI server to handle requests.
uvicorn main:app --host 0.0.0.0
Usage
InstaGraph provides a user-friendly web interface:
- Access through your web browser at
http://localhost:3000/
. - Input your desired text into the text box provided.
- Press "Submit" to see the results processed by the application.
License
InstaGraph is open-source, licensed under the MIT License, allowing freedom to use and modify the project. For further details, please refer to the LICENSE file in the project's repository.
InstaGraph serves not only as a demonstration of modern web technology integration but also as a starting point for developers interested in building cutting-edge applications with similar stacks.