Skip to content

kthaisociety/pyrmit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pyrmit - Building Permit Agent

Pyrmit is an intelligent building permit agent designed to assist with permit-related queries. The user is able to input their own legal documents and chunk, embed and store them in an SQL database. The agent can then be used to provide an action plan to fast-track the building permit process. Pyrmit Logo

Tech Stack

Frontend

Next JS React TypeScript TailwindCSS

Backend

FastAPI Python PostgreSQL Docker OpenAI

Project Structure

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

Prerequisites

Getting Started

1. Configuration

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/pyrmit

Frontend (frontend/.env): Configures the API endpoint.

NEXT_PUBLIC_API_URL=http://localhost:8000

2. Running the Application

Start the entire stack using Docker Compose:

docker-compose up --build

This 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).

3. Accessing the App

Development

To stop the application, press Ctrl+C in the terminal where docker-compose is running, or run:

docker-compose down

Data Persistence

Database data is persisted in a Docker volume named postgres_data. To reset the database, you can remove this volume:

docker-compose down -v

Alternative: Running Locally (Hybrid Mode)

If you prefer to run the backend and frontend locally for faster development (hot-reloading, debugging) while keeping the database in Docker:

  1. Start only the Database:

    docker-compose up -d db
  2. Backend Setup:

    • Update backend/.env: Set DATABASE_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
  3. Frontend Setup:

    • Install dependencies:
      cd frontend
      bun install
    • Run dev server:
      bun run dev

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors