pyrmit/
├── backend/ # FastAPI application
│ ├── routers/ # API route definitions
│ ├── database.py # Database connection & session
│ ├── main.py # App entry point
│ ├── models.py # SQLAlchemy database models
│ ├── schemas.py # Pydantic data models
│ ├── requirements.txt # Python dependencies
│ └── Dockerfile
├── frontend/ # Next.js application
│ ├── app/ # App Router source code
│ │ ├── page.tsx # Main chat page
│ │ ├── layout.tsx # Root layout
│ │ └── globals.css # Global styles
│ ├── next.config.js # Next.js configuration
│ ├── package.json # Node dependencies
│ └── Dockerfile
├── docker-compose.yml # Service orchestration
└── README.md
- Docker Desktop installed
- An OpenAI API Key
The project uses environment variables for configuration.
Backend (backend/.env):
Ensure the file exists and contains your OpenAI API key.
OPENAI_API_KEY=sk-your_actual_api_key_here
DATABASE_URL=postgresql://user:password@db:5432/pyrmitFrontend (frontend/.env):
Configures the API endpoint.
NEXT_PUBLIC_API_URL=http://localhost:8000Start the entire stack using Docker Compose:
docker-compose up --buildThis command will:
- Start the PostgreSQL database.
- Build and start the Backend service (available at port 8000).
- Build and start the Frontend service (available at port 3000).
- User Interface: Open http://localhost:3000 to chat with the agent.
- API Documentation: Open http://localhost:8000/docs to explore the backend API via Swagger UI.
To stop the application, press Ctrl+C in the terminal where docker-compose is running, or run:
docker-compose downDatabase data is persisted in a Docker volume named postgres_data. To reset the database, you can remove this volume:
docker-compose down -vIf you prefer to run the backend and frontend locally for faster development (hot-reloading, debugging) while keeping the database in Docker:
-
Start only the Database:
docker-compose up -d db
-
Backend Setup:
- Update
backend/.env: SetDATABASE_URL=postgresql://user:password@localhost:5432/pyrmit - Install dependencies:
cd backend uv venv source .venv/bin/activate uv pip install -r requirements.txt
- Run server:
uvicorn main:app --reload
- Update
-
Frontend Setup:
- Install dependencies:
cd frontend bun install - Run dev server:
bun run dev
- Install dependencies:
