SanjinDedic / agent_games

Secure, extensible agent competition platform API build with FastAPI, SQLmodel, Pydantic and Docker
8 stars 1 forks source link
docker fastapi pydantic-v2 sqlmodel

Agent Games

This project is a monorepo containing both the frontend and backend for the Agent Games application.

Frontend

React Redux React Router Monaco Editor JWT

The frontend is built with React and Redux, offering a user interface for game submission, league management, and result viewing. It features code editing capabilities and responsive design.

For more details, see the Frontend README.

Backend

Python FastAPI Pydantic SQLModel Docker Tests codecov

The backend is powered by FastAPI, handling game logic, user authentication, and data management. It uses SQLModel for database interactions, Pydantic for data validation, and includes Docker integration for simulations. SQLite is used for data storage.

For more information, check out the Backend README.

Getting Started

For instructions on how to set up and run the project locally, please refer to the respective README files in the frontend and backend directories.

Running the App Locally

Note: Use separate terminals for running the backend and frontend. Navigate to the respective directories (cd backend or cd frontend) in each terminal before running the commands.

Backend

To run the backend locally, follow these steps:

  1. Create a Virtual Environment and Install Dependencies:

    cd backend
    python3 -m venv venv
    source venv/bin/activate  # On Windows, use `venv\Scripts\activate`
    pip install -r requirements.txt
  2. Build the Docker Image:

    After installing the dependencies, build the Docker image:

    docker build -t run-with-docker .
  3. Set Up the Production Database:

    python3 production_database_setup.py
  4. Run the Uvicorn Server:

    uvicorn api:app --reload

The backend server should now be running locally on http://localhost:8000.

Frontend

To run the frontend locally, follow these steps:

  1. Update the .env File:

    Ensure your .env file is configured to use the local backend:

    REACT_APP_AGENT_API_URL=http://localhost:8000
  2. Install Node.js Dependencies:

    cd frontend
    npm install
  3. Run the Application:

    If you encounter any issues, you may need to clear the npm cache and remove node_modules:

    npm cache clean --force
    rm -rf node_modules
    npm install

    Then start the application:

    npm start

The frontend should now be running locally and accessible via http://localhost:3000.

Notes